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.actiontaken;
 
 
Model object mapped to ojb for representing actions taken on documents by users.

Author(s):
Kuali Rice Team (rice.collab@kuali.org)
 
 //@Sequence(name="KREW_ACTN_TKN_S", property="actionTakenId")
 @Table(name="KREW_ACTN_TKN_T")
 public class ActionTakenValue implements Serializable {

    
 
 	private static final long serialVersionUID = -81505450567067594L;
 	@Id
 	@GeneratedValue(generator="KREW_ACTN_TKN_S")
 	@GenericGenerator(name="KREW_ACTN_TKN_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={
 			@Parameter(name="sequence_name",value="KREW_ACTN_TKN_S"),
 			@Parameter(name="value_column",value="id")
 	})
 	@Column(name="ACTN_TKN_ID")
     private String actionTakenId;
     @Column(name="DOC_HDR_ID")//,insertable=false, updatable=false)
 	private String documentId;
     @Column(name="ACTN_CD")
 	private String actionTaken;
 	@Column(name="ACTN_DT")
 	private Timestamp actionDate;
     @Column(name="ANNOTN")
     private String annotation = "";
     @Column(name="DOC_VER_NBR")
 	private Integer docVersion;
     @Version
 	@Column(name="VER_NBR")
 	private Integer lockVerNbr;
     @Column(name="PRNCPL_ID")
 	private String principalId;
     @Column(name="DLGTR_PRNCPL_ID")
     @Column(name="DLGTR_GRP_ID")
     //@ManyToOne(fetch=FetchType.EAGER, cascade={CascadeType.PERSIST})
     //@JoinColumn(name="DOC_HDR_ID")
    //private DocumentRouteHeaderValue routeHeader;
    @OneToMany(fetch=., mappedBy="actionTaken")
    @Fetch(value = .)
    @Column(name="CUR_IND")
    private Boolean currentIndicator = .;
    @Transient
    private String actionDateString;
    public Principal getPrincipal() {
    	return getPrincipalForId );
    }
    
	//@PrePersist
	public void beforeInsert(){
		OrmUtils.populateAutoIncValue(this, KEWServiceLocator.getEntityManagerFactory().createEntityManager());		
	}
    public String getPrincipalDisplayName() {
    	// TODO this stinks to have to have a dependency on UserSession here
    	return KEWServiceLocator.getIdentityHelperService().getPerson(getPrincipalId()).getName();
    }
    public Principal getDelegatorPrincipal() {
    }
    public Group getDelegatorGroup()
    {
	    return KimApiServiceLocator.getGroupService()
	            .getGroup(String.valueOf());
    }
    public void setDelegator(Recipient recipient) {
        if (recipient instanceof KimPrincipalRecipient) {
            setDelegatorPrincipalId(((KimPrincipalRecipient)recipient).getPrincipalId());
        } else if (recipient instanceof KimGroupRecipient) {
            setDelegatorGroupId(((KimGroupRecipient)recipient).getGroup().getId());
        } else {
            setDelegatorPrincipalId(null);
            setDelegatorGroupId(null);
        }
    }
    public boolean isForDelegator() {
        return getDelegatorPrincipalId() != null || getDelegatorGroupId() != null || getDelegatorRoleId() != null;
    }
    public String getDelegatorDisplayName() {
        if (getDelegatorPrincipalId() != null) {
        	// TODO this stinks to have to have a dependency on UserSession here
        	return KEWServiceLocator.getIdentityHelperService().getPerson(this.getDelegatorPrincipalId()).getName();
        } else if (getDelegatorGroupId() != null) {
            return getDelegatorGroup().getName();
        } else {
            String delegatorRoleId = getDelegatorRoleId();
            if (delegatorRoleId != null) {
                Role role = KimApiServiceLocator.getRoleService().getRole(delegatorRoleId);
                if(role != null) {
                    return role.getName();
                } else {
                    return "";
                }
            } else {
                return "";
            }
        }
    }
    private Principal getPrincipalForId(String principalId) {
    	Principal principal = null;
    	
    	if (!StringUtils.isBlank(principalId)) {
    		principal = KEWServiceLocator.getIdentityHelperService().getPrincipal(principalId);
    	}
    	
    	return principal;
    }
    public String getActionTakenLabel() {
        return CodeTranslator.getActionTakenLabel();
    }
        if ( == null) {
            setActionRequests(new ArrayList<ActionRequestValue>());
        }
        return ;
    }
    public void setActionRequests(Collection<ActionRequestValueactionRequests) {
        this. = actionRequests;
    }
    //public DocumentRouteHeaderValue getRouteHeader() {
    //    return routeHeader;
    //}
    //public void setRouteHeader(DocumentRouteHeaderValue routeHeader) {
    //    this.routeHeader = routeHeader;
    //}
    public Timestamp getActionDate() {
        return ;
    }
    public void setActionDate(Timestamp actionDate) {
        this. = actionDate;
    }
    public String getActionTaken() {
        return ;
    }
    public void setActionTaken(String actionTaken) {
        this. = actionTaken;
    }
    public String getActionTakenId() {
        return ;
    }
    public void setActionTakenId(String actionTakenId) {
        this. = actionTakenId;
    }
    public String getAnnotation() {
        return ;
    }
    public void setAnnotation(String annotation) {
        this. = annotation;
    }
    public String getDelegatorPrincipalId() {
        return ;
    }
    public void setDelegatorPrincipalId(String delegatorPrincipalId) {
        this. = delegatorPrincipalId;
    }
    public String getDelegatorGroupId() {
        return ;
    }
    public void setDelegatorGroupId(String delegatorGroupId) {
        this. = delegatorGroupId;
    }
    public String getDelegatorRoleId() {
        ActionRequestValue actionRequest = KEWServiceLocator.getActionRequestService().getActionRequestForRole();
        if (actionRequest != null) {
            return actionRequest.getRoleName();
        } else {
            return null;
        }
    }
    public Integer getDocVersion() {
        return ;
    }
    public void setDocVersion(Integer docVersion) {
        this. = docVersion;
    }
    public Integer getLockVerNbr() {
        return ;
    }
    public void setLockVerNbr(Integer lockVerNbr) {
        this. = lockVerNbr;
    }
    public String getDocumentId() {
    	return ;
    }
    public void setDocumentId(String documentId) {
        this. = documentId;
    }
    public String getPrincipalId() {
    	return ;
    }
    
    public void setPrincipalId(String principalId) {
    	this. = principalId;
    }
    public Boolean getCurrentIndicator() {
        return ;
    }
    public void setCurrentIndicator(Boolean currentIndicator) {
        this. = currentIndicator;
    }
    public Collection getRootActionRequests() {
    }
        return (ActionRequestService) KEWServiceLocator.getService(.);
    }
    public String getActionDateString() {
        if( == null || .trim().equals("")){
            return RiceConstants.getDefaultDateFormat().format(getActionDate());
        } else {
            return ;
        }
    }
    public void setActionDateString(String actionDateString) {
        this. = actionDateString;
    }
    public boolean isApproval() {
    }
    public boolean isCompletion() {
    }
    
    public static ActionTaken to(ActionTakenValue actionTakenBo) {
    	if (actionTakenBo == null) {
    		return null;
    	}
    	ActionTaken.Builder builder = ActionTaken.Builder.create(actionTakenBo.getActionTakenId(),
    			actionTakenBo.getDocumentId(),
    			actionTakenBo.getPrincipalId(),
    			ActionType.fromCode(actionTakenBo.getActionTaken()));
        if (actionTakenBo.getActionDate() != null) {
    	    builder.setActionDate(new DateTime(actionTakenBo.getActionDate().getTime()));
        }
    	builder.setAnnotation(actionTakenBo.getAnnotation());
    	builder.setCurrent(actionTakenBo.getCurrentIndicator().booleanValue());
    	builder.setDelegatorGroupId(actionTakenBo.getDelegatorGroupId());
    	builder.setDelegatorPrincipalId(actionTakenBo.getDelegatorPrincipalId());
    	return builder.build();
    }
    public boolean isSuperUserAction() {
                ) {
            return true;
        } else {
            return false;
        }
    }
New to GrepCode? Check out our FAQ X