Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2005-2013 The Kuali Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.opensource.org/licenses/ecl2.php Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
  
  package org.kuali.rice.kew.actionrequest;
  
  
  import java.util.Arrays;
  import java.util.List;
Bean mapped to DB. Represents ActionRequest to a workgroup, user or role. Contains references to children/parent if a member of a graph

Author(s):
Kuali Rice Team (rice.collab@kuali.org)
  
  @Table(name="KREW_ACTN_RQST_T")
  //@Sequence(name="KREW_ACTN_RQST_S", property="actionRequestId")
    @NamedQuery(name="ActionRequestValue.FindByDocumentId", query="select arv from ActionRequestValue arv where arv.documentId = :documentId"),
    @NamedQuery(name="ActionRequestValue.GetUserRequestCount", query="select count(arv) from ActionRequestValue arv where arv.documentId = :documentId and arv.recipientTypeCd = :recipientTypeCd and arv.principalId = :principalId and arv.currentIndicator = :currentIndicator"),
    @NamedQuery(name="ActionRequestValue.FindActivatedByGroup", query="select count(arv) from ActionRequestValue arv where arv.groupId = :groupId and arv.currentIndicator = :currentIndicator and arv.status = :status"),
    @NamedQuery(name="ActionRequestValue.FindAllByDocId", query="select arv from ActionRequestValue arv where arv.documentId = :documentId and arv.currentIndicator = :currentIndicator"),
    @NamedQuery(name="ActionRequestValue.FindAllPendingByDocId", query="select arv from ActionRequestValue arv where arv.documentId = :documentId and arv.currentIndicator = :currentIndicator and (arv.status = :actionRequestStatus1 or arv.status = :actionRequestStatus2)"),
    @NamedQuery(name="ActionRequestValue.FindAllRootByDocId", query="select arv from ActionRequestValue arv where arv.documentId = :documentId and arv.currentIndicator = :currentIndicator and arv.parentActionRequest is null"),
    @NamedQuery(name="ActionRequestValue.FindByStatusAndDocId", query="select arv from ActionRequestValue arv where arv.documentId = :documentId and arv.currentIndicator = :currentIndicator and arv.status = :status"),
    @NamedQuery(name="ActionRequestValue.FindPendingByActionRequestedAndDocId", query="select arv from ActionRequestValue arv where arv.documentId = :documentId and arv.currentIndicator = :currentIndicator and arv.actionRequested = :actionRequested and (arv.status = :actionRequestStatus1 or arv.status = :actionRequestStatus2)"),
    @NamedQuery(name="ActionRequestValue.FindPendingByDocIdAtOrBelowRouteLevel", query="select arv from ActionRequestValue arv where arv.documentId = :documentId and arv.currentIndicator = :currentIndicator and arv.status <> :status and arv.routeLevel <= :routeLevel"),
    @NamedQuery(name="ActionRequestValue.FindPendingRootRequestsByDocIdAtOrBelowRouteLevel", query="select arv from ActionRequestValue arv where arv.documentId = :documentId and arv.currentIndicator = :currentIndicator and arv.parentActionRequest is null and arv.status <> :status and routeLevel <= :routeLevel"),
    @NamedQuery(name="ActionRequestValue.FindPendingRootRequestsByDocIdAtRouteLevel", query="select arv from ActionRequestValue arv where arv.documentId = :documentId and arv.currentIndicator = :currentIndicator and arv.parentActionRequest is null and arv.status <> :status and routeLevel = :routeLevel"),
    @NamedQuery(name="ActionRequestValue.FindPendingRootRequestsByDocIdAtRouteNode", query="select arv from ActionRequestValue arv where arv.documentId = :documentId and arv.currentIndicator = :currentIndicator and arv.parentActionRequest is null and arv.nodeInstance.routeNodeInstanceId = :routeNodeInstanceId and (arv.status = :actionRequestStatus1 or arv.status = :actionRequestStatus2)"),
    @NamedQuery(name="ActionRequestValue.FindPendingRootRequestsByDocumentType", query="select arv from ActionRequestValue arv where arv.documentId in (select drhv.documentId from DocumentRouteHeaderValue drhv where drhv.documentTypeId = :documentTypeId) and arv.currentIndicator = :currentIndicator and arv.parentActionRequest is null and (arv.status = :actionRequestStatus1 or arv.status = :actionRequestStatus2)"),
    @NamedQuery(name="ActionRequestValue.FindRootRequestsByDocIdAtRouteNode", query="select arv from ActionRequestValue arv where arv.documentId = :documentId and arv.currentIndicator = :currentIndicator and arv.parentActionRequest is null and arv.nodeInstance.routeNodeInstanceId = :routeNodeInstanceId"),
    @NamedQuery(name="ActionRequestValue.GetRequestGroupIds", query="select arv.groupId from ActionRequestValue arv where arv.documentId = :documentId and arv.currentIndicator = :currentIndicator and arv.recipientTypeCd = :recipientTypeCd"),
    @NamedQuery(name="ActionRequestValue.FindByStatusAndGroupId", query="select arv from ActionRequestValue arv where arv.groupId = :groupId and arv.currentIndicator = :currentIndicator and arv.status = :status")
  })
  public class ActionRequestValue implements Serializable {
 
 	private static final long serialVersionUID = 8781414791855848385L;
 
 	private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ActionRequestValue.class);
 
     private static final String ACTION_CODE_RANK = "FKACB";//B is a hack for allowing blanket approves to count for approve and complete requests in findPreviousAction in ActionTakenService this is a hack and accounts for the -3 on compareActionCode
     private static final String RECIPIENT_TYPE_RANK = "RWU";
     private static final List DELEGATION_TYPE_RANK = Arrays.asList(new Object[]{..null});
 
     @Id
     @GeneratedValue(generator="KREW_ACTN_RQST_S")
 	@GenericGenerator(name="KREW_ACTN_RQST_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={
 			@Parameter(name="sequence_name",value="KREW_ACTN_RQST_S"),
 			@Parameter(name="value_column",value="id")
 	})
 	@Column(name="ACTN_RQST_ID")
     @Column(name="ACTN_RQST_CD")
     @Column(name="DOC_HDR_ID")
 	private String documentId;
     @Column(name="STAT_CD")
 	private String status;
     @Column(name="RSP_ID")
     @Column(name="GRP_ID")
 	private String groupId;
     @Column(name="RECIP_TYP_CD")
     @Column(name="PRIO_NBR")
 	private Integer priority;
     @Column(name="RTE_LVL_NBR")
 	private Integer routeLevel;
     @Column(name="ACTN_TKN_ID", insertable=false, updatable=false)
 	private String actionTakenId;
     @Column(name="DOC_VER_NBR")
     private Integer docVersion = 1;
 	@Column(name="CRTE_DT")
     @Column(name="RSP_DESC_TXT")
     @Column(name="ACTN_RQST_ANNOTN_TXT")
 	private String annotation;
     @Column(name="VER_NBR")
 	private Integer jrfVerNbr;
     @Column(name="PRNCPL_ID")
 	private String principalId;
     @Column(name="FRC_ACTN")
 	private Boolean forceAction;
     @Column(name="PARNT_ID", insertable=false, updatable=false)
     @Column(name="QUAL_ROLE_NM")
     @Column(name="ROLE_NM")
 	private String roleName;
     @Column(name="QUAL_ROLE_NM_LBL_TXT")
     @Transient
     private String displayStatus;
     @Column(name="RULE_ID")
 
     @Column(name="DLGN_TYP")
     private String delegationTypeCode;
     @Column(name="APPR_PLCY")
 	private String approvePolicy;
 
     @ManyToOne(fetch=.)
 	@JoinColumn(name="PARNT_ID")
     @Fetch(value = .)
     @OneToMany(mappedBy="parentActionRequest",cascade={..},fetch=.)
     @ManyToOne(fetch=.)
 	@JoinColumn(name="ACTN_TKN_ID")
     //@OneToMany(fetch=FetchType.LAZY,mappedBy="actionRequestId")
     //private List<ActionItem> actionItems = new ArrayList<ActionItem>();
     @Column(name="CUR_IND")
     private Boolean currentIndicator = true;
     @Transient
     private String createDateString;
 
     /* New Workflow 2.1 Field */
     // The node instance at which this request was generated
     @ManyToOne(fetch=.)
 	@JoinColumn(name="RTE_NODE_INSTN_ID")
 
     @Column(name="RQST_LBL")
     private String requestLabel;
     
     @Transient
     private boolean resolveResponsibility = true;
     @Transient
     @Transient
     
     public ActionRequestValue() {
          = new Timestamp(System.currentTimeMillis());
     }
     
     //@PrePersist
     public void beforeInsert(){
     	OrmUtils.populateAutoIncValue(this, KEWServiceLocator.getEntityManagerFactory().createEntityManager());
     }
    
     public Group getGroup() {
         if (getGroupId() == null) {
             .error("Attempting to get a group with a blank group id");
             return null;
         }
         return KimApiServiceLocator.getGroupService().getGroup(getGroupId());
     }
 
     public String getRouteLevelName() {
         // this is for backward compatibility of requests which have not been converted
         if (CompatUtils.isRouteLevelRequest(this)) {
             int routeLevelInt = getRouteLevel();
             if (routeLevelInt == .) {
                 return "Exception";
             }
 
             List<RouteNoderouteLevelNodes = CompatUtils.getRouteLevelCompatibleNodeList(KEWServiceLocator.getRouteHeaderService().getRouteHeader().getDocumentType());
             if (!(routeLevelInt < routeLevelNodes.size())) {
                 return "Not Found";
             }
             return ((RouteNode)routeLevelNodes.get(routeLevelInt)).getRouteNodeName();
         } else {
             return ( == null ? "Exception" : .getName());
         }
     }
 
     public boolean isUserRequest() {
         return  != null;
     }
 
     public Principal getPrincipal() {
     	if (getPrincipalId() == null) {
     		return null;
     	}
     	return KEWServiceLocator.getIdentityHelperService().getPrincipal(getPrincipalId());
     }
     
     public Person getPerson() {
     	if (getPrincipalId() == null) {
     		return null;
     	}
     	return KimApiServiceLocator.getPersonService().getPerson(getPrincipalId());
     }
 
     public String getDisplayName() {
     	if (isUserRequest()) {
             Person person = getPerson();
             if ( person != null ) {
     	        return person.getName();
             }
     	} else if (isGroupRequest()) {
             Group group = getGroup();
             if ( group != null ) {
     		    return group.getName();
             } else {
                 return getGroupId();
             }
     	} else if (isRoleRequest()) {
     		return getRoleName();
     	}
     	return "";
     }
 
     public Recipient getRecipient() {
         if (getPrincipalId() != null) {
             return new KimPrincipalRecipient(getPrincipal());
         } else if (getGroupId() != null){
             return new KimGroupRecipient(getGroup());
         } else {
         	return new RoleRecipient(this.getRoleName());
         }
     }
 
     public boolean isPending() {
     }
 
     public String getStatusLabel() {
         return CodeTranslator.getActionRequestStatusLabel(getStatus());
     }
 
     public String getActionRequestedLabel() {
     	if (StringUtils.isNotBlank(getRequestLabel())) {
     		return getRequestLabel();
     	}
     	return CodeTranslator.getActionRequestLabel(getActionRequested());
     }

    

