Coverage Report - org.kuali.rice.kew.dto.ActionRequestDTO
 
Classes in this File Line Coverage Branch Coverage Complexity
ActionRequestDTO
0%
0/113
0%
0/18
1.065
 
 1  
 /*
 2  
  * Copyright 2005-2008 The Kuali Foundation
 3  
  *
 4  
  *
 5  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 6  
  * you may not use this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  *
 9  
  * http://www.opensource.org/licenses/ecl2.php
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.kuali.rice.kew.dto;
 18  
 
 19  
 import java.io.Serializable;
 20  
 import java.util.Calendar;
 21  
 
 22  
 import org.apache.commons.lang.StringUtils;
 23  
 import org.kuali.rice.kew.api.action.ActionRequestStatus;
 24  
 import org.kuali.rice.kew.api.action.RecipientType;
 25  
 import org.kuali.rice.kew.util.KEWConstants;
 26  
 
 27  
 
 28  
 /**
 29  
  * A transport object representing an ActionRequestValue.
 30  
  *
 31  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 32  
  */
 33  
 public class ActionRequestDTO implements Serializable {
 34  
 
 35  
     private final static String ACKNOWLEDGE_REQ = "K";
 36  
     private final static String FYI_REQ = "F";
 37  
     private final static String APPROVE_REQ = "A";
 38  
     private final static String COMPLETE_REQ = "C";
 39  
 
 40  
     static final long serialVersionUID = 1074824814950100121L;
 41  
     private String actionRequestId;
 42  
     private String actionRequested;
 43  
     private String status;
 44  0
     private Boolean currentIndicator = Boolean.TRUE;
 45  
     private Calendar dateCreated;
 46  
     private String responsibilityId;
 47  
     private String documentId;
 48  
     private String routeMethodName;
 49  
     private Integer priority;
 50  
     private String annotation;
 51  
     private String actionTakenId;
 52  
     private String groupId;    
 53  
     private String recipientTypeCd;
 54  
     private String approvePolicy;
 55  
     private String responsibilityDesc;
 56  
     private Integer routeLevel;
 57  
     private Integer docVersion;
 58  
     private String roleName;
 59  
     private Boolean forceAction;
 60  
     private String principalId;
 61  
     private String delegationType;
 62  
     private String parentActionRequestId;
 63  
     private String qualifiedRoleName;
 64  
     private String qualifiedRoleNameLabel;
 65  
     private ActionRequestDTO[] childrenRequests;
 66  
     private ActionTakenDTO actionTaken;
 67  
     private String nodeName;
 68  
     private String nodeInstanceId;
 69  
     private String requestLabel;
 70  
 
 71  0
     public ActionRequestDTO() {}
 72  
 
 73  
     public String getRoleName() {
 74  0
         return roleName;
 75  
     }
 76  
 
 77  
     public void setRoleName(String roleName) {
 78  0
         this.roleName = roleName;
 79  0
     }
 80  
 
 81  
     public String getActionRequested() {
 82  0
         return actionRequested;
 83  
     }
 84  
 
 85  
     public String getActionRequestId() {
 86  0
         return actionRequestId;
 87  
     }
 88  
 
 89  
     public String getActionTakenId() {
 90  0
         return actionTakenId;
 91  
     }
 92  
 
 93  
     public String getAnnotation() {
 94  0
         return annotation;
 95  
     }
 96  
 
 97  
     public Calendar getDateCreated() {
 98  0
         return dateCreated;
 99  
     }
 100  
 
 101  
     public Integer getDocVersion() {
 102  0
         return docVersion;
 103  
     }
 104  
 
 105  
     public Integer getPriority() {
 106  0
         return priority;
 107  
     }
 108  
 
 109  
     public String getResponsibilityDesc() {
 110  0
         return responsibilityDesc;
 111  
     }
 112  
 
 113  
     public String getResponsibilityId() {
 114  0
         return responsibilityId;
 115  
     }
 116  
 
 117  
     public String getDocumentId() {
 118  0
         return documentId;
 119  
     }
 120  
 
 121  
     public Integer getRouteLevel() {
 122  0
         return routeLevel;
 123  
     }
 124  
 
 125  
     public String getRouteMethodName() {
 126  0
         return routeMethodName;
 127  
     }
 128  
 
 129  
     public String getStatus() {
 130  0
         return status;
 131  
     }
 132  
  
 133  
     public void setStatus(String status) {
 134  0
         this.status = status;
 135  0
     }
 136  
 
 137  
     public void setRouteMethodName(String routeMethodName) {
 138  0
         this.routeMethodName = routeMethodName;
 139  0
     }
 140  
 
 141  
     public void setRouteLevel(Integer routeLevel) {
 142  0
         this.routeLevel = routeLevel;
 143  0
     }
 144  
 
 145  
     public void setDocumentId(String documentId) {
 146  0
         this.documentId = documentId;
 147  0
     }
 148  
 
 149  
     public void setResponsibilityId(String responsibilityId) {
 150  0
         this.responsibilityId = responsibilityId;
 151  0
     }
 152  
 
 153  
     public void setResponsibilityDesc(String responsibilityDesc) {
 154  0
         this.responsibilityDesc = responsibilityDesc;
 155  0
     }
 156  
 
 157  
     public void setPriority(Integer priority) {
 158  0
         this.priority = priority;
 159  0
     }
 160  
 
 161  
     public void setDocVersion(Integer docVersion) {
 162  0
         this.docVersion = docVersion;
 163  0
     }
 164  
 
 165  
     public void setDateCreated(Calendar dateCreated) {
 166  0
         this.dateCreated = dateCreated;
 167  0
     }
 168  
 
 169  
     public void setAnnotation(String annotation) {
 170  0
         this.annotation = annotation;
 171  0
     }
 172  
 
 173  
     public void setActionTakenId(String actionTakenId) {
 174  0
         this.actionTakenId = actionTakenId;
 175  0
     }
 176  
 
 177  
     public void setActionRequestId(String actionRequestId) {
 178  0
         this.actionRequestId = actionRequestId;
 179  0
     }
 180  
 
 181  
     public void setActionRequested(String actionRequested) {
 182  0
         this.actionRequested = actionRequested;
 183  0
     }
 184  
 
 185  
     public String getRecipientTypeCd() {
 186  0
         return recipientTypeCd;
 187  
     }
 188  
 
 189  
     public void setRecipientTypeCd(String recipientTypeCd) {
 190  0
         this.recipientTypeCd = recipientTypeCd;
 191  0
     }
 192  
 
 193  
     public String getApprovePolicy() {
 194  0
         return approvePolicy;
 195  
     }
 196  
 
 197  
     public void setApprovePolicy(String approvePolicy) {
 198  0
         this.approvePolicy = approvePolicy;
 199  0
     }
 200  
 
 201  
     public Boolean getForceAction() {
 202  0
         return forceAction;
 203  
     }
 204  
 
 205  
     public boolean isNotificationRequest() {
 206  0
         return isAcknowledgeRequest() || isFyiRequest();
 207  
     }
 208  
 
 209  
     public boolean isApprovalRequest() {
 210  0
         return APPROVE_REQ.equals(actionRequested) || COMPLETE_REQ.equals(actionRequested);
 211  
     }
 212  
 
 213  
     public Boolean isForceAction() {
 214  0
         return forceAction;
 215  
     }
 216  
 
 217  
     public void setForceAction(Boolean forceAction) {
 218  0
         this.forceAction = forceAction;
 219  0
     }
 220  
 
 221  
     public boolean isAcknowledgeRequest() {
 222  0
         return ACKNOWLEDGE_REQ.equals(actionRequested);
 223  
     }
 224  
 
 225  
     public boolean isFyiRequest() {
 226  0
         return FYI_REQ.equals(actionRequested);
 227  
     }
 228  
 
 229  
     public boolean isPending() {
 230  0
         return isInitialized() || isActivated();
 231  
     }
 232  
 
 233  
     public boolean isCompleteRequest() {
 234  0
         return KEWConstants.ACTION_REQUEST_COMPLETE_REQ.equals(actionRequested);
 235  
     }
 236  
 
 237  
     public boolean isInitialized() {
 238  0
         return ActionRequestStatus.INITIALIZED.getCode().equals(status);
 239  
     }
 240  
 
 241  
     public boolean isActivated() {
 242  0
         return ActionRequestStatus.ACTIVATED.getCode().equals(status);
 243  
     }
 244  
 
 245  
     public boolean isDone() {
 246  0
         return ActionRequestStatus.DONE.getCode().equals(status);
 247  
     }
 248  
 
 249  
     public boolean isUserRequest() {
 250  0
         return RecipientType.PRINCIPAL.getCode().equals(getRecipientTypeCd());
 251  
     }
 252  
 
 253  
     public boolean isGroupRequest() {
 254  0
         return RecipientType.GROUP.getCode().equals(getRecipientTypeCd());
 255  
     }
 256  
 
 257  
     public boolean isRoleRequest() {
 258  0
         return RecipientType.ROLE.getCode().equals(getRecipientTypeCd());
 259  
     }
 260  
 
 261  
     public String getPrincipalId() {
 262  0
                 return this.principalId;
 263  
         }
 264  
 
 265  
         public void setPrincipalId(String principalId) {
 266  0
                 this.principalId = principalId;
 267  0
         }
 268  
 
 269  
         public Boolean getCurrentIndicator() {
 270  0
         return currentIndicator;
 271  
     }
 272  
 
 273  
     public void setCurrentIndicator(Boolean currentIndicator) {
 274  0
         this.currentIndicator = currentIndicator;
 275  0
     }
 276  
 
 277  
     public String getDelegationType() {
 278  0
         return delegationType;
 279  
     }
 280  
     public void setDelegationType(String delegationType) {
 281  0
         this.delegationType = delegationType;
 282  0
     }
 283  
 
 284  
     public String getParentActionRequestId() {
 285  0
         return parentActionRequestId;
 286  
     }
 287  
     public void setParentActionRequestId(String parentActionRequestId) {
 288  0
         this.parentActionRequestId = parentActionRequestId;
 289  0
     }
 290  
 
 291  
     public String getQualifiedRoleName() {
 292  0
         return qualifiedRoleName;
 293  
     }
 294  
     public void setQualifiedRoleName(String qualifiedRoleName) {
 295  0
         this.qualifiedRoleName = qualifiedRoleName;
 296  0
     }
 297  
     public String getQualifiedRoleNameLabel() {
 298  0
         return qualifiedRoleNameLabel;
 299  
     }
 300  
     public void setQualifiedRoleNameLabel(String qualifiedRoleNameLabel) {
 301  0
         this.qualifiedRoleNameLabel = qualifiedRoleNameLabel;
 302  0
     }
 303  
 
 304  
         public ActionTakenDTO getActionTaken() {
 305  0
                 return actionTaken;
 306  
         }
 307  
 
 308  
         public void setActionTaken(ActionTakenDTO actionTaken) {
 309  0
                 this.actionTaken = actionTaken;
 310  0
         }
 311  
 
 312  
     public ActionRequestDTO[] getChildrenRequests() {
 313  0
         return childrenRequests;
 314  
     }
 315  
     public void setChildrenRequests(ActionRequestDTO[] childrenRequests) {
 316  0
         this.childrenRequests = childrenRequests;
 317  0
     }
 318  
 
 319  
     public void addChildRequest(ActionRequestDTO childRequest) {
 320  0
             if (getChildrenRequests() == null) {
 321  0
                     setChildrenRequests(new ActionRequestDTO[0]);
 322  
             }
 323  0
             ActionRequestDTO[] newChildrenRequests = new ActionRequestDTO[getChildrenRequests().length+1];
 324  0
             System.arraycopy(getChildrenRequests(), 0, newChildrenRequests, 0, getChildrenRequests().length);
 325  0
             newChildrenRequests[getChildrenRequests().length] = childRequest;
 326  0
             setChildrenRequests(newChildrenRequests);
 327  0
     }
 328  
 
 329  
     public String getNodeName() {
 330  0
         return nodeName;
 331  
     }
 332  
 
 333  
     public void setNodeName(String nodeName) {
 334  0
         this.nodeName = nodeName;
 335  0
     }
 336  
 
 337  
     public String getNodeInstanceId() {
 338  0
         return nodeInstanceId;
 339  
     }
 340  
 
 341  
     public void setNodeInstanceId(String nodeInstanceId) {
 342  0
         this.nodeInstanceId = nodeInstanceId;
 343  0
     }
 344  
     
 345  
     public String getGroupId() {
 346  0
                 return this.groupId;
 347  
         }
 348  
 
 349  
         public void setGroupId(String groupId) {
 350  0
                 this.groupId = groupId;
 351  0
         }
 352  
 
 353  
     public boolean isAdHocRequest() {
 354  0
             return KEWConstants.ADHOC_REQUEST_RESPONSIBILITY_ID.equals(getResponsibilityId());
 355  
     }
 356  
 
 357  
     public boolean isGeneratedRequest() {
 358  0
             return KEWConstants.MACHINE_GENERATED_RESPONSIBILITY_ID.equals(getResponsibilityId());
 359  
     }
 360  
 
 361  
     public boolean isExceptionRequest() {
 362  0
             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  0
             return !StringUtils.equals(getResponsibilityId(), "0") && !getResponsibilityId().startsWith("-");
 368  
 //            return getResponsibilityId().longValue() > 0;
 369  
     }
 370  
 
 371  
         public String getRequestLabel() {
 372  0
                 return this.requestLabel;
 373  
         }
 374  
 
 375  
         public void setRequestLabel(String requestLabel) {
 376  0
                 this.requestLabel = requestLabel;
 377  0
         }
 378  
 
 379  
 }