org.kuali.rice.kew.routeheader
Class DocumentRouteHeaderValue

java.lang.Object
  extended by org.kuali.rice.krad.bo.BusinessObjectBase
      extended by org.kuali.rice.krad.bo.PersistableBusinessObjectBase
          extended by org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue
All Implemented Interfaces:
Serializable, org.apache.ojb.broker.PersistenceBrokerAware, GloballyUnique, Versioned, ModelObjectBasic, DocumentContract, DocumentSearchCriteriaEbo, BusinessObject, ExternalizableBusinessObject, PersistableBusinessObject
Direct Known Subclasses:
DocumentRouteHeaderValueActionListExtension

@Entity
public class DocumentRouteHeaderValue
extends PersistableBusinessObjectBase
implements DocumentContract, DocumentSearchCriteriaEbo

A document within KEW. A document effectively represents a process that moves through the workflow engine. It is created from a particular DocumentType and follows the route path defined by that DocumentType.

During a document's lifecycle it progresses through a series of statuses, starting with INITIATED and moving to one of the terminal states (such as FINAL, CANCELED, etc). The list of status on a document are defined in the KewApiConstants class and include the constants starting with "ROUTE_HEADER_" and ending with "_CD".

Associated with the document is the document content. The document content is XML which represents the content of that document. This XML content is typically used to make routing decisions for the document.

A document has associated with it a set of ActionRequestValue object and ActionTakenValue objects. Action Requests represent requests for user action (such as Approve, Acknowledge, etc). Action Takens represent action that users have performed on the document, such as approvals or cancelling of the document.

The instantiated route path of a document is defined by it's graph of RouteNodeInstance objects. The path starts at the initial node of the document and progresses from there following the next nodes of each node instance. The current active nodes on the document are defined by the "active" flag on the node instance where are not marked as "complete".

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
DocumentType, ActionRequestValue, ActionItem, ActionTakenValue, RouteNodeInstance, KewApiConstants, Serialized Form

Field Summary
static String CURRENT_ROUTE_NODE_NAME_DELIMITER
           
protected static HashMap<String,String> legalActions
           
protected static HashMap<String,String> stateTransitionMap
           
 
Fields inherited from class org.kuali.rice.krad.bo.PersistableBusinessObjectBase
extension, versionNumber
 
Constructor Summary
DocumentRouteHeaderValue()
           
 
Method Summary
 void applyDocumentUpdate(DocumentUpdate documentUpdate)
           
 Object copy(boolean preserveKeys)
           
