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