View Javadoc

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