View Javadoc

1   /*
2    * Copyright 2005-2009 The Kuali Foundation
3    * 
4    * 
5    * Licensed under the Educational Community License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    * 
9    * http://www.opensource.org/licenses/ecl2.php
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.kuali.rice.kew.dto;
18  
19  import java.util.HashMap;
20  import java.util.Map;
21  
22  /**
23   * Document plus it's requests and actions.  Primarily used by the routingReport method 
24   * on WorkflowInfo
25   * 
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   */
28  public class DocumentDetailDTO extends RouteHeaderDTO {
29  
30  	private static final long serialVersionUID = -6089529693944755804L;
31  	
32  	private ActionRequestDTO[] actionRequests = new ActionRequestDTO[0];
33  	private ActionTakenDTO[] actionsTaken = new ActionTakenDTO[0];
34      private RouteNodeInstanceDTO[] nodeInstances = new RouteNodeInstanceDTO[0];
35  
36      private Map nodeInstanceMap = null;
37      
38  	public ActionRequestDTO[] getActionRequests() {
39  		return actionRequests;
40  	}
41  
42  	public void setActionRequests(ActionRequestDTO[] actionRequests) {
43  		this.actionRequests = actionRequests;
44  	}
45  
46  	public ActionTakenDTO[] getActionsTaken() {
47  		return actionsTaken;
48  	}
49  
50  	public void setActionsTaken(ActionTakenDTO[] actionsTaken) {
51  		this.actionsTaken = actionsTaken;
52  	}
53      
54      public RouteNodeInstanceDTO[] getNodeInstances() {
55          return nodeInstances;
56      }
57  
58      public void setNodeInstances(RouteNodeInstanceDTO[] nodeInstances) {
59          this.nodeInstances = nodeInstances;
60      }
61  
62      public RouteNodeInstanceDTO getNodeInstance(Long nodeInstanceId) {
63          if (nodeInstanceMap == null) {
64              populateNodeInstanceMap();
65          }
66          return (RouteNodeInstanceDTO)nodeInstanceMap.get(nodeInstanceId);
67      }
68      
69      private void populateNodeInstanceMap() {
70          nodeInstanceMap = new HashMap();
71          for (int index = 0; index < nodeInstances.length; index++) {
72              RouteNodeInstanceDTO nodeInstance = nodeInstances[index];
73              nodeInstanceMap.put(nodeInstance.getRouteNodeInstanceId(), nodeInstance);
74          }
75      }
76      
77      
78  
79  }