001 /** 002 * Copyright 2005-2012 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.rice.kew.documentoperation.web; 017 018 import java.util.ArrayList; 019 import java.util.HashMap; 020 import java.util.List; 021 import java.util.Map; 022 023 import org.apache.commons.collections.Factory; 024 import org.apache.commons.collections.ListUtils; 025 import org.kuali.rice.kew.api.action.ActionRequestStatus; 026 import org.kuali.rice.kew.api.action.RecipientType; 027 import org.kuali.rice.kew.engine.node.Branch; 028 import org.kuali.rice.kew.engine.node.RouteNodeInstance; 029 import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue; 030 import org.kuali.rice.kew.api.KewApiConstants; 031 import org.kuali.rice.kns.web.struts.form.KualiForm; 032 033 /** 034 * struts form bean for {@link DocumentOperationAction}. 035 * 036 * @author Kuali Rice Team (rice.collab@kuali.org) 037 */ 038 public class DocumentOperationForm extends KualiForm { 039 040 private static final long serialVersionUID = 2994179393392218743L; 041 private DocumentRouteHeaderValue routeHeader; 042 private String documentId; 043 044 private List actionRequestOps = new ArrayList(); 045 private List actionTakenOps = new ArrayList(); 046 private List actionItemOps = new ArrayList(); 047 048 049 private String routeHeaderOp; 050 051 private String dateModified; 052 private String createDate; 053 private String approvedDate; 054 private String finalizedDate; 055 private String routeStatusDate; 056 private String lookupableImplServiceName; 057 private String lookupType; 058 private Map docStatuses = KewApiConstants.DOCUMENT_STATUSES; 059 private Map actionRequestCds = KewApiConstants.ACTION_REQUEST_CD; 060 private Map actionTakenCds = KewApiConstants.ACTION_TAKEN_CD; 061 private List routeModules; 062 private String routeModuleName; 063 064 private String lookupInvocationModule; 065 private String lookupInvocationField; 066 private String lookupInvocationIndex; 067 068 //variabes for RouteNodeInstances and branches 069 private List routeNodeInstances=ListUtils.lazyList(new ArrayList(), 070 new Factory() { 071 public Object create() { 072 return new RouteNodeInstance(); 073 } 074 }); 075 076 private List routeNodeInstanceOps=new ArrayList(); 077 private List branches=ListUtils.lazyList(new ArrayList(), 078 new Factory() { 079 public Object create() { 080 return new Branch(); 081 } 082 }); 083 private List branchOps=new ArrayList(); 084 private List nodeStateDeleteOps=new ArrayList(); 085 private String nodeStatesDelete; 086 private String branchStatesDelete; 087 private String initialNodeInstances; 088 089 private String annotation; 090 091 private String blanketApproveUser; 092 private String blanketApproveActionTakenId; 093 private String blanketApproveNodes; 094 private String actionInvocationUser; 095 private String actionInvocationActionItemId; 096 private String actionInvocationActionCode; 097 098 public String getAnnotation() { 099 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 }