Workflow: ezcWorkflowExecution
[ ]
[ Theoretical background ]
[ ]
[ ]
[ ]
[ ]
Class: ezcWorkflowExecution
|
Abstract base class for workflow execution engines. [
source]
ezcWorkflowExecution provides all functionality necessary to execute a workflow. However, it does not provide functionality to make the execution of a workflow persistent and hence usuable over more than one PHP run.
Implementations must implement the do* methods and provide the means to store the execution data to a persistent medium.
Descendents
Properties
Member Variables
|
protected ezcWorkflowNode[] |
$activatedNodes
= array()
Nodes of the workflow being executed that are activated. |
|
protected bool |
$cancelled
Flag that indicates whether or not this execution has been cancelled. |
|
protected bool |
$ended
Flag that indicates whether or not this execution has ended. |
|
protected integer |
$id
Execution ID. |
|
protected integer |
$nextThreadId
= 0
Sequence for thread ids. |
|
protected integer |
$numActivatedEndNodes
= 0
Number of activated end nodes. |
|
protected integer |
$numActivatedNodes
= 0
Number of activated nodes. |
|
protected array |
$plugins
= array()
Plugins registered for this execution. |
|
protected array(string=>mixed) |
$properties
= array( 'definitionStorage' => null, 'workflow' => null )
Container to hold the properties |
|
protected bool |
$resumed
Flag that indicates whether or not this execution has been resumed. |
|
protected bool |
$suspended
Flag that indicates whether or not this execution has been suspended. |
|
protected array |
$threads
= array()
Nodes of the workflow that started a new thread of execution. |
|
protected array |
$variables
= array()
Workflow variables. |
|
protected array |
$waitingFor
= array()
Workflow variables the execution is waiting for. |
Method Summary
|
public bool |
addListener(
$listener )
Adds a listener to this execution. |
|
public bool |
addPlugin(
$plugin )
Adds a plugin to this execution. |
|
public void |
cancel(
[$node = null] )
Cancels workflow execution with the node $endNode. |
|
protected abstract void |
doEnd(
)
Called by end() when workflow execution is ended. |
|
protected abstract ezcWorkflowExecution |
doGetSubExecution(
[$id = null] )
Returns a new execution object for a sub workflow. |
|
protected abstract void |
doResume(
)
Called by resume() when workflow execution is resumed. |
|
protected abstract void |
doStart(
$parentId )
Called by start() when workflow execution is initiated. |
|
protected abstract void |
doSuspend(
)
Called by suspend() when workflow execution is suspended. |
|
public bool |
hasEnded(
)
Returns true when the workflow execution has ended. |
|
public bool |
isCancelled(
)
Returns true when the workflow execution has been cancelled. |
|
public bool |
isSuspended(
)
Returns true when the workflow execution has been suspended. |
|
protected void |
loadFromVariableHandlers(
)
Loads data from variable handlers and merge it with the current execution data. |
|
public bool |
removeListener(
$listener )
Removes a listener from this execution. |
|
public bool |
removePlugin(
$plugin )
Removes a plugin from this execution. |
|
public void |
resume(
[$inputData = array()] )
Resumes workflow execution of a suspended workflow. |
|
protected void |
saveToVariableHandlers(
)
Saves data to execution data handlers. |
|
public mixed |
start(
[$parentId = null] )
Starts the execution of the workflow and returns the execution id. |
Methods
addListener
Adds a listener to this execution.
Parameters
addPlugin
Adds a plugin to this execution.
Parameters
cancel
Cancels workflow execution with the node $endNode.
Parameters
doEnd
void doEnd(
)
Called by end() when workflow execution is ended.
Reimplementations can use this method to remove execution data from the persistent medium.
Redefined in descendants as
doGetSubExecution
Returns a new execution object for a sub workflow.
Called by getSubExecution to get a new execution environment for the new execution thread.
Reimplementations must return a new execution environment similar to themselves.
Parameters
| Name |
Type |
Description |
$id |
int |
|
Redefined in descendants as
doResume
void doResume(
)
Called by resume() when workflow execution is resumed.
Reimplementations can use this method to fetch execution data if necessary..
Redefined in descendants as
doStart
void doStart(
integer
$parentId )
Called by start() when workflow execution is initiated.
Reimplementations can use this method to store workflow information to a persistent medium when execution is started.
Parameters
| Name |
Type |
Description |
$parentId |
integer |
|
Redefined in descendants as
doSuspend
void doSuspend(
)
Called by suspend() when workflow execution is suspended.
Reimplementations can use this method to variable and node information to a persistent medium.
Redefined in descendants as
hasEnded
bool hasEnded(
)
Returns true when the workflow execution has ended.
isCancelled
bool isCancelled(
)
Returns true when the workflow execution has been cancelled.
isSuspended
bool isSuspended(
)
Returns true when the workflow execution has been suspended.
loadFromVariableHandlers
void loadFromVariableHandlers(
)
Loads data from variable handlers and merge it with the current execution data.
removeListener
Removes a listener from this execution.
Parameters
removePlugin
Removes a plugin from this execution.
Parameters
resume
void resume(
[
$inputData = array()] )
Resumes workflow execution of a suspended workflow.
$executionId is the id of the execution to resume. $inputData is an associative array of the format array( 'variable name' => value ) that should contain new workflow variable data required to resume execution.
Calls do doResume() before the variables are loaded using the variable handlers.
Parameters
| Name |
Type |
Description |
$inputData |
array |
The new input data. |
Throws
| Class | Description |
ezcWorkflowExecutionException |
if there is no prior ID for this execution. |
ezcWorkflowInvalidInputException |
if the input given does not match the expected data. |
saveToVariableHandlers
void saveToVariableHandlers(
)
Saves data to execution data handlers.
start
mixed start(
[int
$parentId = null] )
Starts the execution of the workflow and returns the execution id.
$parentId is used to specify the execution id of the parent workflow when executing subworkflows. It should not be used when manually starting workflows.
Calls doStart() right before the first node is activated.
Parameters
| Name |
Type |
Description |
$parentId |
int |
|
Throws
| Class | Description |
ezcWorkflowExecutionException |
If no workflow has been set up for execution. |
Last updated: Tue, 23 Mar 2010