org.infoglue.cms.controllers.kernel.impl.simple
Class WorkflowController

java.lang.Object
  |
  +--org.infoglue.cms.controllers.kernel.impl.simple.BaseController
        |
        +--org.infoglue.cms.controllers.kernel.impl.simple.WorkflowController

public class WorkflowController
extends BaseController

This controller acts as the api towards the OSWorkflow Workflow-engine.

Author:
Mattias Bogeblad, Jed Prentice

Method Summary
 WorkflowVO createWorkflowInstance(InfoGluePrincipal userPrincipal, java.lang.String workflowName)
          Deprecated. use initializeWorkflow() instead; this method relies on a hard-coded initial action ID of 0.
 java.util.List getAllSteps(InfoGluePrincipal userPrincipal, long workflowId)
          Returns all steps for a workflow definition.
 java.util.List getAvailableWorkflowVOList(InfoGluePrincipal userPrincipal)
          Returns a list of all available workflows, i.e., workflows defined in workflows.xml
static WorkflowController getController()
          Returns the WorkflowController singleton
 java.util.List getCurrentSteps(InfoGluePrincipal userPrincipal, long workflowId)
          Returns all current steps for a workflow, i.e., steps that could be performed in the workflow's current state
 java.util.List getCurrentWorkflowVOList(InfoGluePrincipal userPrincipal)
          Returns current workflows, i.e., workflows that are active.
 java.util.List getHistorySteps(InfoGluePrincipal userPrincipal, long workflowId)
          Returns all history steps for a workflow, i.e., all the steps that have already been performed.
 BaseEntityVO getNewVO()
          Returns a new WorkflowActionVO.
 java.util.Map getProperties(InfoGluePrincipal userPrincipal, long workflowId)
          Returns the contents of the PropertySet for a particular workflow
 com.opensymphony.module.propertyset.PropertySet getPropertySet(InfoGluePrincipal userPrincipal, long workflowId)
          Returns the workflow property set for a particular user and workflow
 WorkflowVO initializeWorkflow(InfoGluePrincipal principal, java.lang.String name, int actionId)
           
 WorkflowVO initializeWorkflow(InfoGluePrincipal principal, java.lang.String name, int actionId, java.util.Map map)
           
 WorkflowVO invokeAction(InfoGluePrincipal principal, javax.servlet.http.HttpServletRequest request, long workflowId, int actionId)
          Invokes an action on a workflow for a given user and request TODO: Remove dependency on HTTP request
 
Methods inherited from class org.infoglue.cms.controllers.kernel.impl.simple.BaseController
deleteEntity, deleteEntity, deleteEntity, getAllVOObjects, getAllVOObjects, getAllVOObjects, getAllVOObjects, getVOWithId, getVOWithId, getVOWithId, toModifiableVOList, toVOList, updateEntity, updateEntity, updateEntity, validateEntity
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getController

public static WorkflowController getController()
Returns the WorkflowController singleton

Returns:
a reference to a WorkflowController

createWorkflowInstance

public WorkflowVO createWorkflowInstance(InfoGluePrincipal userPrincipal,
                                         java.lang.String workflowName)
                                  throws SystemException
Deprecated. use initializeWorkflow() instead; this method relies on a hard-coded initial action ID of 0.

Creates a new instance of a named workflow.

Parameters:
userPrincipal - the user principal representing the desired user
workflowName - the name of the workflow to create.
Returns:
a WorkflowVO representing the newly created workflow instance
Throws:
SystemException - if an error occurs while initiaizing the workflow
See Also:
initializeWorkflow(org.infoglue.cms.security.InfoGluePrincipal, java.lang.String, int)

initializeWorkflow

public WorkflowVO initializeWorkflow(InfoGluePrincipal principal,
                                     java.lang.String name,
                                     int actionId)
                              throws SystemException
Parameters:
principal - the user principal representing the desired user
name - the name of the workflow to create.
actionId - the ID of the initial action
Returns:
a WorkflowVO representing the newly created workflow instance
Throws:
SystemException - if an error occurs while initiaizing the workflow

initializeWorkflow

public WorkflowVO initializeWorkflow(InfoGluePrincipal principal,
                                     java.lang.String name,
                                     int actionId,
                                     java.util.Map map)
                              throws SystemException
Parameters:
principal - the user principal representing the desired user
name - the name of the workflow to create.
actionId - the ID of the initial action
Returns:
a WorkflowVO representing the newly created workflow instance
Throws:
SystemException - if an error occurs while initiaizing the workflow

getAvailableWorkflowVOList

public java.util.List getAvailableWorkflowVOList(InfoGluePrincipal userPrincipal)
Returns a list of all available workflows, i.e., workflows defined in workflows.xml

Parameters:
userPrincipal - a user principal
Returns:
a list WorkflowVOs representing available workflows

getCurrentWorkflowVOList

public java.util.List getCurrentWorkflowVOList(InfoGluePrincipal userPrincipal)
                                        throws SystemException
Returns current workflows, i.e., workflows that are active.

Parameters:
userPrincipal - a user principal
Returns:
a list of WorkflowVOs representing all active workflows
Throws:
SystemException - if an error occurs while finding the current workflows

invokeAction

public WorkflowVO invokeAction(InfoGluePrincipal principal,
                               javax.servlet.http.HttpServletRequest request,
                               long workflowId,
                               int actionId)
                        throws com.opensymphony.workflow.WorkflowException
Invokes an action on a workflow for a given user and request TODO: Remove dependency on HTTP request

Parameters:
principal - the user principal
request - the current HTTP request
workflowId - the ID of the desired workflow
actionId - the ID of the desired action
Returns:
a WorkflowVO representing the current state of the workflow identified by workflowId
Throws:
com.opensymphony.workflow.WorkflowException - if a workflow error occurs

getPropertySet

public com.opensymphony.module.propertyset.PropertySet getPropertySet(InfoGluePrincipal userPrincipal,
                                                                      long workflowId)
Returns the workflow property set for a particular user and workflow

Returns:
the workflow property set for the workflow with workflowId and the user represented by userPrincipal

getProperties

public java.util.Map getProperties(InfoGluePrincipal userPrincipal,
                                   long workflowId)
Returns the contents of the PropertySet for a particular workflow

Parameters:
userPrincipal - a user principal
workflowId - the ID of the desired workflow
Returns:
a map containing the contents of the workflow property set

getHistorySteps

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

Parameters:
userPrincipal - a user principal
workflowId - the ID of the desired workflow
Returns:
a list of WorkflowStepVOs representing all history steps for the workflow with workflowId

getCurrentSteps

public java.util.List getCurrentSteps(InfoGluePrincipal userPrincipal,
                                      long workflowId)
Returns all current steps for a workflow, i.e., steps that could be performed in the workflow's current state

Parameters:
userPrincipal - a user principal
workflowId - the Id of the desired workflow
Returns:
a list of WorkflowStepVOs representing the current steps of the workflow with workflowId

getAllSteps

public java.util.List getAllSteps(InfoGluePrincipal userPrincipal,
                                  long workflowId)
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.

Parameters:
userPrincipal - an InfoGluePrincipal representing a system user
workflowId - a workflowId
Returns:
a list of WorkflowStepVOs representing all steps in the workflow.

getNewVO

public BaseEntityVO getNewVO()
Returns a new WorkflowActionVO. This method is apparently unused, but is required by BaseController. We don't use it internally because it requires a cast; it is simpler to just use new to create an instance.

Specified by:
getNewVO in class BaseController
Returns:
a new WorkflowActionVO.