public class AbstractWorkflow extends Object implements Workflow
Modifier and Type | Field and Description |
---|---|
protected Configuration |
configuration |
protected WorkflowContext |
context |
protected org.apache.commons.logging.Log |
log |
protected ThreadLocal |
stateCache |
BSF_COL, BSF_LANGUAGE, BSF_ROW, BSF_SCRIPT, BSF_SOURCE, BSH_SCRIPT, CLASS_NAME, EJB_LOCATION, JNDI_LOCATION
Constructor and Description |
---|
AbstractWorkflow() |
Modifier and Type | Method and Description |
---|---|
boolean |
canInitialize(String workflowName,
int initialAction)
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.
|
protected boolean |
canInitialize(String workflowName,
int initialAction,
Map transientVars,
com.opensymphony.module.propertyset.PropertySet ps) |
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.
|
protected void |
completeEntry(ActionDescriptor action,
long id,
Collection currentSteps,
int state)
Mark the specified entry as completed, and move all current steps to history.
|
protected Step |
createNewCurrentStep(ResultDescriptor theResult,
WorkflowEntry entry,
WorkflowStore store,
int actionId,
Step currentStep,
long[] previousIds,
Map transientVars,
com.opensymphony.module.propertyset.PropertySet ps) |
void |
doAction(long id,
int actionId,
Map inputs)
Perform an action on the specified workflow instance.
|
protected void |
executeFunction(FunctionDescriptor function,
Map transientVars,
com.opensymphony.module.propertyset.PropertySet ps)
Executes a function.
|
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.
|
protected List |
getAvailableActionsForStep(WorkflowDescriptor wf,
Step step,
Map transientVars,
com.opensymphony.module.propertyset.PropertySet ps) |
protected int[] |
getAvailableAutoActions(long id,
Map inputs) |
protected List |
getAvailableAutoActionsForStep(WorkflowDescriptor wf,
Step step,
Map transientVars,
com.opensymphony.module.propertyset.PropertySet ps)
Get just auto action availables for a step
|
Configuration |
getConfiguration()
Get the configuration for this workflow.
|
protected Step |
getCurrentStep(WorkflowDescriptor wfDesc,
int actionId,
List currentSteps,
Map transientVars,
com.opensymphony.module.propertyset.PropertySet ps) |
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.
|
protected WorkflowStore |
getPersistence() |
Properties |
getPersistenceProperties() |
com.opensymphony.module.propertyset.PropertySet |
getPropertySet(long id)
Get the PropertySet for the specified workflow ID
|
TypeResolver |
getResolver() |
List |
getSecurityPermissions(long id)
Get a collection (Strings) of currently defined permissions for the specified workflow instance.
|
List |
getSecurityPermissions(long id,
Map inputs)
Get a collection (Strings) of currently defined permissions for the specified workflow instance.
|
WorkflowDescriptor |
getWorkflowDescriptor(String workflowName)
Returns a workflow definition object associated with the given name.
|
String |
getWorkflowName(long id)
Get the name of the specified workflow instance.
|
String[] |
getWorkflowNames()
Get a list of workflow names available
|
long |
initialize(String workflowName,
int initialAction,
Map inputs)
Initializes a workflow so that it can begin processing.
|
protected boolean |
isActionAvailable(ActionDescriptor action,
Map transientVars,
com.opensymphony.module.propertyset.PropertySet ps,
int stepId)
check if an action is available or not
|
protected boolean |
passesCondition(ConditionDescriptor conditionDesc,
Map transientVars,
com.opensymphony.module.propertyset.PropertySet ps,
int currentStepId) |
protected boolean |
passesConditions(ConditionsDescriptor descriptor,
Map transientVars,
com.opensymphony.module.propertyset.PropertySet ps,
int currentStepId) |
protected boolean |
passesConditions(String conditionType,
List conditions,
Map transientVars,
com.opensymphony.module.propertyset.PropertySet ps,
int currentStepId) |
protected void |
populateTransientMap(WorkflowEntry entry,
Map transientVars,
List registers,
Integer actionId,
Collection currentSteps,
com.opensymphony.module.propertyset.PropertySet ps) |
List |
query(WorkflowExpressionQuery query)
Query the workflow store for matching instances
|
List |
query(WorkflowQuery query)
Query the workflow store for matching instances
|
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.
|
void |
setResolver(TypeResolver resolver) |
protected boolean |
transitionWorkflow(WorkflowEntry entry,
List currentSteps,
WorkflowStore store,
WorkflowDescriptor wf,
ActionDescriptor action,
Map transientVars,
Map inputs,
com.opensymphony.module.propertyset.PropertySet ps) |
protected void |
verifyInputs(WorkflowEntry entry,
List validators,
Map transientVars,
com.opensymphony.module.propertyset.PropertySet ps)
Validates input against a list of ValidatorDescriptor objects.
|
protected final org.apache.commons.logging.Log log
protected Configuration configuration
protected ThreadLocal stateCache
protected WorkflowContext context
public int[] getAvailableActions(long id)
getAvailableActions(long, Map)
with an empty Map instead.getAvailableActions
in interface Workflow
public int[] getAvailableActions(long id, Map inputs)
getAvailableActions
in interface Workflow
id
- The workflow instance id.inputs
- The inputs map to pass on to conditionsIllegalArgumentException
- if the specified id does not exist, or if its workflow
descriptor is no longer available or has become invalid.public void setConfiguration(Configuration configuration)
Workflow
setConfiguration
in interface Workflow
configuration
- a workflow configurationpublic Configuration getConfiguration()
public List getCurrentSteps(long id)
Workflow
getCurrentSteps
in interface Workflow
id
- The workflow instance id.public int getEntryState(long id)
Workflow
getEntryState
in interface Workflow
id
- The workflow instance id.public List getHistorySteps(long id)
Workflow
getHistorySteps
in interface Workflow
id
- The workflow instance id.Step
public Properties getPersistenceProperties()
public com.opensymphony.module.propertyset.PropertySet getPropertySet(long id)
getPropertySet
in interface Workflow
id
- The workflow IDpublic void setResolver(TypeResolver resolver)
public TypeResolver getResolver()
public List getSecurityPermissions(long id)
Workflow
getSecurityPermissions
in interface Workflow
id
- the workflow instance id.public List getSecurityPermissions(long id, Map inputs)
Workflow
getSecurityPermissions
in interface Workflow
id
- id the workflow instance id.inputs
- inputs The inputs to the workflow instance.public WorkflowDescriptor getWorkflowDescriptor(String workflowName)
getWorkflowDescriptor
in interface Workflow
workflowName
- the name of the workflowpublic String getWorkflowName(long id)
Workflow
getWorkflowName
in interface Workflow
id
- the workflow instance id.public String[] getWorkflowNames()
getWorkflowNames
in interface Workflow
public boolean canInitialize(String workflowName, int initialAction)
Workflow
canInitialize
in interface Workflow
workflowName
- The name of the workflow to check.initialAction
- The id of the initial state to check.public boolean canInitialize(String workflowName, int initialAction, Map inputs)
Workflow
canInitialize
in interface Workflow
workflowName
- the name of the workflow to checkinitialAction
- The initial action to checkinputs
- the inputs mappublic boolean canModifyEntryState(long id, int newState)
Workflow
canModifyEntryState
in interface Workflow
id
- The workflow instance id.newState
- The new state id.public void changeEntryState(long id, int newState) throws WorkflowException
Workflow
changeEntryState
in interface Workflow
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 isWorkflowException
public void doAction(long id, int actionId, Map inputs) throws WorkflowException
Workflow
doAction
in interface Workflow
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.InvalidInputException
- if a validator is specified and an input is invalid.WorkflowException
public void executeTriggerFunction(long id, int triggerId) throws WorkflowException
Workflow
executeTriggerFunction
in interface Workflow
id
- The workflow instance idtriggerId
- The id of the speciail trigger-functionWorkflowException
public long initialize(String workflowName, int initialAction, Map inputs) throws InvalidRoleException, InvalidInputException, WorkflowException
Workflow
initialize
in interface Workflow
workflowName
- The workflow name to create and initialize an instance forinitialAction
- The initial step to start the workflowinputs
- The inputs entered by the end-userInvalidRoleException
- if the user can't start this functionInvalidInputException
- if a validator is specified and an input is invalid.WorkflowException
public List query(WorkflowQuery query) throws StoreException
Workflow
query
in interface Workflow
StoreException
public List query(WorkflowExpressionQuery query) throws WorkflowException
Workflow
query
in interface Workflow
WorkflowException
public boolean removeWorkflowDescriptor(String workflowName) throws FactoryException
Workflow
removeWorkflowDescriptor
in interface Workflow
workflowName
- The workflow name of the workflow to remove.FactoryException
- If the underlying workflow factory has an error removing the workflow,
or if it does not support the removal of workflows.public boolean saveWorkflowDescriptor(String workflowName, WorkflowDescriptor descriptor, boolean replace) throws FactoryException
Workflow
saveWorkflowDescriptor
in interface Workflow
workflowName
- The workflow name of the workflow to adddescriptor
- The workflow descriptor to addreplace
- true, if an existing descriptor should be overwrittenFactoryException
- If the underlying workflow factory has an error adding the workflow,
or if it does not support adding workflows.protected boolean isActionAvailable(ActionDescriptor action, Map transientVars, com.opensymphony.module.propertyset.PropertySet ps, int stepId) throws WorkflowException
action
- The action descriptorWorkflowException
protected List getAvailableActionsForStep(WorkflowDescriptor wf, Step step, Map transientVars, com.opensymphony.module.propertyset.PropertySet ps) throws WorkflowException
WorkflowException
protected int[] getAvailableAutoActions(long id, Map inputs)
protected List getAvailableAutoActionsForStep(WorkflowDescriptor wf, Step step, Map transientVars, com.opensymphony.module.propertyset.PropertySet ps) throws WorkflowException
WorkflowException
protected Step getCurrentStep(WorkflowDescriptor wfDesc, int actionId, List currentSteps, Map transientVars, com.opensymphony.module.propertyset.PropertySet ps) throws WorkflowException
WorkflowException
protected WorkflowStore getPersistence() throws StoreException
StoreException
protected boolean canInitialize(String workflowName, int initialAction, Map transientVars, com.opensymphony.module.propertyset.PropertySet ps) throws WorkflowException
WorkflowException
protected void completeEntry(ActionDescriptor action, long id, Collection currentSteps, int state) throws StoreException
StoreException
protected Step createNewCurrentStep(ResultDescriptor theResult, WorkflowEntry entry, WorkflowStore store, int actionId, Step currentStep, long[] previousIds, Map transientVars, com.opensymphony.module.propertyset.PropertySet ps) throws WorkflowException
WorkflowException
protected void executeFunction(FunctionDescriptor function, Map transientVars, com.opensymphony.module.propertyset.PropertySet ps) throws WorkflowException
function
- the function to executetransientVars
- the transientVars given by the end-userps
- the persistence variablesWorkflowException
protected boolean passesCondition(ConditionDescriptor conditionDesc, Map transientVars, com.opensymphony.module.propertyset.PropertySet ps, int currentStepId) throws WorkflowException
WorkflowException
protected boolean passesConditions(String conditionType, List conditions, Map transientVars, com.opensymphony.module.propertyset.PropertySet ps, int currentStepId) throws WorkflowException
WorkflowException
protected boolean passesConditions(ConditionsDescriptor descriptor, Map transientVars, com.opensymphony.module.propertyset.PropertySet ps, int currentStepId) throws WorkflowException
WorkflowException
protected void populateTransientMap(WorkflowEntry entry, Map transientVars, List registers, Integer actionId, Collection currentSteps, com.opensymphony.module.propertyset.PropertySet ps) throws WorkflowException
WorkflowException
protected boolean transitionWorkflow(WorkflowEntry entry, List currentSteps, WorkflowStore store, WorkflowDescriptor wf, ActionDescriptor action, Map transientVars, Map inputs, com.opensymphony.module.propertyset.PropertySet ps) throws WorkflowException
WorkflowException
protected void verifyInputs(WorkflowEntry entry, List validators, Map transientVars, com.opensymphony.module.propertyset.PropertySet ps) throws WorkflowException
entry
- the workflow instancevalidators
- the list of ValidatorDescriptorstransientVars
- the transientVarsps
- the persistence variablesInvalidInputException
- if the input is deemed invalid by any validatorWorkflowException
Copyright © 2021 catworkx GmbH. All rights reserved.