com.bea.content.virtual.workflow
Class Workflow

java.lang.Object
  extended by com.bea.content.virtual.workflow.Workflow
All Implemented Interfaces
Serializable

public class Workflow
extends Object
implements Serializable

Represents the Workflow document.

Methods which return an com.bea.content.paging.ISortableFilterablePagedList from IWorkflowManager can sort and filter the responses. For a discussion on paging, sorting and filtering, see com.bea.content.paging and ContentListKeys. Native sortable properties for the WLP Repository are found via the ISortablePagedList.getNativeSortableProperties() method on a paged list of Node objects.

For Workflows in the WLP Repository, the current list of native sortable and filterable properties is:

See Also
Serialized Form

Field Summary
static int DRAFT
          Predefined Workflow status
static int PUBLISHED
           
static int READY
           
static int REJECTED
           
static int RETIRED
           
static int UNDEFINED
          Status which determines if the workflow set a object is not defined in it's corresponding workflow document
static String WORKFLOW_STATUS_FIELD
           
 
Constructor Summary
Workflow(ID id, String name, String comment, Date createdDate, Date modifiedDate)
          Construct a workflow without setting the workflowOps or the workflow document.
Workflow(ID id, String name, String comment, com.bea.content.virtual.workflow.schema.WorkflowDocument document, Date createdDate, Date modifiedDate)
          Construct a Workflow without setting the workflowOps.
Workflow(ID id, String name, String comment, com.bea.content.virtual.workflow.schema.WorkflowDocument document, WorkflowOps spiWorkflowOps, boolean isInheritedOnTarget, Date createdDate, Date modifiedDate)
          Construct a Workflow -- for internal usage by VCR

 
Method Summary
 int getBeginStatus()
          Return the status that marks the begin point of the workflow
 String getComment()
          Return the comment associated with the workflow
 Date getCreatedDate()
          Return the date workflow was created
 ID getId()
           
 Date getModifiedDate()
          Return the last modification date of the workflow
 String getName()
           
 Set<String> getRolesForCapability(ContentContext context, Node node, String capability)
          Return all the published roles for the node represented by the node id.
 Map<Integer,String> getStatusText()
          Returns a map of status representation of the text.
 List<Integer> getStatusTransitions(ContentContext context, Node node, int originStatus)
          Returns a list of valid status transitions for the user from the given status.
 List<WorkflowAction> getTransitionActions(ContentContext context, Node node, int fromState, int toState)
          Return a list of WorkflowAction objects which represent the actions to be executed when making a transition from one state to another.
 boolean hasCheckinAccess(ContentContext context, Node node, int fromStatus, int toStatus)
          Helper method to indicate whether or not a user has access to a to-status element to perform operations on the object.
 boolean hasTransitionAccess(ContentContext context, Node node, int status)
          Helper method to indicate whether or not a user has access to a from-status element to perform operations on the object.
 boolean isInheritedOnTarget()
          Indicates whether or not the given workflow is inherited on the object of the workflow.
 boolean isWorkflowDocumentLoaded()
          Indicates whether the workflow document has been loaded for this object.
 void setComment(String comment)
           
 void setInheritedOnTarget(boolean isInheritedOnTarget)
          Sets the isInheritedOnTarget value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DRAFT

public static final int DRAFT
Predefined Workflow status

See Also
Constants Summary

READY

public static final int READY
See Also
Constants Summary

REJECTED

public static final int REJECTED
See Also
Constants Summary

PUBLISHED

public static final int PUBLISHED
See Also
Constants Summary

RETIRED

public static final int RETIRED
See Also
Constants Summary

UNDEFINED

public static final int UNDEFINED
Status which determines if the workflow set a object is not defined in it's corresponding workflow document

See Also
Constants Summary

WORKFLOW_STATUS_FIELD

public static final String WORKFLOW_STATUS_FIELD
See Also
Constants Summary
Constructor Detail

Workflow

public Workflow(ID id,
                String name,
                String comment,
                com.bea.content.virtual.workflow.schema.WorkflowDocument document,
                WorkflowOps spiWorkflowOps,
                boolean isInheritedOnTarget,
                Date createdDate,
                Date modifiedDate)
Construct a Workflow -- for internal usage by VCR