static DocumentRouteHeaderValue from(Document document)
           
 List<ActionItem> getActionItems()
           
 List<ActionRequestValue> getActionRequests()
           
 List<ActionTakenValue> getActionsTaken()
           
 String getAppDocId()
           
 String getAppDocStatus()
          This method returns the Application Document Status.
 Timestamp getAppDocStatusDate()
           
 List<DocumentStatusTransition> getAppDocStatusHistory()
           
 String getApplicationDocumentId()
          Retrieve the application document id.
 String getApplicationDocumentStatus()
          Retrieve the application document status.
 org.joda.time.DateTime getApplicationDocumentStatusDate()
          Retrieve the last application document status transition date.
 Timestamp getApprovedDate()
           
 String getCombinedStatus()
          This method returns a combination of the route status label and the app doc status.
 Timestamp getCreateDate()
           
 List<String> getCurrentNodeNames()
           
 String getCurrentRouteLevelName()
           
 CustomActionListAttribute getCustomActionListAttribute()
           
 CustomEmailAttribute getCustomEmailAttribute()
           
 CustomNoteAttribute getCustomNoteAttribute()
           
 org.joda.time.DateTime getDateApproved()
          Retrieve the document approval date
 org.joda.time.DateTime getDateCreated()
          Retrieve the document creation date
 org.joda.time.DateTime getDateFinalized()
          Retrieve the document finalization date
 org.joda.time.DateTime getDateLastModified()
          Retrieve the document last-modified date
 Timestamp getDateModified()
           
 ActionItem getDocActionItem(int index)
           
 ActionRequestValue getDocActionRequest(int index)
           
 ActionTakenValue getDocActionTaken(int index)
           
 String getDocContent()
           
 Integer getDocRouteLevel()
           
 String getDocRouteStatus()
           
 String getDocRouteStatusLabel()
           
 String getDocStatusPolicy()
          This method returns the Document Status Policy for the document type associated with this Route Header.
 String getDocTitle()
           
 DocumentRouteHeaderValueContent getDocumentContent()
           
 String getDocumentHandlerUrl()
          Retrieve the document handler url
 String getDocumentId()
          Retrieve the document id
 DocumentType getDocumentType()
           
 String getDocumentTypeId()
          Retrieve the id of the type of this document
 String getDocumentTypeName()
          Retrieve the name of the type of this document
 Integer getDocVersion()
           
 Timestamp getFinalizedDate()
           
 List<RouteNodeInstance> getInitialRouteNodeInstances()
           
 String getInitiatorDisplayName()
           
 Principal getInitiatorPrincipal()
           
 String getInitiatorPrincipalId()
          Retrieve the initiator principal id
 String getInitiatorWorkflowId()
           
 List<Note> getNotes()
           
 Collection getQueueItems()
           
 Branch getRootBranch()
          Convenience method that returns the branch of the first (and presumably only?) initial node
 List<BranchState> getRootBranchState()
           
 String getRoutedByDisplayName()
           
 Principal getRoutedByPrincipal()
           
 String getRoutedByPrincipalId()
          Retrieve the router principal id
 String getRoutedByUserWorkflowId()
           
 Timestamp getRouteStatusDate()
           
 String getRouteStatusLabel()
           
 List<ActionRequestValue> getSimulatedActionRequests()
           
 DocumentStatus getStatus()
          Retrieve the document status
 String getTitle()
          Retrieve the document title
 String getVariable(String name)
          Gets a variable
 Map<String,String> getVariables()
          Retrieve the currently defined internal workflow engine variables for the document NOTE: use of workflow engine variables is an advanced technique requiring specific crafting of the workflow document routing; these variables will not be useful for the majority of workflow use cases
 boolean isCanceled()
           
 boolean isDisaproved()
           
 boolean isEnroute()
           
 boolean isFinal()
           
 boolean isInException()
           
 boolean isProcessed()
           
 boolean isRoutable()
           
 boolean isRouted()
           
 boolean isRoutingReport()
           
 boolean isStateInitiated()
           
 boolean isStateSaved()
           
 boolean isValidActionToTake(String actionCd)
          Return true if the given action code is valid for this document's current state.
 boolean isValidStatusChange(String newStatus)
           
 void markDocumentCanceled()
          Mark document cancled.
 void markDocumentDisapproved()
          Mark document disapproved
 void markDocumentEnroute()
          Mark the document as being actively routed.
 void markDocumentFinalized()
          Mark document finalized.
 void markDocumentInException()
          Mark the document as being in the exception state.
 void markDocumentProcessed()
          Mark the document as being processed.
 void markDocumentRecalled()
          Mark document recalled.
 void markDocumentSaved()
          Mark document saved
 void removeVariableThatContains(String name)
           
 void setAppDocId(String appDocId)
           
 void setAppDocStatus(String appDocStatus)
           
 void setAppDocStatusDate(Timestamp appDocStatusDate)
           
 void setAppDocStatusHistory(List<DocumentStatusTransition> appDocStatusHistory)
           
 void setApprovedDate(Timestamp approvedDate)
           
 void setCreateDate(Timestamp createDate)
           
 void setDateModified(Timestamp dateModified)
           
 void setDocContent(String docContent)
           
 void setDocRouteLevel(Integer docRouteLevel)
           
 void setDocRouteStatus(String docRouteStatus)
           
 void setDocTitle(String docTitle)
           
 void setDocumentContent(DocumentRouteHeaderValueContent documentContent)
           
 void setDocumentId(String documentId)
           
 void setDocumentTypeId(String documentTypeId)
           
 void setDocVersion(Integer docVersion)
           
 void setFinalizedDate(Timestamp finalizedDate)
           
 void setInitialRouteNodeInstances(List<RouteNodeInstance> initialRouteNodeInstances)
           
 void setInitiatorWorkflowId(String initiatorWorkflowId)
           
 void setNotes(List<Note> notes)
           
 void setQueueItems(Collection queueItems)
           
 void setRoutedByUserWorkflowId(String routedByUserWorkflowId)
           
 void setRouteHeaderData(Document routeHeaderVO)
          This method takes data from a VO and sets it on this route header
 void setRouteStatus(String newStatus, boolean finalState)
           
 void setRouteStatusDate(Timestamp routeStatusDate)
           
 void setRoutingReport(boolean routingReport)
           
 void setSimulatedActionRequests(List<ActionRequestValue> simulatedActionRequests)
           
 void setVariable(String name, String value)
          Sets a variable