Returns:
Returns the actionTaken.
 
     public ActionTakenValue getActionTaken() {
         return ;
     }

    

Parameters:
actionTaken The actionTaken to set.
 
     public void setActionTaken(ActionTakenValue actionTaken) {
         this. = actionTaken;
     }

    

Returns:
Returns the actionRequested.
 
     public String getActionRequested() {
         return ;
     }

    

Parameters:
actionRequested The actionRequested to set.
 
     public void setActionRequested(String actionRequested) {
         this. = actionRequested;
     }

    

Returns:
Returns the actionRequestId.
 
     public String getActionRequestId() {
         return ;
     }

    

Parameters:
actionRequestId The actionRequestId to set.
 
     public void setActionRequestId(String actionRequestId) {
         this. = actionRequestId;
     }

    

Returns:
Returns the actionTakenId.
 
     public String getActionTakenId() {
         return ;
     }

    

Parameters:
actionTakenId The actionTakenId to set.
 
     public void setActionTakenId(String actionTakenId) {
         this. = actionTakenId;
     }

    

Returns:
Returns the annotation.
 
     public String getAnnotation() {
         return ;
     }

    

Parameters:
annotation The annotation to set.
 
     public void setAnnotation(String annotation) {
         this. = annotation;
     }

    

Returns:
Returns the createDate.
 
     public java.sql.Timestamp getCreateDate() {
         return ;
     }

    