Parameters
id - The ID of the workflow
name - The name of the workflow - workflow names are unique within a repository
comment - An optional comment associated with a workflow
document - The actual workflow document
spiWorkflowOps - The SPI interface for the workflow.
isInheritedOnTarget - Indicates whether the workflow is inherited on target or not.
createdDate - The date the workflow was created.
modifiedDate - The date the workflow was modified.

Workflow

public Workflow(ID id,
                String name,
                String comment,
                com.bea.content.virtual.workflow.schema.WorkflowDocument document,
                Date createdDate,
                Date modifiedDate)
Construct a Workflow without setting the workflowOps. Note that this is a helper constructor only and in order to use the Workflow methods to get transitions etc, you need to set the workflowOps also.

Parameters
id - The ID of the workflow
name - The name of the workflow - workflow names are unique within a repository
comment - An optional comment associated with a workflow
document - The actual workflow document
createdDate - The date the workflow was created.
modifiedDate - The date the workflow was modified.

Workflow

public Workflow(ID id,
                String name,
                String comment,
                Date createdDate,
                Date modifiedDate)
Construct a workflow without setting the workflowOps or the workflow document. This essentially creates a workflow object which acts only as a value object (useful to display the workflow objects in a list for example) and you cannot perform any transition methods on this object.

Parameters
id - The ID of the workflow
name - The name of the workflow - workflow names are unique within a repository
comment - An optional comment associated with a workflow
createdDate - The date the workflow was created.
modifiedDate - The date the workflow was modified.
Method Detail

isWorkflowDocumentLoaded

public boolean isWorkflowDocumentLoaded()
Indicates whether the workflow document has been loaded for this object.

Returns
whether the workflow document has been loaded for this object or not

getId

public ID getId()
Returns
Returns the id.

getName

public String getName()
Returns
Returns the name of the workflow

getComment

public String getComment()
Return the comment associated with the workflow

Returns
The comment

setComment

public void setComment(String comment)

getCreatedDate

public Date getCreatedDate()
Return the date workflow was created

Returns
The creation date

getModifiedDate

public Date getModifiedDate()
Return the last modification date of the workflow

Returns
The modification date

getBeginStatus

public int getBeginStatus()
                   throws RepositoryException
Return the status that marks the begin point of the workflow

Returns
-1 if document is not defined, the begin status otherwise
Throws
RepositoryException - if the retrieval of the workflow document fails.

getStatusTransitions

public List<Integer> getStatusTransitions(ContentContext context,
                                          Node node,
                                          int originStatus)
Returns a list of valid status transitions for the user from the given status. The list contains Integer values of Status Transitions. If the originStatus does not exist in the workflow document, the method will search for any UNDEFINED transitions described in the workflow document, and will return the available transitions for that status.

Parameters
context - The ContentContext object
node - The node being operated on.
originStatus - The origin status for the user.
Returns
An integer list of allowable status transitions.

getTransitionActions

public List<WorkflowAction> getTransitionActions(ContentContext context,
                                                 Node node,
                                                 int fromState,
                                                 int toState)
                                          throws IOException,
                                                 com.bea.xml.XmlException,
                                                 ClassNotFoundException,
                                                 InstantiationException,
                                                 IllegalAccessException,
                                                 com.bea.p13n.entitlements.common.EntitlementsException,
                                                 RepositoryException
Return a list of WorkflowAction objects which represent the actions to be executed when making a transition from one state to another. If the transition fromState is not defined in the workflow document, this method will try to retrieve the transition actions for the UNDEFINED state.

Parameters
context - The ContentContext object
node - The node on which actions are executed.
fromState - The start point of the transition.
toState - The end point of the transition.
Returns
A list of WorkflowAction objects, or null if transition fromState -> toState is not defined in the document, and the UNDEFINED transition is also not defined. This method can also return an empty list if the user is not authorized to execute any actions for that transition.
Throws
IOException - If an error occurs while reading the workflow document.
com.bea.xml.XmlException - If an error occurs parsing the workflow document.
ClassNotFoundException - If the workflow points to an action class which isn't found.
InstantiationException - If the workflow points to an action class which can't be instantiated.
IllegalAccessException - If the class or its nullary constructor is not accessible.
com.bea.p13n.entitlements.common.EntitlementsException - If a security exception occurs.
RepositoryException - If this operation fails.

hasTransitionAccess

public boolean hasTransitionAccess(ContentContext context,
                                   Node node,
                                   int status)
                            throws IOException,
                                   com.bea.xml.XmlException,
                                   AuthenticationException,
                                   AuthorizationException,
                                   TransitionNotFoundException,
                                   NoSuchNodeException,
                                   RepositoryException