static Document to(DocumentRouteHeaderValue documentBo)
           
 void updateAppDocStatus(String appDocStatus)
          This method sets the appDocStatus.
 
Methods inherited from class org.kuali.rice.krad.bo.PersistableBusinessObjectBase
afterDelete, afterInsert, afterLookup, afterUpdate, beforeDelete, beforeInsert, beforeUpdate, buildListOfDeletionAwareLists, getExtension, getObjectId, getPersistenceService, getPersistenceStructureService, getVersionNumber, isNewCollectionRecord, linkEditableUserFields, postLoad, postPersist, postRemove, postUpdate, prePersist, preRemove, preUpdate, refresh, refreshNonUpdateableReferences, refreshReferenceObject, setExtension, setNewCollectionRecord, setObjectId, setVersionNumber
 
Methods inherited from class org.kuali.rice.krad.bo.BusinessObjectBase
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.kuali.rice.krad.bo.BusinessObject
refresh
 
Methods inherited from interface org.kuali.rice.core.api.mo.ModelObjectBasic
toString
 

Field Detail

CURRENT_ROUTE_NODE_NAME_DELIMITER

public static final String CURRENT_ROUTE_NODE_NAME_DELIMITER
See Also:
Constant Field Values

legalActions

protected static final HashMap<String,String> legalActions

stateTransitionMap

protected static final HashMap<String,String> stateTransitionMap
Constructor Detail

DocumentRouteHeaderValue

public DocumentRouteHeaderValue()
Method Detail

getInitiatorPrincipal

public Principal getInitiatorPrincipal()

getRoutedByPrincipal

public Principal getRoutedByPrincipal()

getInitiatorDisplayName

public String getInitiatorDisplayName()

getRoutedByDisplayName

public String getRoutedByDisplayName()

getCurrentRouteLevelName

public String getCurrentRouteLevelName()

getCurrentNodeNames

public List<String> getCurrentNodeNames()

getRouteStatusLabel

public String getRouteStatusLabel()

getDocRouteStatusLabel

public String getDocRouteStatusLabel()

getDocStatusPolicy

public String getDocStatusPolicy()
This method returns the Document Status Policy for the document type associated with this Route Header. The Document Status Policy denotes whether the KEW Route Status, or the Application Document Status, or both are to be displayed.

Returns:

getQueueItems

public Collection getQueueItems()

setQueueItems

public void setQueueItems(Collection queueItems)

getActionItems

public List<ActionItem> getActionItems()

getActionsTaken

public List<ActionTakenValue> getActionsTaken()

getActionRequests

public List<ActionRequestValue> getActionRequests()

getSimulatedActionRequests

public List<ActionRequestValue> getSimulatedActionRequests()

setSimulatedActionRequests

public void setSimulatedActionRequests(List<ActionRequestValue> simulatedActionRequests)

getDocumentType

public DocumentType getDocumentType()

getAppDocId

public String getAppDocId()

setAppDocId

public void setAppDocId(String appDocId)

getApprovedDate

public Timestamp getApprovedDate()

setApprovedDate

public void setApprovedDate(Timestamp approvedDate)

getCreateDate

public Timestamp getCreateDate()

setCreateDate

public void setCreateDate(Timestamp createDate)

getDocContent

public String getDocContent()

setDocContent

public void setDocContent(String docContent)

getDocRouteLevel

public Integer getDocRouteLevel()

