com.opensymphony.workflow
Interface Workflow

All Known Implementing Classes:
AbstractWorkflow, BasicSOAPWorkflow, BasicWorkflow, EJBWorkflow, OfbizSOAPWorkflow, OfbizWorkflow, WorkflowEJB, WorkflowSession, XFireSOAPWorkflow

public interface Workflow

The core workflow interface.

Author:
Patrick Lightbody

Field Summary
static String BSF_COL
           
static String BSF_LANGUAGE
           
static String BSF_ROW
           
static String BSF_SCRIPT
           
static String BSF_SOURCE
           
static String BSH_SCRIPT
           
static String CLASS_NAME
           
static String EJB_LOCATION
           
static String JNDI_LOCATION
           
 
Method Summary
 boolean canInitialize(String workflowName, int initialStep)
          Check if the calling user has enough permissions to initialise the specified workflow.
 boolean canInitialize(String workflowName, int initialAction, Map inputs)
          Determine if a particular workflow can be initialized.
 boolean canModifyEntryState(long id, int newState)
          Check if the state of the specified workflow instance can be changed to the new specified one.
 void changeEntryState(long id, int newState)
          Modify the state of the specified workflow instance.
 void doAction(long id, int actionId, Map inputs)
          Perform an action on the specified workflow instance.
 void executeTriggerFunction(long id, int triggerId)
          Executes a special trigger-function using the context of the given workflow instance id.
 int[] getAvailableActions(long id)
          Deprecated. use getAvailableActions(long, Map) with an empty Map instead.
 int[] getAvailableActions(long id, Map inputs)
          Get the available actions for the specified workflow instance.
 List getCurrentSteps(long id)
          Returns a Collection of Step objects that are the current steps of the specified workflow instance.
 int getEntryState(long id)
          Return the state of the specified workflow instance id.
 List getHistorySteps(long id)
          Returns a list of all steps that are completed for the given workflow instance id.
 com.opensymphony.module.propertyset.PropertySet getPropertySet(long id)
          Get the PropertySet for the specified workflow instance id.
 List getSecurityPermissions(long id)
          Deprecated. use getSecurityPermissions(long, java.util.Map) with a null map instead.
 List getSecurityPermissions(long id, Map inputs)
          Get a collection (Strings) of currently defined permissions for the specified workflow instance.
 WorkflowDescriptor getWorkflowDescriptor(String workflowName)
          Get the workflow descriptor for the specified workflow name.
 String getWorkflowName(long id)
          Get the name of the specified workflow instance.
 String[] getWorkflowNames()
          Get all available workflow names.
 long initialize(String workflowName, int initialAction, Map inputs)
          Initializes a workflow so that it can begin processing.
 List query(WorkflowExpressionQuery query)
          Query the workflow store for matching instances
 List query(WorkflowQuery query)
          Deprecated. use query(WorkflowExpressionQuery) instead.
 boolean removeWorkflowDescriptor(String workflowName)
          Remove the specified workflow descriptor.
 boolean saveWorkflowDescriptor(String workflowName, WorkflowDescriptor descriptor, boolean replace)
          Add a new workflow descriptor
 void setConfiguration(Configuration configuration)
          Set the configuration for this workflow.
 

Field Detail

BSF_COL

static final String BSF_COL
See Also:
Constant Field Values

BSF_LANGUAGE

static final String BSF_LANGUAGE
See Also:
Constant Field Values

BSF_ROW

static final String BSF_ROW
See Also:
Constant Field Values

BSF_SCRIPT

static final String BSF_SCRIPT
See Also:
Constant Field Values

BSF_SOURCE

static final String BSF_SOURCE
See Also:
Constant Field Values

BSH_SCRIPT

static final String BSH_SCRIPT
See Also:
Constant Field Values

CLASS_NAME

static final String CLASS_NAME
See Also:
Constant Field Values

EJB_LOCATION

static final String EJB_LOCATION
See Also:
Constant Field Values

JNDI_LOCATION

static final String JNDI_LOCATION
See Also:
Constant Field Values
Method Detail

getAvailableActions

int[] getAvailableActions(long id)
Deprecated. use getAvailableActions(long, Map) with an empty Map instead.


getCurrentSteps

List getCurrentSteps(long id)
Returns a Collection of Step objects that are the current steps of the specified workflow instance.

Parameters:
id - The workflow instance id.
Returns:
The steps that the workflow instance is currently in.

getEntryState

int getEntryState(long id)
Return the state of the specified workflow instance id.

Parameters:
id - The workflow instance id.
Returns:
int The state id of the specified workflow

getHistorySteps

List getHistorySteps(long id)
Returns a list of all steps that are completed for the given workflow instance id.

Parameters:
id - The workflow instance id.
Returns:
a List of Steps
See Also:
Step

getPropertySet

com.opensymphony.module.propertyset.PropertySet getPropertySet(long id)
Get the PropertySet for the specified workflow instance id.

Parameters:
id - The workflow instance id.

getSecurityPermissions

List getSecurityPermissions(long id)
Deprecated. use getSecurityPermissions(long, java.util.Map) with a null map instead.

Get a collection (Strings) of currently defined permissions for the specified workflow instance.

Parameters:
id - the workflow instance id.
Returns:
A List of permissions specified currently (a permission is a string name).

getSecurityPermissions

List getSecurityPermissions(long id,
                            Map inputs)
