org.infoglue.cms.util.workflow
Class WorkflowFacade

java.lang.Object
  extended by org.infoglue.cms.util.workflow.WorkflowFacade

public class WorkflowFacade
extends java.lang.Object

A facade to OSWorkflow that gives us a place to cache workflow data as we need it while interacting with it. This class has kind of a strange interface due to the idiosyncracies of the OSWorkflow, particularly the Workflow interface. The idea is to encapsulate the interactions with OSWorkflow and eliminate the need to pass a Workflow reference and the workflow ID all over the place when extracting data from OSWorkflow

Version:
$Revision: 1.36 $ $Date: 2007/03/13 12:07:58 $
Author:
Jed Prentice

Constructor Summary
WorkflowFacade(InfoGluePrincipal userPrincipal)
          Constructs a WorkflowFacade with the given user principal
WorkflowFacade(InfoGluePrincipal userPrincipal, long workflowId)
          Constructs a WorkflowFacade for a user with the given workflow ID.
WorkflowFacade(InfoGluePrincipal userPrincipal, java.lang.String name, int initialAction)
          Constructs a WorkflowFacade with the given user principal representing an initialized instance of the workflow with the given name.
WorkflowFacade(InfoGluePrincipal userPrincipal, java.lang.String name, int initialAction, java.util.Map inputs)
          Constructs a WorkflowFacade with the given user principal representing an initialized instance of the workflow with the given name.
WorkflowFacade(Owner owner)
          Constructs a WorkflowFacade with the given owner.
 
Method Summary
 WorkflowVO createWorkflowVO()
          Creates a new WorkflowVO.
 void doAction(int actionId, java.util.Map inputs)
          Performs an action using the given inputs
 java.util.List getActiveWorkflows()
          Returns a list of all active workflows.
 java.util.List getCurrentSteps()
          Returns all current steps for the workflow, i.e., steps that could be performed in the workflow's current state Steps are filtered according to ownership; if a step has an owner, it is only included if the ownser matches the caller or if the current user is an administrator.
 java.util.List getCurrentSteps(WorkflowVO workflowVO)
           
 java.util.List getDeclaredSteps()
          Returns all steps for a workflow definition.
 java.util.List getDeclaredWorkflows()
          Returns a list of all declared workflows, i.e., workflows defined in workflows.xml
 java.util.List getHistorySteps()
          Returns all history steps for the workflow, i.e., all the steps that have already been performed.
 java.util.List getHistorySteps(WorkflowVO workflowVO)
           
 java.util.List getMyActiveWorkflows(InfoGluePrincipal principal)
          Returns a list of workflows owned by the specified principal.
 com.opensymphony.module.propertyset.PropertySet getPropertySet()
          Returns the property set associated with the underlying workflow
 long getWorkflowId()
          Returns the workflow ID
 boolean isActive()
          Indicates whether the underlying workflow is active.
 boolean isFinished()
          Indicates whether the underlying workflow is finished.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkflowFacade

public WorkflowFacade(Owner owner)
Constructs a WorkflowFacade with the given owner.

Parameters:
owner - the owner of the workflow.

WorkflowFacade

public WorkflowFacade(InfoGluePrincipal userPrincipal)
Constructs a WorkflowFacade with the given user principal

Parameters:
userPrincipal - an InfoGluePrincipal representing a system user

WorkflowFacade

public WorkflowFacade(InfoGluePrincipal userPrincipal,
                      java.lang.String name,
                      int initialAction)
               throws SystemException
Constructs a WorkflowFacade with the given user principal representing an initialized instance of the workflow with the given name. "Initialized" in this context means that the initial action has been executed and we have the workflow ID.

Parameters:
userPrincipal - an InfoGluePrincipal representing a system user
name - the name of the workflow to create
initialAction - the ID of the initial action to perform to get the workflow started.
Throws:
SystemException

WorkflowFacade

public WorkflowFacade(InfoGluePrincipal userPrincipal,
                      java.lang.String name,
                      int initialAction,
                      java.util.Map inputs)
               throws SystemException
