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

java.lang.Object
  extended by org.infoglue.cms.controllers.kernel.impl.simple.BaseController
      extended by 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
static java.util.Map createWorkflowParameters(javax.servlet.http.HttpServletRequest request)
          TODO: move; used by tests + CreateWorkflowInstanceAction
 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.
 boolean getIsAccessApproved(java.lang.String workflowName, InfoGluePrincipal infoGluePrincipal)
          This method returns true if the user should have access to the contentTypeDefinition sent in.
 java.util.List getMyCurrentWorkflowVOList(InfoGluePrincipal userPrincipal)
          Returns the workflows owned by the specified principal.
 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, java.util.Map inputs)
           
 WorkflowVO invokeAction(InfoGluePrincipal principal, long workflowId, int actionId, java.util.Map inputs)
          Invokes an action on a workflow for a given user and request
 
Methods inherited from class org.infoglue.cms.controllers.kernel.impl.simple.BaseController
beginTransaction, beginTransaction, closeDatabase, commitTransaction, createEntity, createEntity, createQuery, deleteEntity, deleteEntity, deleteEntity, deleteEntity, executeQuery, executeQuery, executeQuery, executeQuery, getAllObjects, getAllVOObjects, getAllVOObjects, getAllVOObjects, getAllVOObjects, getLogger, getObjectWithId, getObjectWithId, getObjectWithIdAsReadOnly, getVOWithId, getVOWithId, getVOWithId, getVOWithId, intercept, intercept, rollbackTransaction, toModifiableVOList, toVOList, updateEntity, updateEntity, updateEntity, updateEntity, validateEntity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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

createWorkflowParameters

public static java.util.Map createWorkflowParameters(javax.servlet.http.HttpServletRequest request)
TODO: move; used by tests + CreateWorkflowInstanceAction


initializeWorkflow

public WorkflowVO initializeWorkflow(InfoGluePrincipal principal,
                                     java.lang.String name,
                                     int actionId,
                                     java.util.Map inputs)
                              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
inputs - the inputs to the workflow
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)
                                          throws SystemException
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
Throws:
SystemException

getIsAccessApproved

public boolean getIsAccessApproved(java.lang.String workflowName,
                                   InfoGluePrincipal infoGluePrincipal)
                            throws SystemException
This method returns true if the user should have access to the contentTypeDefinition sent in.

Throws:
SystemException

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

getMyCurrentWorkflowVOList

public java.util.List getMyCurrentWorkflowVOList(InfoGluePrincipal userPrincipal)
                                          throws SystemException
Returns the workflows owned by the specified principal.

Parameters:
userPrincipal - a user principal.
Returns:
a list of WorkflowVOs owned by the principal.
Throws:
SystemException - if an error occurs while finding the workflows

invokeAction

public WorkflowVO invokeAction(InfoGluePrincipal principal,
                               long workflowId,
                               int actionId,
                               java.util.Map inputs)
                        throws com.opensymphony.workflow.WorkflowException
Invokes an action on a workflow for a given user and request

Parameters:
principal - the user principal
workflowId - the ID of the desired workflow
actionId - the ID of the desired action
inputs - the inputs to the workflow
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.


Copyright © 2005 InfoGlue.org All Rights Reserved.