Parameters:
createDate The createDate to set.
 
     public void setCreateDate(java.sql.Timestamp createDate) {
         this. = createDate;
     }

    

Returns:
Returns the docVersion.
 
     public Integer getDocVersion() {
         return ;
     }

    

Parameters:
docVersion The docVersion to set.
 
     public void setDocVersion(Integer docVersion) {
         this. = docVersion;
     }
 
     public String getPrincipalId() {
         return ;
     }
 
     public void setPrincipalId(String principalId) {
         this. = principalId;
     }
    
    

Returns:
Returns the forceAction.
 
     public Boolean getForceAction() {
         return ;
     }

    

Parameters:
forceAction The forceAction to set.
 
     public void setForceAction(Boolean forceAction) {
         this. = forceAction;
     }

    

Returns:
Returns the jrfVerNbr.
 
     public Integer getJrfVerNbr() {
         return ;
     }

    

Parameters:
jrfVerNbr The jrfVerNbr to set.
 
     public void setJrfVerNbr(Integer jrfVerNbr) {
         this. = jrfVerNbr;
     }

    

Returns:
Returns the priority.
 
     public Integer getPriority() {
         return ;
     }

    

Parameters:
priority The priority to set.
 
     public void setPriority(Integer priority) {
         this. = priority;
     }

    