Constructs a WorkflowFacade with the given user principal representing an initialized instance of the workflow with the given name. "Initialized" in this context means that the initial action has been executed and we have the workflow ID.

Parameters:
userPrincipal - an InfoGluePrincipal representing a system user
name - the name of the workflow to create
initialAction - the ID of the initial action to perform to get the workflow started.
inputs - a map of inputs to use to initialize the workflow.
Throws:
SystemException

WorkflowFacade

public WorkflowFacade(InfoGluePrincipal userPrincipal,
                      long workflowId)
Constructs a WorkflowFacade for a user with the given workflow ID.

Parameters:
userPrincipal - an InfoGluePrincipal representing a system user
workflowId - the ID representing an instance of the desired workflow
Method Detail

getWorkflowId

public long getWorkflowId()
Returns the workflow ID

Returns:
the workflow ID

doAction

public void doAction(int actionId,
                     java.util.Map inputs)
              throws com.opensymphony.workflow.WorkflowException
Performs an action using the given inputs

Parameters:
actionId - the ID of the action to perform
inputs - a map of inputs to the action
Throws:
com.opensymphony.workflow.WorkflowException - if a workflow error occurs, or if the underlying workflow is not active

getPropertySet

public com.opensymphony.module.propertyset.PropertySet getPropertySet()
Returns the property set associated with the underlying workflow

Returns:
the property set associated with the underlying workflow

isActive

public boolean isActive()
                 throws com.opensymphony.workflow.WorkflowException
Indicates whether the underlying workflow is active.

Returns:
true if the underlying workflow's state is WorkflowEntry.ACTIVATED, otherwise returns false.
Throws:
com.opensymphony.workflow.WorkflowException

isFinished

public boolean isFinished()
                   throws com.opensymphony.workflow.WorkflowException
Indicates whether the underlying workflow is finished.

Returns:
true if the underlying workflow's state is WorkflowEntry.KILLED or WorkflowEntry.COMPLETED, otherwise returns false.
Throws:
com.opensymphony.workflow.WorkflowException

getDeclaredWorkflows

public java.util.List getDeclaredWorkflows()
Returns a list of all declared workflows, i.e., workflows defined in workflows.xml

Returns:
a list WorkflowVOs representing all declared workflows

getActiveWorkflows

public java.util.List getActiveWorkflows()
                                  throws SystemException
Returns a list of all active workflows.

Returns:
a list of WorkflowVOs representing all active workflows
Throws:
SystemException - if an error occurs finding the active workflows

getMyActiveWorkflows

public java.util.List getMyActiveWorkflows(InfoGluePrincipal principal)
                                    throws SystemException
Returns a list of workflows owned by the specified principal. If the principal is an administrator, all active workflows are returned.

Parameters:
principal - the principal.
Returns:
the workflows owned by the specified principal.
Throws:
SystemException

getCurrentSteps

public java.util.List getCurrentSteps()
Returns all current steps for the workflow, i.e., steps that could be performed in the workflow's current state Steps are filtered according to ownership; if a step has an owner, it is only included if the ownser matches the caller or if the current user is an administrator.

Returns:
a list of WorkflowStepVOs representing the current steps of the workflow with workflowId

getCurrentSteps

public java.util.List getCurrentSteps(WorkflowVO workflowVO)

getHistorySteps

public java.util.List getHistorySteps()
Returns all history steps for the workflow, i.e., all the steps that have already been performed.

Returns:
a list of WorkflowStepVOs representing all history steps for the workflow with workflowId

getHistorySteps

public java.util.List getHistorySteps(WorkflowVO workflowVO)

getDeclaredSteps

public java.util.List getDeclaredSteps()
Returns all steps for a workflow definition. These are the steps declared in the workfow descriptor; there is no knowledge of current or history steps at this point.

Returns:
a list of WorkflowStepVOs representing all steps in the workflow.

createWorkflowVO

public WorkflowVO createWorkflowVO()
Creates a new WorkflowVO. This represents a pretty complete workflow; you get all the current steps, history steps, available actions, and global actions.

Returns:
a WorkflowVO representing workflow, with workflowId


Copyright © 2005 InfoGlue.org All Rights Reserved.