Get a collection (Strings) of currently defined permissions for the specified workflow instance.

Parameters:
id - id the workflow instance id.
inputs - inputs The inputs to the workflow instance.
Returns:
A List of permissions specified currently (a permission is a string name).

getWorkflowDescriptor

WorkflowDescriptor getWorkflowDescriptor(String workflowName)
Get the workflow descriptor for the specified workflow name.

Parameters:
workflowName - The workflow name.

getWorkflowName

String getWorkflowName(long id)
Get the name of the specified workflow instance.

Parameters:
id - the workflow instance id.

canInitialize

boolean canInitialize(String workflowName,
                      int initialStep)
Check if the calling user has enough permissions to initialise the specified workflow.

Parameters:
workflowName - The name of the workflow to check.
initialStep - The id of the initial state to check.
Returns:
true if the user can successfully call initialize, false otherwise.

canModifyEntryState

boolean canModifyEntryState(long id,
                            int newState)
Check if the state of the specified workflow instance can be changed to the new specified one.

Parameters:
id - The workflow instance id.
newState - The new state id.
Returns:
true if the state of the workflow can be modified, false otherwise.

changeEntryState

void changeEntryState(long id,
                      int newState)
                      throws WorkflowException
Modify the state of the specified workflow instance.

Parameters:
id - The workflow instance id.
newState - the new state to change the workflow instance to. If the new state is com.opensymphony.workflow.spi.WorkflowEntry.KILLED or com.opensymphony.workflow.spi.WorkflowEntry.COMPLETED then all current steps are moved to history steps. If the new state is
Throws:
WorkflowException

doAction

void doAction(long id,
              int actionId,
              Map inputs)
              throws InvalidInputException,
                     WorkflowException
Perform an action on the specified workflow instance.

Parameters:
id - The workflow instance id.
actionId - The action id to perform (action id's are listed in the workflow descriptor).
inputs - The inputs to the workflow instance.
Throws:
InvalidInputException - if a validator is specified and an input is invalid.
InvalidActionException - if the action is invalid for the specified workflow instance's current state.
WorkflowException

executeTriggerFunction

void executeTriggerFunction(long id,
                            int triggerId)
                            throws WorkflowException
Executes a special trigger-function using the context of the given workflow instance id. Note that this method is exposed for Quartz trigger jobs, user code should never call it.

Parameters:
id - The workflow instance id
triggerId - The id of the speciail trigger-function
Throws:
WorkflowException

initialize

long initialize(String workflowName,
                int initialAction,
                Map inputs)
                throws InvalidRoleException,
                       InvalidInputException,
                       WorkflowException,
                       InvalidEntryStateException,
                       InvalidActionException
Initializes a workflow so that it can begin processing. A workflow must be initialized before it can begin any sort of activity. It can only be initialized once.

Parameters:
workflowName - The workflow name to create and initialize an instance for
initialAction - The initial step to start the workflow
inputs - The inputs entered by the end-user
Throws:
InvalidRoleException - if the user can't start this function
InvalidInputException - if a validator is specified and an input is invalid.
InvalidActionException - if the specified initial action is invalid for the specified workflow.
WorkflowException
InvalidEntryStateException

query

List query(WorkflowQuery query)
           throws WorkflowException
Deprecated. use query(WorkflowExpressionQuery) instead.

Query the workflow store for matching instances

Throws:
WorkflowException

query

List query(WorkflowExpressionQuery query)
           throws WorkflowException
Query the workflow store for matching instances

Throws:
WorkflowException

getAvailableActions

int[] getAvailableActions(long id,
                          Map inputs)
Get the available actions for the specified workflow instance.

Parameters:
id - The workflow instance id.
inputs - The inputs map to pass on to conditions
Returns:
An array of action id's that can be performed on the specified entry
Throws:
IllegalArgumentException - if the specified id does not exist, or if its workflow descriptor is no longer available or has become invalid.

setConfiguration

void setConfiguration(Configuration configuration)
Set the configuration for this workflow. If not set, then the workflow will use the default configuration static instance.

Parameters:
configuration - a workflow configuration

getWorkflowNames

String[] getWorkflowNames()
Get all available workflow names.


canInitialize

boolean canInitialize(String workflowName,
                      int initialAction,
                      Map inputs)
Determine if a particular workflow can be initialized.

Parameters:
workflowName - The workflow name to check.
initialAction - The potential initial action.
inputs - The inputs to check.
Returns:
true if the workflow can be initialized, false otherwise.

removeWorkflowDescriptor

boolean removeWorkflowDescriptor(String workflowName)
                                 throws FactoryException
Remove the specified workflow descriptor.

Parameters:
workflowName - The workflow name of the workflow to remove.
Returns:
true if the workflow was removed, false otherwise.
Throws:
FactoryException - If the underlying workflow factory has an error removing the workflow, or if it does not support the removal of workflows.

saveWorkflowDescriptor

boolean saveWorkflowDescriptor(String workflowName,
                               WorkflowDescriptor descriptor,
                               boolean replace)
                               throws FactoryException
Add a new workflow descriptor

Parameters:
workflowName - The workflow name of the workflow to add
descriptor - The workflow descriptor to add
replace - true, if an existing descriptor should be overwritten
Returns:
true if the workflow was added, fales otherwise
Throws:
FactoryException - If the underlying workflow factory has an error adding the workflow, or if it does not support adding workflows.

OpenSymphony Workflow Project Page