Returns:
Returns the recipientTypeCd.
 
     public String getRecipientTypeCd() {
         return ;
     }

    

Parameters:
recipientTypeCd The recipientTypeCd to set.
 
     public void setRecipientTypeCd(String recipientTypeCd) {
         this. = recipientTypeCd;
     }

    

Returns:
Returns the responsibilityDesc.
 
     public String getResponsibilityDesc() {
         return ;
     }

    

Parameters:
responsibilityDesc The responsibilityDesc to set.
 
     public void setResponsibilityDesc(String responsibilityDesc) {
         this. = responsibilityDesc;
     }

    

Returns:
Returns the responsibilityId.
 
     public String getResponsibilityId() {
         return ;
     }

    

Parameters:
responsibilityId The responsibilityId to set.
 
     public void setResponsibilityId(String responsibilityId) {
         this. = responsibilityId;
     }

    

Returns:
Returns the documentId.
 
     public String getDocumentId() {
         return ;
     }
 
     public void setDocumentId(String documentId) {
         this. = documentId;
     }
 
     public Integer getRouteLevel() {
         return ;
     }
 
     public void setRouteLevel(Integer routeLevel) {
         this. = routeLevel;
     }
 
     public String getStatus() {
         return ;
     }
 
     public void setStatus(String status) {
         this. = status;
     }
 
     public String getGroupId() {
         return ;
     }
 
     public void setGroupId(String groupId) {
         this. = groupId;
     }
 
     public boolean isInitialized() {
     }
 
     public boolean isActive() {
         return ..getCode().equals(getStatus());
     }
 
     public boolean isApproveOrCompleteRequest() {
     }
 
     public boolean isDone() {
         return ..getCode().equals(getStatus());
     }
 
     public boolean isReviewerUser() {
     }

    
Determines whether the specified principalId is in the recipient graph of this action request