setDocRouteLevel

public void setDocRouteLevel(Integer docRouteLevel)

getDocRouteStatus

public String getDocRouteStatus()

setDocRouteStatus

public void setDocRouteStatus(String docRouteStatus)

getDocTitle

public String getDocTitle()

setDocTitle

public void setDocTitle(String docTitle)

getDocumentTypeId

public String getDocumentTypeId()
Description copied from interface: DocumentContract
Retrieve the id of the type of this document

Specified by:
getDocumentTypeId in interface DocumentContract
Returns:
the id of the type of this document

setDocumentTypeId

public void setDocumentTypeId(String documentTypeId)

getDocVersion

public Integer getDocVersion()

setDocVersion

public void setDocVersion(Integer docVersion)

getFinalizedDate

public Timestamp getFinalizedDate()

setFinalizedDate

public void setFinalizedDate(Timestamp finalizedDate)

getInitiatorWorkflowId

public String getInitiatorWorkflowId()

setInitiatorWorkflowId

public void setInitiatorWorkflowId(String initiatorWorkflowId)

getRoutedByUserWorkflowId

public String getRoutedByUserWorkflowId()

setRoutedByUserWorkflowId

public void setRoutedByUserWorkflowId(String routedByUserWorkflowId)

getDocumentId

public String getDocumentId()
Description copied from interface: DocumentContract
Retrieve the document id

Specified by:
getDocumentId in interface DocumentContract
Specified by:
getDocumentId in interface DocumentSearchCriteriaEbo
Returns:
the document id

setDocumentId

public void setDocumentId(String documentId)

getRouteStatusDate

public Timestamp getRouteStatusDate()

setRouteStatusDate

public void setRouteStatusDate(Timestamp routeStatusDate)

getDateModified

public Timestamp getDateModified()

setDateModified

public void setDateModified(Timestamp dateModified)

getAppDocStatus

public String getAppDocStatus()
This method returns the Application Document Status. This status is an alternative to the Route Status that may be used for a document. It is configurable per document type.

Returns:
See Also:
ApplicationDocumentStatus, DocumentTypePolicy

setAppDocStatus

public void setAppDocStatus(String appDocStatus)

getCombinedStatus

public String getCombinedStatus()
This method returns a combination of the route status label and the app doc status.

Returns:

updateAppDocStatus

public void updateAppDocStatus(String appDocStatus)
                        throws WorkflowRuntimeException
This method sets the appDocStatus. It firsts validates the new value against the defined acceptable values, if defined. It also updates the AppDocStatus date, and saves the status transition information

Parameters:
appDocStatus -
Throws:
WorkflowRuntimeException

getAppDocStatusDate

public Timestamp getAppDocStatusDate()

setAppDocStatusDate

public void setAppDocStatusDate(Timestamp appDocStatusDate)

copy

public Object copy(boolean preserveKeys)

isStateInitiated

public boolean isStateInitiated()
Returns:
True if the document is in the state of Initiated

isStateSaved

public boolean isStateSaved()
Returns:
True if the document is in the state of Saved

isRouted

public boolean isRouted()
Returns:
true if the document has ever been inte enroute state

isInException

public boolean isInException()

isDisaproved

public boolean isDisaproved()

isCanceled

public boolean isCanceled()

isFinal

public boolean isFinal()

isEnroute

public boolean isEnroute()

isProcessed

public boolean isProcessed()
Returns:
true if the document is in the processed state

isRoutable

public boolean isRoutable()

isValidActionToTake

public boolean isValidActionToTake(String actionCd)
Return true if the given action code is valid for this document's current state. This method only verifies statically defined action/state transitions, it does not perform full action validation logic.

Parameters:
actionCd - The action code to be tested.
Returns:
True if the action code is valid for the document's status.
See Also:
ActionRegistry.getValidActions(org.kuali.rice.kim.api.identity.principal.PrincipalContract, DocumentRouteHeaderValue)

isValidStatusChange

public boolean isValidStatusChange(String newStatus)

setRouteStatus

public void setRouteStatus(String newStatus,
                           boolean finalState)
                    throws InvalidActionTakenException
