001 /* 002 * Copyright 2005-2008 The Kuali Foundation 003 * 004 * 005 * Licensed under the Educational Community License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.opensource.org/licenses/ecl2.php 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.kuali.rice.kew.dto; 018 019 import java.io.Serializable; 020 import java.util.Calendar; 021 022 import org.apache.commons.lang.StringUtils; 023 import org.kuali.rice.kew.api.action.ActionRequestStatus; 024 import org.kuali.rice.kew.api.action.RecipientType; 025 import org.kuali.rice.kew.util.KEWConstants; 026 027 028 /** 029 * A transport object representing an ActionRequestValue. 030 * 031 * @author Kuali Rice Team (rice.collab@kuali.org) 032 */ 033 public class ActionRequestDTO implements Serializable { 034 035 private final static String ACKNOWLEDGE_REQ = "K"; 036 private final static String FYI_REQ = "F"; 037 private final static String APPROVE_REQ = "A"; 038 private final static String COMPLETE_REQ = "C"; 039 040 static final long serialVersionUID = 1074824814950100121L; 041 private String actionRequestId; 042 private String actionRequested; 043 private String status; 044 private Boolean currentIndicator = Boolean.TRUE; 045 private Calendar dateCreated; 046 private String responsibilityId; 047 private String documentId; 048 private String routeMethodName; 049 private Integer priority; 050 private String annotation; 051 private String actionTakenId; 052 private String groupId; 053 private String recipientTypeCd; 054 private String approvePolicy; 055 private String responsibilityDesc; 056 private Integer routeLevel; 057 private Integer docVersion; 058 private String roleName; 059 private Boolean forceAction; 060 private String principalId; 061 private String delegationType; 062 private String parentActionRequestId; 063 private String qualifiedRoleName; 064 private String qualifiedRoleNameLabel; 065 private ActionRequestDTO[] childrenRequests; 066 private ActionTakenDTO actionTaken; 067 private String nodeName; 068 private String nodeInstanceId; 069 private String requestLabel; 070 071 public ActionRequestDTO() {} 072 073 public String getRoleName() { 074 return roleName; 075 } 076 077 public void setRoleName(String roleName) { 078 this.roleName = roleName; 079 } 080 081 public String getActionRequested() { 082 return actionRequested; 083 } 084 085 public String getActionRequestId() { 086 return actionRequestId; 087 } 088 089 public String getActionTakenId() { 090 return actionTakenId; 091 } 092 093 public String getAnnotation() { 094 return annotation; 095 } 096 097 public Calendar getDateCreated() { 098 return dateCreated; 099 } 100 101 public Integer getDocVersion() { 102 return docVersion; 103 } 104 105 public Integer getPriority() { 106 return priority; 107 } 108 109 public String getResponsibilityDesc() { 110 return responsibilityDesc; 111 } 112 113 public String getResponsibilityId() { 114 return responsibilityId; 115 } 116 117 public String getDocumentId() { 118 return documentId; 119 } 120 121 public Integer getRouteLevel() { 122 return routeLevel; 123 } 124 125 public String getRouteMethodName() { 126 return routeMethodName; 127 } 128 129 public String getStatus() { 130 return status; 131 } 132 133 public void setStatus(String status) { 134 this.status = status; 135 } 136 137 public void setRouteMethodName(String routeMethodName) { 138 this.routeMethodName = routeMethodName; 139 } 140 141 public void setRouteLevel(Integer routeLevel) { 142 this.routeLevel = routeLevel; 143 } 144 145 public void setDocumentId(String documentId) { 146 this.documentId = documentId; 147 } 148 149 public void setResponsibilityId(String responsibilityId) { 150 this.responsibilityId = responsibilityId; 151 } 152 153 public void setResponsibilityDesc(String responsibilityDesc) { 154 this.responsibilityDesc = responsibilityDesc; 155 } 156 157 public void setPriority(Integer priority) { 158 this.priority = priority; 159 } 160 161 public void setDocVersion(Integer docVersion) { 162 this.docVersion = docVersion; 163 } 164 165 public void setDateCreated(Calendar dateCreated) { 166 this.dateCreated = dateCreated; 167 } 168 169 public void setAnnotation(String annotation) { 170 this.annotation = annotation; 171 } 172 173 public void setActionTakenId(String actionTakenId) { 174 this.actionTakenId = actionTakenId; 175 } 176 177 public void setActionRequestId(String actionRequestId) { 178 this.actionRequestId = actionRequestId; 179 } 180 181 public void setActionRequested(String actionRequested) { 182 this.actionRequested = actionRequested; 183 } 184 185 public String getRecipientTypeCd() { 186 return recipientTypeCd; 187 } 188 189 public void setRecipientTypeCd(String recipientTypeCd) { 190 this.recipientTypeCd = recipientTypeCd; 191 } 192 193 public String getApprovePolicy() { 194 return approvePolicy; 195 } 196 197 public void setApprovePolicy(String approvePolicy) { 198 this.approvePolicy = approvePolicy; 199 } 200 201 public Boolean getForceAction() { 202 return forceAction; 203 } 204 205 public boolean isNotificationRequest() { 206 return isAcknowledgeRequest() || isFyiRequest(); 207 } 208 209 public boolean isApprovalRequest() { 210 return APPROVE_REQ.equals(actionRequested) || COMPLETE_REQ.equals(actionRequested); 211 } 212 213 public Boolean isForceAction() { 214 return forceAction; 215 } 216 217 public void setForceAction(Boolean forceAction) { 218 this.forceAction = forceAction; 219 } 220 221 public boolean isAcknowledgeRequest() { 222 return ACKNOWLEDGE_REQ.equals(actionRequested); 223 } 224 225 public boolean isFyiRequest() { 226 return FYI_REQ.equals(actionRequested); 227 } 228 229 public boolean isPending() { 230 return isInitialized() || isActivated(); 231 } 232 233 public boolean isCompleteRequest() { 234 return KEWConstants.ACTION_REQUEST_COMPLETE_REQ.equals(actionRequested); 235 } 236 237 public boolean isInitialized() { 238 return ActionRequestStatus.INITIALIZED.getCode().equals(status); 239 } 240 241 public boolean isActivated() { 242 return ActionRequestStatus.ACTIVATED.getCode().equals(status); 243 } 244 245 public boolean isDone() { 246 return ActionRequestStatus.DONE.getCode().equals(status); 247 } 248 249 public boolean isUserRequest() { 250 return RecipientType.PRINCIPAL.getCode().equals(getRecipientTypeCd()); 251 } 252 253 public boolean isGroupRequest() { 254 return RecipientType.GROUP.getCode().equals(getRecipientTypeCd()); 255 } 256 257 public boolean isRoleRequest() { 258 return RecipientType.ROLE.getCode().equals(getRecipientTypeCd()); 259 } 260 261 public String getPrincipalId() { 262 return this.principalId; 263 } 264 265 public void setPrincipalId(String principalId) { 266 this.principalId = principalId; 267 } 268 269 public Boolean getCurrentIndicator() { 270 return currentIndicator; 271 } 272 273 public void setCurrentIndicator(Boolean currentIndicator) { 274 this.currentIndicator = currentIndicator; 275 } 276 277 public String getDelegationType() { 278 return delegationType; 279 } 280 public void setDelegationType(String delegationType) { 281 this.delegationType = delegationType; 282 } 283 284 public String getParentActionRequestId() { 285 return parentActionRequestId; 286 } 287 public void setParentActionRequestId(String parentActionRequestId) { 288 this.parentActionRequestId = parentActionRequestId; 289 } 290 291 public String getQualifiedRoleName() { 292 return qualifiedRoleName; 293 } 294 public void setQualifiedRoleName(String qualifiedRoleName) { 295 this.qualifiedRoleName = qualifiedRoleName; 296 } 297 public String getQualifiedRoleNameLabel() { 298 return qualifiedRoleNameLabel; 299 } 300 public void setQualifiedRoleNameLabel(String qualifiedRoleNameLabel) { 301 this.qualifiedRoleNameLabel = qualifiedRoleNameLabel; 302 } 303 304 public ActionTakenDTO getActionTaken() { 305 return actionTaken; 306 } 307 308 public void setActionTaken(ActionTakenDTO actionTaken) { 309 this.actionTaken = actionTaken; 310 } 311 312 public ActionRequestDTO[] getChildrenRequests() { 313 return childrenRequests; 314 } 315 public void setChildrenRequests(ActionRequestDTO[] childrenRequests) { 316 this.childrenRequests = childrenRequests; 317 } 318 319 public void addChildRequest(ActionRequestDTO childRequest) { 320 if (getChildrenRequests() == null) { 321 setChildrenRequests(new ActionRequestDTO[0]); 322 } 323 ActionRequestDTO[] newChildrenRequests = new ActionRequestDTO[getChildrenRequests().length+1]; 324 System.arraycopy(getChildrenRequests(), 0, newChildrenRequests, 0, getChildrenRequests().length); 325 newChildrenRequests[getChildrenRequests().length] = childRequest; 326 setChildrenRequests(newChildrenRequests); 327 } 328 329 public String getNodeName() { 330 return nodeName; 331 } 332 333 public void setNodeName(String nodeName) { 334 this.nodeName = nodeName; 335 } 336 337 public String getNodeInstanceId() { 338 return nodeInstanceId; 339 } 340 341 public void setNodeInstanceId(String nodeInstanceId) { 342 this.nodeInstanceId = nodeInstanceId; 343 } 344 345 public String getGroupId() { 346 return this.groupId; 347 } 348 349 public void setGroupId(String groupId) { 350 this.groupId = groupId; 351 } 352 353 public boolean isAdHocRequest() { 354 return KEWConstants.ADHOC_REQUEST_RESPONSIBILITY_ID.equals(getResponsibilityId()); 355 } 356 357 public boolean isGeneratedRequest() { 358 return KEWConstants.MACHINE_GENERATED_RESPONSIBILITY_ID.equals(getResponsibilityId()); 359 } 360 361 public boolean isExceptionRequest() { 362 return KEWConstants.EXCEPTION_REQUEST_RESPONSIBILITY_ID.equals(getResponsibilityId()); 363 } 364 365 public boolean isRouteModuleRequest() { 366 // FIXME: KULRICE-5329 : this is probably not the best way to replace the logic below (commented out) 367 return !StringUtils.equals(getResponsibilityId(), "0") && !getResponsibilityId().startsWith("-"); 368 // return getResponsibilityId().longValue() > 0; 369 } 370 371 public String getRequestLabel() { 372 return this.requestLabel; 373 } 374 375 public void setRequestLabel(String requestLabel) { 376 this.requestLabel = requestLabel; 377 } 378 379 }