Helper method to indicate whether or not a user has access to a from-status element to perform operations on the object. If the administrator has specified a capabilityConstraint/roleConstraint on the from-status element, this will check for the user's credentials to see if the current user matches these constraints. If the status does not exist in the workflow, the method will throw an exception

Parameters
context - The contentContext object
node - The node object
status - The status to check.
Returns
true if the user has access - false otherwise.
Throws
IOException - If an error occurs while reading the workflow document.
com.bea.xml.XmlException - If an error occurs parsing the workflow document.
AuthenticationException - If an authentication failure occurs.
AuthorizationException - If an authorization failure occurs.
TransitionNotFoundException - If the transition is not found
NoSuchNodeException - If the given node does not exist.
RepositoryException - If this operation fails for any other reason.

hasCheckinAccess

public boolean hasCheckinAccess(ContentContext context,
                                Node node,
                                int fromStatus,
                                int toStatus)
                         throws IOException,
                                com.bea.xml.XmlException,
                                AuthenticationException,
                                AuthorizationException,
                                TransitionNotFoundException,
                                NoSuchNodeException,
                                com.bea.p13n.entitlements.common.EntitlementsException,
                                RepositoryException
Helper method to indicate whether or not a user has access to a to-status element to perform operations on the object. If the administrator has specified a capabilityConstraint/roleConstraint on the to-status element, this will check for the user's credentials to see if the current user matches these constraints. If the status does not exist in the workflow, the method will throw an exception

Parameters
context - The contentContext object
node - The node object
fromStatus - The status which the object has prior to checkin.
toStatus - The status to check (the status the caller has changed the node to.)
Returns
true if the user has access - false otherwise.
Throws
IOException - If an error occurs while reading the workflow document.
com.bea.xml.XmlException - If an error occurs parsing the workflow document.
AuthenticationException - If an authentication failure occurs.
AuthorizationException - If an authorization failure occurs.
TransitionNotFoundException - If the transition is not found
NoSuchNodeException - If the given node does not exist.
com.bea.p13n.entitlements.common.EntitlementsException - If a security exception occurs.
RepositoryException - If this operation fails for any other reason.

getRolesForCapability

public Set<String> getRolesForCapability(ContentContext context,
                                         Node node,
                                         String capability)
                                  throws AuthenticationException,
                                         AuthorizationException,
                                         NoSuchNodeException,
                                         RepositoryException
Return all the published roles for the node represented by the node id. This will not only find the published role on that node id, but will also try to find published roles which are inherited by the node id. Finally, it will append the "Admin" role to the publish roles list.

Parameters
context - The content context object
node - The node object
capability - The capability to retrieve
Returns
A Set of string roles for the given node id.
Throws
AuthenticationException - If an authentication error occurs.
AuthorizationException - If an authorizaton error occurs.
NoSuchNodeException - If the given node does not exist.
RepositoryException

getStatusText

public Map<Integer,String> getStatusText()
                                  throws RepositoryException
Returns a map of status representation of the text. The key is the status id (Integer) and the value is the text representation of the status code.

Returns
Map of values for the status id's in the order as described in the workflow document.
Throws
RepositoryException - If this operation fails to retrieve the underlying workflow document.

isInheritedOnTarget

public boolean isInheritedOnTarget()
Indicates whether or not the given workflow is inherited on the object of the workflow. For example when you call workflowManager.getWorkflowForNode() the workflow object returned will have this value as True if the workflow was actually inherited for that node. It will be false if the user has explicitly set the workflow on the node itself. The same behavior exists if a workflow is set on the type - when you call workflowManager.getWorkflowForType() In case of a conflict, the value will be returned based on same conflict resolution rules which exist in the workflowManager.getWorkflowForNode() method. So for example for in hierarchy A/B/C if some workflow is set on Node A. Also assume that Node C has a type "Data" which has a workflow associated with that also. So in that case, the method getWorkflowForNode(Node C) will return the workflow of type "Data" and whether or not it is inherited will depend if the workflow on type "Data" is inherited or not.

Returns
true if inherited, false otherwise

setInheritedOnTarget

public void setInheritedOnTarget(boolean isInheritedOnTarget)
Sets the isInheritedOnTarget value. This is computed and set by the system and is based on the object on which the workflow is set.

Parameters
isInheritedOnTarget - True if inherited


Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.