Class WorkflowHelper
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.plugins.workflow.support.WorkflowHelper
-
- All Implemented Interfaces:
Component,LogEnabled,Serviceable
public class WorkflowHelper extends AbstractLogEnabled implements Component, Serviceable
Helper to get information on the workflow structures
-
-
Field Summary
Fields Modifier and Type Field Description protected WorkflowProvider_workflowProviderThe content types extension pointstatic StringROLEThe Avalon role
-
Constructor Summary
Constructors Constructor Description WorkflowHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetActionName(String workflowName, int actionID)Retrieves the name of an action.int[]getAllActions(String workflowName)Retrieves all actions of the workflow of a particular type of workflow except initial actions.int[]getAllActionsFromStep(String workflowName, int stepId)Retrieves the action ids from a particular step.intgetInitialAction(String workflowName)Retrieves the initial action id of a workflow.List<com.opensymphony.workflow.spi.Step>getStepAt(com.opensymphony.workflow.Workflow workflow, long entryId, Date timestamp)Get the steps the workflow was "in" at a given date.StringgetStepName(String workflowName, int stepId)Retrieves the name of a step.List<com.opensymphony.workflow.spi.Step>getStepsBetween(com.opensymphony.workflow.Workflow workflow, long entryId, Date start, Date end)Get the steps the workflow was "in" between two dates.com.opensymphony.workflow.loader.WorkflowDescriptorgetWorkflowDescriptor(String workflowName)Returns a workflow definition object associated with the given name.String[]getWorkflowNames()Get a list of workflow names availablevoidservice(ServiceManager smanager)-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_workflowProvider
protected WorkflowProvider _workflowProvider
The content types extension point
-
-
Constructor Detail
-
WorkflowHelper
public WorkflowHelper()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
getWorkflowNames
public String[] getWorkflowNames()
Get a list of workflow names available- Returns:
- String[] an array of workflow names.
-
getWorkflowDescriptor
public com.opensymphony.workflow.loader.WorkflowDescriptor getWorkflowDescriptor(String workflowName)
Returns a workflow definition object associated with the given name.- Parameters:
workflowName- the name of the workflow- Returns:
- the object graph that represents a workflow definition
-
getAllActions
public int[] getAllActions(String workflowName) throws IllegalArgumentException
Retrieves all actions of the workflow of a particular type of workflow except initial actions.- Parameters:
workflowName- the name of the workflow.- Returns:
- all actions ids.
- Throws:
IllegalArgumentException- If the workflow name is not valid.
-
getActionName
public String getActionName(String workflowName, int actionID)
Retrieves the name of an action.- Parameters:
workflowName- The name of the workflow.actionID- The id of the action.- Returns:
- The name of the action or an empty string.
-
getStepName
public String getStepName(String workflowName, int stepId)
Retrieves the name of a step.- Parameters:
workflowName- the name of the workflow.stepId- the id of the step.- Returns:
- the name of the step or an empty string.
-
getInitialAction
public int getInitialAction(String workflowName)
Retrieves the initial action id of a workflow.- Parameters:
workflowName- the name of the workflow.- Returns:
- the first initial action id or
-1if the workflow does not exist.
-
getAllActionsFromStep
public int[] getAllActionsFromStep(String workflowName, int stepId)
Retrieves the action ids from a particular step.- Parameters:
workflowName- the name of the workflow.stepId- the id of the step.- Returns:
- the ids of the actions of the step.
-
getStepAt
public List<com.opensymphony.workflow.spi.Step> getStepAt(com.opensymphony.workflow.Workflow workflow, long entryId, Date timestamp) throws com.opensymphony.workflow.WorkflowException
Get the steps the workflow was "in" at a given date.- Parameters:
workflow- workflowentryId- the workflow entry ID.timestamp- the date.- Returns:
- the list of steps the workflow was in.
- Throws:
com.opensymphony.workflow.WorkflowException- if an error occurs.
-
getStepsBetween
public List<com.opensymphony.workflow.spi.Step> getStepsBetween(com.opensymphony.workflow.Workflow workflow, long entryId, Date start, Date end) throws com.opensymphony.workflow.WorkflowException
Get the steps the workflow was "in" between two dates.- Parameters:
workflow- workflowentryId- the workflow entry ID.start- the start date.end- the end date.- Returns:
- the list of steps the workflow was in between the two dates.
- Throws:
com.opensymphony.workflow.WorkflowException- if an error occurs.
-
-