Parameters:
principalId the principal id to check
Returns:
whether the specified principalId is in the recipient graph of this action request
 
     public boolean isRecipientRoutedRequest(String principalId) {
     	//before altering this method it is used in checkRouteLogAuthentication
     	//don't break that method
     	if (principalId == null || "".equals(principalId)) {
     		return false;
     	}
 
     	boolean isRecipientInGraph = false;
     	if (isReviewerUser()) {
     			isRecipientInGraph = getPrincipalId().equals(principalId);
     	} else if (isGroupRequest()) {
     		Group group = getGroup();
 			if (group == null){
 				.error("Was unable to retrieve workgroup " + getGroupId());
 			}
     		isRecipientInGraph = KimApiServiceLocator.getGroupService().isMemberOfGroup(principalIdgroup.getId());
     	}
 
 
         for (ActionRequestValue childRequest : getChildrenRequests())
         {
             isRecipientInGraph = isRecipientInGraph || childRequest.isRecipientRoutedRequest(principalId);
         }
 
     	return isRecipientInGraph;
     }
 
     public boolean isRecipientRoutedRequest(Recipient recipient) {
     	//before altering this method it is used in checkRouteLogAuthentication
     	//don't break that method
     	if (recipient == null) {
     		return false;
     	}
 
     	boolean isRecipientInGraph = false;
     	if (isReviewerUser()) {
     		if (recipient instanceof KimPrincipalRecipient) {
     			isRecipientInGraph = getPrincipalId().equals(((KimPrincipalRecipientrecipient).getPrincipalId());
     		} else if (recipient instanceof KimGroupRecipient){
     			isRecipientInGraph = KimApiServiceLocator.getGroupService().isMemberOfGroup(getPrincipalId(), ((KimGroupRecipient)recipient).getGroup().getId());
     		}
 
     	} else if (isGroupRequest()) {
     		Group group = getGroup();
 			if (group == null){
 				.error("Was unable to retrieve workgroup " + getGroupId());
 			}
     		if (recipient instanceof KimPrincipalRecipient) {
     			KimPrincipalRecipient principalRecipient = (KimPrincipalRecipient)recipient;
     			isRecipientInGraph = KimApiServiceLocator.getGroupService().isMemberOfGroup(principalRecipient.getPrincipalId(), group.getId());
     		} else if (recipient instanceof KimGroupRecipient) {
     			isRecipientInGraph = ((KimGroupRecipientrecipient).getGroup().getId().equals(group.getId());
     		}
     	}
 
 
         for (ActionRequestValue childRequest : getChildrenRequests())
         {
             isRecipientInGraph = isRecipientInGraph || childRequest.isRecipientRoutedRequest(recipient);
         }
 
     	return isRecipientInGraph;
     }
 
     public boolean isGroupRequest(){
     }
 
     public boolean isRoleRequest() {
         return ..getCode().equals(getRecipientTypeCd());
     }
 
     public boolean isAcknowledgeRequest() {
     }
 
     public boolean isApproveRequest() {
     }
 
     public boolean isCompleteRequst() {
     }
 
     public boolean isFYIRequest() {
     }

    
Allows comparison of action requests to see which is greater responsibility. -1 : indicates code 1 is lesser responsibility than code 2 0 : indicates the same responsibility 1 : indicates code1 is greater responsibility than code 2 The priority of action requests is as follows: fyi < acknowledge < (approve == complete)

Parameters:
code1
code2
completeAndApproveTheSame
Returns:
-1 if less than, 0 if equal, 1 if greater than
 
     public static int compareActionCode(String code1String code2boolean completeAndApproveTheSame) {
     	int cutoff = .;
     	if (completeAndApproveTheSame) {
     		// hacked so that APPROVE and COMPLETE are equal
     		cutoff = .length() - 3;
     	}
         Integer code1Index = Math.min(.indexOf(code1), cutoff);
         Integer code2Index = Math.min(.indexOf(code2), cutoff);
         return code1Index.compareTo(code2Index);
     }

    
Allows comparison of action requests to see which is greater responsibility. -1 : indicates type 1 is lesser responsibility than type 2 0 : indicates the same responsibility 1 : indicates type1 is greater responsibility than type 2

Parameters:
type1
type2
Returns:
-1 if less than, 0 if equal, 1 if greater than
 
     public static int compareRecipientType(String type1String type2) {
         Integer type1Index = .indexOf(type1);
         Integer type2Index = .indexOf(type2);
         return type1Index.compareTo(type2Index);
     }
 
     public static int compareDelegationType(DelegationType type1DelegationType type2) {
     	Integer type1Index = .indexOf(type1);
         Integer type2Index = .indexOf(type2);
         return type1Index.compareTo(type2Index);
     }
 
     public List<ActionItemgetActionItems() {
     	if (this. == null || this..isEmpty()) {
     		return (List<ActionItem>) KEWServiceLocator.getActionListService().findByActionRequestId();
     	} else {
     		return this.;
     	}
     }
 
     public List<ActionItemgetSimulatedActionItems() {
     	if (this. == null) {
     		this. = new ArrayList<ActionItem>();
     	}
 		return this.;
 	}
 
 	public void setSimulatedActionItems(List<ActionItemsimulatedActionItems) {
 		this. = simulatedActionItems;
 	}
 
         return ;
     }
 
     public void setCurrentIndicator(Boolean currentIndicator) {
         this. = currentIndicator;
     }
 
     public String getParentActionRequestId() {
         return ;
     }
 
     public void setParentActionRequestId(String parentActionRequestId) {
         this. = parentActionRequestId;
     }
 
         return ;
     }
 
     public void setParentActionRequest(ActionRequestValue parentActionRequest) {
         this. = parentActionRequest;
     }
 
         return ;
     }
 
     public void setChildrenRequests(List<ActionRequestValuechildrenRequests) {
         this. = childrenRequests;
     }
 
     public String getQualifiedRoleName() {
         return ;
     }
 
     public void setQualifiedRoleName(String roleName) {
         this. = roleName;
     }
 
     public DelegationType getDelegationType() {
         return DelegationType.fromCode();
     }
 
     public void setDelegationType(DelegationType delegationPolicy) {
         this. = delegationPolicy == null ? null : delegationPolicy.getCode();
     }
 
 
     public String getDelegationTypeCode() {
         return ;
     }
 
     public void setDelegationTypeCode(String delegationTypeCode) {
         this. = delegationTypeCode;
     }
 
     public String getRoleName() {
         return ;
     }
 
     public void setRoleName(String roleName) {
         this. = roleName;
     }
 
     public String getApprovePolicy() {
         return ;
     }
 
     public void setApprovePolicy(String requestType) {
         this. = requestType;
     }
 
     public boolean getHasApprovePolicy() {
         return getApprovePolicy() != null;
     }
 
     public boolean isDeactivated() {
         return ..getCode().equals(getStatus());
     }
 
     public boolean hasParent() {
         return getParentActionRequest() != null;
     }
 
     public boolean hasChild(ActionRequestValue actionRequest) {
         if (actionRequest == null)
             return false;
         String actionRequestId = actionRequest.getActionRequestId();
         for (Iterator<ActionRequestValueiter = getChildrenRequests().iterator(); iter.hasNext();) {
             ActionRequestValue childRequest = iter.next();
             if (childRequest.equals(actionRequest) || (actionRequestId != null && actionRequestId.equals(childRequest.getActionRequestId()))) {
                 return true;
             }
         }
         return false;
     }
 
     public String getDisplayStatus() {
         return ;
     }
 
     public void setDisplayStatus(String displayStatus) {
         this. = displayStatus;
     }
 
     public String getQualifiedRoleNameLabel() {
         return ;
     }
 
     public void setQualifiedRoleNameLabel(String qualifiedRoleNameLabel) {
         this. = qualifiedRoleNameLabel;
     }
 
     public String getCreateDateString() {
         if ( == null || .trim().equals("")) {
             return RiceConstants.getDefaultDateFormat().format(getCreateDate());
         } else {
             return ;
         }
     }
 
     public void setCreateDateString(String createDateString) {
         this. = createDateString;
     }
 
     public RouteNodeInstance getNodeInstance() {
 		return ;
 	}
 
     public String getPotentialNodeName() {
         return (getNodeInstance() == null ? "" : getNodeInstance().getName());
     }
 
 	public void setNodeInstance(RouteNodeInstance nodeInstance) {
 		this. = nodeInstance;
 	}
 
 		return RecipientType.fromCode(getRecipientTypeCd()).getLabel();
     }
 
     public RuleBaseValues getRuleBaseValues(){
         if( != null){
             return getRuleService().findRuleBaseValuesById();
         }
         return null;
     }
     public String getRuleBaseValuesId() {
         return ;
     }
 
     public void setRuleBaseValuesId(String ruleBaseValuesId) {
         this. = ruleBaseValuesId;
     }
     
         return (RuleServiceInternal) KEWServiceLocator.getService(.);
     }
 
     public boolean isPrimaryDelegator() {
         boolean primaryDelegator = false;
         for (Iterator<ActionRequestValueiter = .iterator(); iter.hasNext();) {
             ActionRequestValue childRequest = iter.next();
             primaryDelegator = ..equals(childRequest.getDelegationType()) || primaryDelegator;
         }
         return primaryDelegator;
     }

    
