View Javadoc

1   /**
2    * Copyright 2005-2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kew.documentoperation.web;
17  
18  import java.util.ArrayList;
19  import java.util.HashMap;
20  import java.util.List;
21  import java.util.Map;
22  
23  import org.apache.commons.collections.Factory;
24  import org.apache.commons.collections.ListUtils;
25  import org.kuali.rice.kew.api.action.ActionRequestStatus;
26  import org.kuali.rice.kew.api.action.RecipientType;
27  import org.kuali.rice.kew.engine.node.Branch;
28  import org.kuali.rice.kew.engine.node.RouteNodeInstance;
29  import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
30  import org.kuali.rice.kew.api.KewApiConstants;
31  import org.kuali.rice.kns.web.struts.form.KualiForm;
32  
33  /**
34   * struts form bean for {@link DocumentOperationAction}.
35   *
36   * @author Kuali Rice Team (rice.collab@kuali.org)
37   */
38  public class DocumentOperationForm extends KualiForm {
39  
40  	private static final long serialVersionUID = 2994179393392218743L;
41  	private DocumentRouteHeaderValue routeHeader;
42      private String documentId;
43  
44      private List actionRequestOps = new ArrayList();
45      private List actionTakenOps = new ArrayList();
46      private List actionItemOps = new ArrayList();
47  
48  
49      private String routeHeaderOp;
50  
51      private String statusModDate;
52      private String createDate;
53      private String approvedDate;
54      private String finalizedDate;
55      private String routeStatusDate;
56      private String routeLevelDate;
57      private String lookupableImplServiceName;
58      private String lookupType;
59      private Map docStatuses = KewApiConstants.DOCUMENT_STATUSES;
60      private Map actionRequestCds = KewApiConstants.ACTION_REQUEST_CD;
61      private Map actionTakenCds = KewApiConstants.ACTION_TAKEN_CD;
62      private List routeModules;
63      private String routeModuleName;
64  
65      private String lookupInvocationModule;
66      private String lookupInvocationField;
67      private String lookupInvocationIndex;
68  
69      //variabes for RouteNodeInstances and branches
70      private List routeNodeInstances=ListUtils.lazyList(new ArrayList(),
71              new Factory() {
72          		public Object create() {
73          			return new RouteNodeInstance();
74          		}
75         		});
76  
77      private List routeNodeInstanceOps=new ArrayList();
78      private List branches=ListUtils.lazyList(new ArrayList(),
79              new Factory() {
80  				public Object create() {
81  					return new Branch();
82  				}
83  			});
84      private List branchOps=new ArrayList();
85      private List nodeStateDeleteOps=new ArrayList();
86      private String nodeStatesDelete;
87      private String branchStatesDelete;
88      private String initialNodeInstances;
89  
90      private String annotation;
91  
92      private String blanketApproveUser;
93      private String blanketApproveActionTakenId;
94      private String blanketApproveNodes;
95      private String actionInvocationUser;
96      private String actionInvocationActionItemId;
97      private String actionInvocationActionCode;
98  
99      public String getAnnotation() {
100 		return annotation;
101 	}
102 
103 	public void setAnnotation(String annotation) {
104 		this.annotation = annotation;
105 	}
106 
107 	public String getInitialNodeInstances(){
108     	return initialNodeInstances;
109     }
110 
111     public void setInitialNodeInstances(String initialNodeInstances){
112     	this.initialNodeInstances=initialNodeInstances;
113     }
114 
115     public String getNodeStatesDelete(){
116     	return nodeStatesDelete;
117     }
118 
119     public void setNodeStatesDelete(String nodeStatesDelete){
120     	this.nodeStatesDelete=nodeStatesDelete;
121     }
122 
123     public String getBranchStatesDelete(){
124     	return branchStatesDelete;
125     }
126 
127     public void setBranchStatesDelete(String branchStatesDelete){
128     	this.branchStatesDelete=branchStatesDelete;
129     }
130 
131     public DocumentOperationForm(){
132         routeHeader = new DocumentRouteHeaderValue();
133     }
134 
135     public DocumentRouteHeaderValue getRouteHeader() {
136         return routeHeader;
137     }
138     public void setRouteHeader(DocumentRouteHeaderValue routeHeader) {
139         this.routeHeader = routeHeader;
140     }
141 
142     public DocOperationIndexedParameter getActionRequestOp(int index) {
143         while (actionRequestOps.size() <= index) {
144             actionRequestOps.add(new DocOperationIndexedParameter(new Integer(index), KewApiConstants.NOOP));
145         }
146         return (DocOperationIndexedParameter) getActionRequestOps().get(index);
147     }
148 
149     public DocOperationIndexedParameter getActionTakenOp(int index) {
150         while (actionTakenOps.size() <= index) {
151             actionTakenOps.add(new DocOperationIndexedParameter(new Integer(index), KewApiConstants.NOOP));
152         }
153         return (DocOperationIndexedParameter) getActionTakenOps().get(index);
154     }
155 
156     public DocOperationIndexedParameter getRouteNodeInstanceOp(int index) {
157         while (routeNodeInstanceOps.size() <= index) {
158         	routeNodeInstanceOps.add(new DocOperationIndexedParameter(new Integer(index), KewApiConstants.NOOP));
159         }
160         return (DocOperationIndexedParameter) getRouteNodeInstanceOps().get(index);
161     }
162 
163     public DocOperationIndexedParameter getBranchOp(int index) {
164         while (branchOps.size() <= index) {
165         	branchOps.add(new DocOperationIndexedParameter(new Integer(index), KewApiConstants.NOOP));
166         }
167         return (DocOperationIndexedParameter) getBranchOps().get(index);
168     }
169 
170     public DocOperationIndexedParameter getActionItemOp(int index) {
171         while (actionItemOps.size() <= index) {
172             actionItemOps.add(new DocOperationIndexedParameter(new Integer(index), KewApiConstants.NOOP));
173         }
174         return (DocOperationIndexedParameter) getActionItemOps().get(index);
175     }
176 
177     public DocOperationIndexedParameter getNodeStateDeleteOp(int index){
178     	while(nodeStateDeleteOps.size()<=index){
179     		nodeStateDeleteOps.add(new DocOperationIndexedParameter(new Integer(index),""));
180     	}
181     	return(DocOperationIndexedParameter) getNodeStateDeleteOps().get(index);
182     }
183 
184     public List getActionItemOps() {
185         return actionItemOps;
186     }
187     public void setActionItemOps(List actionItemOps) {
188         this.actionItemOps = actionItemOps;
189     }
190     public List getActionRequestOps() {
191         return actionRequestOps;
192     }
193     public void setActionRequestOps(List actionRequestOps) {
194         this.actionRequestOps = actionRequestOps;
195     }
196     public List getActionTakenOps() {
197         return actionTakenOps;
198     }
199     public List getRouteNodeInstanceOps() {
200         return routeNodeInstanceOps;
201     }
202 
203     public List getBranchOps(){
204     	return branchOps;
205     }
206 
207     public List getNodeStateDeleteOps(){
208     	return nodeStateDeleteOps;
209     }
210 
211     public void setActionTakenOps(List actionTakenOps) {
212         this.actionTakenOps = actionTakenOps;
213     }
214 
215     public void setRouteNodeInstanceOps(List routeNodeInstanceOps) {
216         this.routeNodeInstanceOps = routeNodeInstanceOps;
217     }
218 
219     public void setBranchOps(List branchOps){
220     	this.branchOps=branchOps;
221     }
222 
223     public void setNodeStateDeleteOps(List nodeStateDeleteOps){
224     	this.nodeStateDeleteOps=nodeStateDeleteOps;
225     }
226 
227     public String getRouteHeaderOp() {
228         return routeHeaderOp;
229     }
230     public void setRouteHeaderOp(String routeHeaderOp) {
231         this.routeHeaderOp = routeHeaderOp;
232     }
233     public String getApprovedDate() {
234         return approvedDate;
235     }
236     public void setApprovedDate(String approvedDate) {
237         this.approvedDate = approvedDate;
238     }
239     public String getCreateDate() {
240         return createDate;
241     }
242     public void setCreateDate(String createDate) {
243         this.createDate = createDate;
244     }
245     public String getFinalizedDate() {
246         return finalizedDate;
247     }
248     public void setFinalizedDate(String finalizedDate) {
249         this.finalizedDate = finalizedDate;
250     }
251     public String getRouteLevelDate() {
252         return routeLevelDate;
253     }
254     public void setRouteLevelDate(String routeLevelDate) {
255         this.routeLevelDate = routeLevelDate;
256     }
257     public String getRouteStatusDate() {
258         return routeStatusDate;
259     }
260     public void setRouteStatusDate(String routeStatusDate) {
261         this.routeStatusDate = routeStatusDate;
262     }
263     public String getStatusModDate() {
264         return statusModDate;
265     }
266     public void setStatusModDate(String statusModDate) {
267         this.statusModDate = statusModDate;
268     }
269 
270 
271     public String getLookupableImplServiceName() {
272         return lookupableImplServiceName;
273     }
274     public void setLookupableImplServiceName(String lookupableImplServiceName) {
275         this.lookupableImplServiceName = lookupableImplServiceName;
276     }
277     public String getLookupType() {
278         return lookupType;
279     }
280     public void setLookupType(String lookupType) {
281         this.lookupType = lookupType;
282     }
283 
284     public Map getDocStatuses() {
285         return docStatuses;
286     }
287 
288     public Map getActionRequestCds() {
289         return actionRequestCds;
290     }
291     public Map<String, String> getActionRequestRecipientTypes() {
292     	Map<String, String> actionRequestRecipientTypes = new HashMap<String, String>();
293     	for (RecipientType recipientType : RecipientType.values()) {
294     		actionRequestRecipientTypes.put(recipientType.getCode(), recipientType.getLabel());
295     	}
296         return actionRequestRecipientTypes;
297     }
298     public Map<String, String> getActionRequestStatuses() {
299         Map<String, String> actionRequestStatuses = new HashMap<String, String>();
300     	for (ActionRequestStatus requestStatus : ActionRequestStatus.values()) {
301     		actionRequestStatuses.put(requestStatus.getCode(), requestStatus.getLabel());
302     	}
303         return actionRequestStatuses;
304     }
305 
306     public String getLookupInvocationField() {
307         return lookupInvocationField;
308     }
309     public void setLookupInvocationField(String lookupInvocationField) {
310         this.lookupInvocationField = lookupInvocationField;
311     }
312     public String getLookupInvocationIndex() {
313         return lookupInvocationIndex;
314     }
315     public void setLookupInvocationIndex(String lookupInvocationIndex) {
316         this.lookupInvocationIndex = lookupInvocationIndex;
317     }
318     public String getLookupInvocationModule() {
319         return lookupInvocationModule;
320     }
321     public void setLookupInvocationModule(String lookupInvocationModule) {
322         this.lookupInvocationModule = lookupInvocationModule;
323     }
324     public Map getActionTakenCds() {
325         return actionTakenCds;
326     }
327 
328     public String getDocumentId() {
329         return documentId;
330     }
331     public void setDocumentId(String documentId) {
332         this.documentId = documentId;
333     }
334 
335     public List getRouteModules() {
336         return routeModules;
337     }
338 
339     public void setRouteModules(List routeModules) {
340         this.routeModules = routeModules;
341     }
342 
343     public String getRouteModuleName() {
344         return routeModuleName;
345     }
346 
347     public void setRouteModuleName(String routeModuleName) {
348         this.routeModuleName = routeModuleName;
349     }
350 
351     /*
352      * methods for route node instances
353      */
354 
355     public List getRouteNodeInstances(){
356     	return routeNodeInstances;
357     }
358 
359     public void setRouteNodeInstances(List routeNodeInstances){
360     	this.routeNodeInstances=routeNodeInstances;
361     }
362 
363     public RouteNodeInstance getRouteNodeInstance(int index){
364     	while (getRouteNodeInstances().size() <= index) {
365                 getRouteNodeInstances().add(new RouteNodeInstance());
366             }
367             return (RouteNodeInstance) getRouteNodeInstances().get(index);
368     }
369 
370     public List getBranches(){
371     	return branches;
372     }
373 
374     public void setBranches(List branches){
375     	this.branches=branches;
376     }
377 
378     public Branch getBranche(int index){
379     	while(getBranches().size()<=index){
380     		getBranches().add(new Branch());
381     	}
382     	return (Branch) getBranches().get(index);
383     }
384 
385     public void resetOps(){
386     	routeNodeInstanceOps=new ArrayList();
387     	branchOps=new ArrayList();
388     	actionRequestOps = new ArrayList();
389         actionTakenOps = new ArrayList();
390         actionItemOps = new ArrayList();
391     }
392 
393 	public String getActionInvocationActionCode() {
394 		return actionInvocationActionCode;
395 	}
396 
397 	public void setActionInvocationActionCode(String actionInvocationActionCode) {
398 		this.actionInvocationActionCode = actionInvocationActionCode;
399 	}
400 
401 	public String getActionInvocationActionItemId() {
402 		return actionInvocationActionItemId;
403 	}
404 
405 	public void setActionInvocationActionItemId(String actionInvocationActionItemId) {
406 		this.actionInvocationActionItemId = actionInvocationActionItemId;
407 	}
408 
409 	public String getActionInvocationUser() {
410 		return actionInvocationUser;
411 	}
412 
413 	public void setActionInvocationUser(String actionInvocationUser) {
414 		this.actionInvocationUser = actionInvocationUser;
415 	}
416 
417 	public String getBlanketApproveActionTakenId() {
418 		return blanketApproveActionTakenId;
419 	}
420 
421 	public void setBlanketApproveActionTakenId(String blanketApproveActionTakenId) {
422 		this.blanketApproveActionTakenId = blanketApproveActionTakenId;
423 	}
424 
425 	public String getBlanketApproveNodes() {
426 		return blanketApproveNodes;
427 	}
428 
429 	public void setBlanketApproveNodes(String blanketApproveNodes) {
430 		this.blanketApproveNodes = blanketApproveNodes;
431 	}
432 
433 	public String getBlanketApproveUser() {
434 		return blanketApproveUser;
435 	}
436 
437 	public void setBlanketApproveUser(String blanketApproveUser) {
438 		this.blanketApproveUser = blanketApproveUser;
439 	}
440 
441 
442 }