View Javadoc

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