Used to get primary delegate names on route log in the 'Requested Of' section so primary delegate requests list the delegate and not the delegator as having the request 'IN ACTION LIST'. This method doesn't recurse and therefore assume an AR structure.

Returns:
primary delgate requests
 
         List<ActionRequestValueprimaryDelegateRequests = new ArrayList<ActionRequestValue>();
         for (ActionRequestValue childRequest : )
         {
             if (..equals(childRequest.getDelegationType()))
             {
                 if (childRequest.isRoleRequest())
                 {
                     for (ActionRequestValue actionRequestValue : childRequest.getChildrenRequests())
                     {
                         primaryDelegateRequests.add(actionRequestValue);
                     }
                 } else
                 {
                 	primaryDelegateRequests.add(childRequest);
                 }
             }
         }
         return primaryDelegateRequests;
     }
 
     public boolean isAdHocRequest() {                                          
     }
 
     public boolean isGeneratedRequest() {
     }
 
     public boolean isExceptionRequest() {
     }
 
     public boolean isRouteModuleRequest() {
     	// FIXME: KULRICE-5201 switched rsp_id to a varchar, so the comparison below is no longer valid
 //    	return getResponsibilityId() > 0;
     	// TODO: KULRICE-5329 Verify that this code below makes sense 
     }
 
     public String toString() {
         return new ToStringBuilder(this.)
             .append("actionRequestId")
             .append("actionRequested")
             .append("documentId")
             .append("status")
             .append("responsibilityId")
             .append("groupId")
             .append("recipientTypeCd")
             .append("priority")
             .append("routeLevel")
             .append("actionTakenId")
             .append("docVersion")
             .append("createDate")
             .append("responsibilityDesc")
             .append("annotation")
             .append("jrfVerNbr")
             .append("principalId")
             .append("forceAction")
             .append("parentActionRequestId")
             .append("qualifiedRoleName")
             .append("roleName")
             .append("qualifiedRoleNameLabel")
             .append("displayStatus")
             .append("ruleBaseValuesId")
             .append("delegationType")
             .append("approvePolicy")
             .append("actionTaken")
             .append("currentIndicator")
             .append("createDateString")
             .append("nodeInstance").toString();
     }
 
 	public String getRequestLabel() {
 		return this.;
 	}
 
 	public void setRequestLabel(String requestLabel) {
 		this. = requestLabel;
 	}
 
     public String getGroupName() {
         return KimApiServiceLocator.getGroupService().getGroup(this.).getName();
     }