Throws:
InvalidActionTakenException

markDocumentProcessed

public void markDocumentProcessed()
                           throws InvalidActionTakenException
Mark the document as being processed.

Throws:
ResourceUnavailableException
InvalidActionTakenException

markDocumentCanceled

public void markDocumentCanceled()
                          throws InvalidActionTakenException
Mark document cancled.

Throws:
ResourceUnavailableException
InvalidActionTakenException

markDocumentRecalled

public void markDocumentRecalled()
                          throws InvalidActionTakenException
Mark document recalled.

Throws:
ResourceUnavailableException
InvalidActionTakenException

markDocumentDisapproved

public void markDocumentDisapproved()
                             throws InvalidActionTakenException
Mark document disapproved

Throws:
ResourceUnavailableException
InvalidActionTakenException

markDocumentSaved

public void markDocumentSaved()
                       throws InvalidActionTakenException
Mark document saved

Throws:
ResourceUnavailableException
InvalidActionTakenException

markDocumentInException

public void markDocumentInException()
                             throws InvalidActionTakenException
Mark the document as being in the exception state.

Throws:
ResourceUnavailableException
InvalidActionTakenException

markDocumentEnroute

public void markDocumentEnroute()
                         throws InvalidActionTakenException
Mark the document as being actively routed.

Throws:
ResourceUnavailableException
InvalidActionTakenException

markDocumentFinalized

public void markDocumentFinalized()
                           throws InvalidActionTakenException
Mark document finalized.

Throws:
ResourceUnavailableException
InvalidActionTakenException

setRouteHeaderData

public void setRouteHeaderData(Document routeHeaderVO)
                        throws WorkflowException
This method takes data from a VO and sets it on this route header

Parameters:
routeHeaderVO -
Throws:
WorkflowException

applyDocumentUpdate

public void applyDocumentUpdate(DocumentUpdate documentUpdate)

getRootBranch

public Branch getRootBranch()
Convenience method that returns the branch of the first (and presumably only?) initial node

Returns:
the branch of the first (and presumably only?) initial node

getVariable

public String getVariable(String name)
Gets a variable

Parameters:
name - variable name
Returns:
variable value, or null if variable is not defined

removeVariableThatContains

public void removeVariableThatContains(String name)

setVariable

public void setVariable(String name,
                        String value)
Sets a variable

Parameters:
name - variable name
value - variable value, or null if variable should be removed

getRootBranchState

public List<BranchState> getRootBranchState()

getCustomActionListAttribute

public CustomActionListAttribute getCustomActionListAttribute()
                                                       throws WorkflowException
Throws:
WorkflowException

getCustomEmailAttribute

public CustomEmailAttribute getCustomEmailAttribute()
                                             throws WorkflowException
Throws:
WorkflowException

getCustomNoteAttribute

public CustomNoteAttribute getCustomNoteAttribute()
                                           throws WorkflowException
Throws:
WorkflowException

getDocActionRequest

public ActionRequestValue getDocActionRequest(int index)

getDocActionTaken

public ActionTakenValue getDocActionTaken(int index)

getDocActionItem

public ActionItem getDocActionItem(int index)

isRoutingReport

public boolean isRoutingReport()

setRoutingReport

public void setRoutingReport(boolean routingReport)

getInitialRouteNodeInstances

public List<RouteNodeInstance> getInitialRouteNodeInstances()

setInitialRouteNodeInstances

public void setInitialRouteNodeInstances(List<RouteNodeInstance> initialRouteNodeInstances)

getNotes

public List<Note> getNotes()

setNotes

public void setNotes(List<Note> notes)

getDocumentContent

public DocumentRouteHeaderValueContent getDocumentContent()

setDocumentContent

public void setDocumentContent(DocumentRouteHeaderValueContent documentContent)

getAppDocStatusHistory

public List<DocumentStatusTransition> getAppDocStatusHistory()

setAppDocStatusHistory

public void setAppDocStatusHistory(List<DocumentStatusTransition> appDocStatusHistory)

getStatus

public DocumentStatus getStatus()
Description copied from interface: DocumentContract
Retrieve the document status

