Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcWorkflowExecution

Workflow::ezcWorkflowExecution

Class ezcWorkflowExecution

Abstract base class for workflow execution engines.

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.

Source for this file: /Workflow/src/interfaces/execution.php

Version:   //autogen//

Descendants

Child Class Description
ezcWorkflowDatabaseExecution Workflow executer that suspends and resumes workflow execution states to and from a database.
ezcWorkflowExecutionNonInteractive Workflow execution engine for non-interactive workflows.

Properties

ezcWorkflowDefinitonStorage read/write $definitionStorage
The definition handler used to fetch subworkflows if needed.
ezcWorkflow read/write $workflow
The workflow being executed.

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

bool addListener( ezcWorkflowExecutionListener $listener )

Adds a listener to this execution.

Parameters:
Name Type Description
$listener ezcWorkflowExecutionListener

addPlugin

bool addPlugin( ezcWorkflowExecutionPlugin $plugin )

Adds a plugin to this execution.

Parameters:
Name Type Description
$plugin ezcWorkflowExecutionPlugin

cancel

void cancel( [ezcWorkflowNode $node = null] )

Cancels workflow execution with the node $endNode.

Parameters:
Name Type Description
$node ezcWorkflowNode

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:
Method Description
ezcWorkflowDatabaseExecution::doEnd() End workflow execution. 
ezcWorkflowExecutionNonInteractive::doEnd() End workflow execution. 

doGetSubExecution

ezcWorkflowExecution doGetSubExecution( [int $id = null] )

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:
Method Description
ezcWorkflowDatabaseExecution::doGetSubExecution() Returns a new execution object for a sub workflow. 
ezcWorkflowExecutionNonInteractive::doGetSubExecution() Returns a new execution object for a sub workflow. 

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:
Method Description
ezcWorkflowDatabaseExecution::doResume() Resume workflow execution. 
ezcWorkflowExecutionNonInteractive::doResume() Resume workflow execution. 

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:
Method Description
ezcWorkflowDatabaseExecution::doStart() Start workflow execution. 
ezcWorkflowExecutionNonInteractive::doStart() Start workflow execution. 

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:
Method Description
ezcWorkflowDatabaseExecution::doSuspend() Suspend workflow execution. 
ezcWorkflowExecutionNonInteractive::doSuspend() Suspend workflow execution. 

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

bool removeListener( ezcWorkflowExecutionListener $listener )

Removes a listener from this execution.

Parameters:
Name Type Description
$listener ezcWorkflowExecutionListener

removePlugin

bool removePlugin( ezcWorkflowExecutionPlugin $plugin )

Removes a plugin from this execution.

Parameters:
Name Type Description
$plugin ezcWorkflowExecutionPlugin

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.
Exceptions:
Type 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
Exceptions:
Type Description
ezcWorkflowExecutionException If no workflow has been set up for execution.
Documentation generated by phpDocumentor 1.4.3