Returns:
the resolveResponsibility
 
 	public boolean getResolveResponsibility() {
 		return this.;
 	}

Parameters:
resolveResponsibility the resolveResponsibility to set
 
 	public void setResolveResponsibility(boolean resolveResponsibility) {
 		this. = resolveResponsibility;
 	}
 
 		if (this. == null && this. != null) {
 			this. = KEWServiceLocator.getRouteHeaderService().getRouteHeader(this.);
 		}
 		return this.;
 	}
 
 	public void setRouteHeader(DocumentRouteHeaderValue routeHeader) {
 		this. = routeHeader;
 	}
 	
 	public static ActionRequest to(ActionRequestValue actionRequestBo) {
 		if (actionRequestBo == null) {
 			return null;
 		}
 		return createActionRequestBuilder(actionRequestBo).build();
 	}
 	
 	private static ActionRequest.Builder createActionRequestBuilder(ActionRequestValue actionRequestBo) {
 		ActionRequest.Builder builder = ActionRequest.Builder.create(actionRequestBo.getActionRequestId(),
 				ActionRequestType.fromCode(actionRequestBo.getActionRequested()),
				ActionRequestStatus.fromCode(actionRequestBo.getStatus()),
				actionRequestBo.getResponsibilityId(),
				actionRequestBo.getDocumentId(),
				RecipientType.fromCode(actionRequestBo.getRecipientTypeCd()));
		if (actionRequestBo.getActionTaken() != null) {
			builder.setActionTaken(ActionTaken.Builder.create(ActionTakenValue.to(actionRequestBo.getActionTaken())));
		builder.setAnnotation(actionRequestBo.getAnnotation());
		builder.setCurrent(actionRequestBo.getCurrentIndicator().booleanValue());
		builder.setDateCreated(new DateTime(actionRequestBo.getCreateDate().getTime()));
		if (actionRequestBo.getDelegationType() != null) {
			builder.setDelegationType(actionRequestBo.getDelegationType());
		builder.setForceAction(actionRequestBo.getForceAction().booleanValue());
		builder.setGroupId(actionRequestBo.getGroupId());
		builder.setNodeName(actionRequestBo.getPotentialNodeName());
		if (actionRequestBo.getParentActionRequestId() != null) {
		builder.setPrincipalId(actionRequestBo.getPrincipalId());
		if (actionRequestBo.getPriority() == null) {
else {
            builder.setPriority(actionRequestBo.getPriority().intValue());
        }
        if (actionRequestBo.getRouteLevel() == null ) {
            builder.setRouteLevel(0);
        } else {
            builder.setRouteLevel(actionRequestBo.getRouteLevel().intValue());
        }
		builder.setQualifiedRoleName(actionRequestBo.getQualifiedRoleName());
		builder.setRequestLabel(actionRequestBo.getRequestLabel());
		if (!StringUtils.isBlank(actionRequestBo.getApprovePolicy())) {
			builder.setRequestPolicy(ActionRequestPolicy.fromCode(actionRequestBo.getApprovePolicy()));
		builder.setRoleName(actionRequestBo.getRoleName());
		if (actionRequestBo.getNodeInstance() != null) {
		if (actionRequestBo.getChildrenRequests() != null) {
			for (ActionRequestValue childActionRequestBo : actionRequestBo.getChildrenRequests()) {
				childRequests.add(createActionRequestBuilder(childActionRequestBo));
		builder.setChildRequests(childRequests);
		return builder;
	}

    
TODO - this javadoc copied from DTOConverter, needs to be updated! Converts an ActionRequestVO to an ActionRequest. The ActionRequestDTO passed in must be the root action request in the graph, otherwise an IllegalArgumentException is thrown. This is to avoid potentially sticky issues with circular references in the conversion. NOTE: This method's primary purpose is to convert ActionRequestVOs returned from a RouteModule. Incidentally, the DTO's returned from the route module will be lacking some information (like the node instance) so no attempts are made to convert this data since further initialization is handled by a higher level component (namely ActionRequestService.initializeActionRequestGraph).
    public static ActionRequestValue from(ActionRequest actionRequest) {
        return ActionRequestValue.from(actionRequestnull);
    }
    
    
Converts an ActionRequestVO to an ActionRequest. The ActionRequestDTO passed in must be the root action request in the graph, otherwise an IllegalArgumentException is thrown. This is to avoid potentially sticky issues with circular references in the conversion.

Parameters:
routeNodeInstanceLoader a service that will provide routeNodeInstanceS based on their IDs.
    public static ActionRequestValue from(ActionRequest actionRequest
            RouteNodeInstanceLoader routeNodeInstanceLoader) {
        return convertActionRequest(actionRequestnullrouteNodeInstanceLoader);
    }
    private static ActionRequestValue convertActionRequest(ActionRequest actionRequestActionRequestValue parentActionRequestBo,
            RouteNodeInstanceLoader routeNodeInstanceLoader) {
        if (actionRequest == null) {
            return null;
        }
        ActionRequestValue actionRequestBo = new ActionRequestFactory().createBlankActionRequest();
        populateActionRequest(actionRequestBoactionRequestrouteNodeInstanceLoader);
        if (parentActionRequestBo != null) {
            actionRequestBo.setParentActionRequest(parentActionRequestBo);
            actionRequestBo.setParentActionRequestId(parentActionRequestBo.getActionRequestId());
        }
        if (actionRequest.getChildRequests() != null) {
            for (ActionRequest childRequest : actionRequest.getChildRequests()) {
                actionRequestBo.getChildrenRequests().add(ActionRequestValue.convertActionRequest(childRequestactionRequestBorouteNodeInstanceLoader));
            }
        }
        return actionRequestBo;
    }

    
This method converts everything except for the parent and child requests
    private static void populateActionRequest(ActionRequestValue actionRequestBoActionRequest actionRequest
            RouteNodeInstanceLoader routeNodeInstanceLoader) {
        actionRequestBo.setActionRequested(actionRequest.getActionRequested().getCode());
        if (!StringUtils.isBlank(actionRequest.getId())) {
            actionRequestBo.setActionRequestId(actionRequest.getId());
        }
        
        if (actionRequest.getActionTaken() != null) {
            // actionRequestBo.setActionTaken(ActionTakenValue.from(actionRequest.getActionTaken()));
            if (!StringUtils.isBlank(actionRequest.getActionTaken().getId())) {
                actionRequestBo.setActionTakenId(actionRequest.getActionTaken().getId());
            }
        }
        actionRequestBo.setAnnotation(actionRequest.getAnnotation());
        if (actionRequest.getRequestPolicy() != null) {
            actionRequestBo.setApprovePolicy(actionRequest.getRequestPolicy().getCode());
        }
        actionRequestBo.setCreateDate(new Timestamp(actionRequest.getDateCreated().getMillis()));
        actionRequestBo.setCurrentIndicator(actionRequest.isCurrent());
        if (actionRequest.getDelegationType() != null) {
            actionRequestBo.setDelegationType(actionRequest.getDelegationType());
        }
        //actionRequestBo.setDocVersion(actionRequest.?);
        actionRequestBo.setForceAction(actionRequest.isForceAction());
        actionRequestBo.setPriority(actionRequest.getPriority());
        actionRequestBo.setRouteLevel(actionRequest.getRouteLevel());
        actionRequestBo.setQualifiedRoleName(actionRequest.getQualifiedRoleName());
        actionRequestBo.setQualifiedRoleNameLabel(actionRequest.getQualifiedRoleNameLabel());
        actionRequestBo.setRecipientTypeCd(actionRequest.getRecipientType().getCode());
        actionRequestBo.setResponsibilityDesc(actionRequest.getResponsibilityDescription());
        if (!StringUtils.isBlank(actionRequest.getResponsibilityId())) {
            actionRequestBo.setResponsibilityId(actionRequest.getResponsibilityId());
        }
        actionRequestBo.setRoleName(actionRequest.getRoleName());
        String documentId = actionRequest.getDocumentId();
        if (documentId != null) {
            actionRequestBo.setDocumentId(documentId);
            actionRequestBo.setRouteHeader(KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId));
        }
        actionRequestBo.setStatus(actionRequest.getStatus().getCode());
        actionRequestBo.setPrincipalId(actionRequest.getPrincipalId());
        actionRequestBo.setGroupId(actionRequest.getGroupId());
        
        if (routeNodeInstanceLoader != null && !StringUtils.isBlank(actionRequest.getRouteNodeInstanceId())) {
            actionRequestBo.setNodeInstance(routeNodeInstanceLoader.load(actionRequest.getRouteNodeInstanceId()));
        }
    }