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