Specified by:
getStatus in interface DocumentContract
Specified by:
getStatus in interface DocumentSearchCriteriaEbo
Returns:
the document status

getDateCreated

public org.joda.time.DateTime getDateCreated()
Description copied from interface: DocumentContract
Retrieve the document creation date

Specified by:
getDateCreated in interface DocumentContract
Specified by:
getDateCreated in interface DocumentSearchCriteriaEbo
Returns:
the document creation date or null

getDateLastModified

public org.joda.time.DateTime getDateLastModified()
Description copied from interface: DocumentContract
Retrieve the document last-modified date

Specified by:
getDateLastModified in interface DocumentContract
Returns:
the document last-modified date or null

getDateApproved

public org.joda.time.DateTime getDateApproved()
Description copied from interface: DocumentContract
Retrieve the document approval date

Specified by:
getDateApproved in interface DocumentContract
Returns:
the document approval date or null

getDateFinalized

public org.joda.time.DateTime getDateFinalized()
Description copied from interface: DocumentContract
Retrieve the document finalization date

Specified by:
getDateFinalized in interface DocumentContract
Returns:
the document finalization date or null

getTitle

public String getTitle()
Description copied from interface: DocumentContract
Retrieve the document title

Specified by:
getTitle in interface DocumentContract
Specified by:
getTitle in interface DocumentSearchCriteriaEbo
Returns:
the document title

getApplicationDocumentId

public String getApplicationDocumentId()
Description copied from interface: DocumentContract
Retrieve the application document id. The Application Document Id is used to record an application-relevant id for the workflow document.

Specified by:
getApplicationDocumentId in interface DocumentContract
Specified by:
getApplicationDocumentId in interface DocumentSearchCriteriaEbo
Returns:
the application document id

getInitiatorPrincipalId

public String getInitiatorPrincipalId()
Description copied from interface: DocumentContract
Retrieve the initiator principal id

Specified by:
getInitiatorPrincipalId in interface DocumentContract
Specified by:
getInitiatorPrincipalId in interface DocumentSearchCriteriaEbo
Returns:
the initiator principal id

getRoutedByPrincipalId

public String getRoutedByPrincipalId()
Description copied from interface: DocumentContract
Retrieve the router principal id

Specified by:
getRoutedByPrincipalId in interface DocumentContract
Returns:
the router principal id

getDocumentTypeName

public String getDocumentTypeName()
Description copied from interface: DocumentContract
Retrieve the name of the type of this document

Specified by:
getDocumentTypeName in interface DocumentContract
Specified by:
getDocumentTypeName in interface DocumentSearchCriteriaEbo
Returns:
the name of the type of this document

getDocumentHandlerUrl

public String getDocumentHandlerUrl()
Description copied from interface: DocumentContract
Retrieve the document handler url

Specified by:
getDocumentHandlerUrl in interface DocumentContract
Returns:
the document handler url

getApplicationDocumentStatus

public String getApplicationDocumentStatus()
Description copied from interface: DocumentContract
Retrieve the application document status. The Application Document Status is used to track document/applicaiton specific statuses

Specified by:
getApplicationDocumentStatus in interface DocumentContract
Specified by:
getApplicationDocumentStatus in interface DocumentSearchCriteriaEbo
Returns:
the application document status

getApplicationDocumentStatusDate

public org.joda.time.DateTime getApplicationDocumentStatusDate()
Description copied from interface: DocumentContract
Retrieve the last application document status transition date. The Application Document Status date is the date the application document status last transitioned.

Specified by:
getApplicationDocumentStatusDate in interface DocumentContract
Returns:
the application document status date

getVariables

public Map<String,String> getVariables()
Description copied from interface: DocumentContract
Retrieve the currently defined internal workflow engine variables for the document NOTE: use of workflow engine variables is an advanced technique requiring specific crafting of the workflow document routing; these variables will not be useful for the majority of workflow use cases

Specified by:
getVariables in interface DocumentContract
Returns:
the currently defined workflow engine variables for the document

to

public static Document to(DocumentRouteHeaderValue documentBo)

from

public static DocumentRouteHeaderValue from(Document document)


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.