PHP Класс ezcWorkflowExecution, Workflow

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.
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$activatedNodes ezcWorkflowNode[] Nodes of the workflow being executed that are activated.
$cancelled boolean Flag that indicates whether or not this execution has been cancelled.
$ended boolean Flag that indicates whether or not this execution has ended.
$id integer Execution ID.
$nextThreadId integer Sequence for thread ids.
$numActivatedEndNodes integer Number of activated end nodes.
$numActivatedNodes integer Number of activated nodes.
$plugins array Plugins registered for this execution.
$properties array(string=>mixed) Container to hold the properties
$resumed boolean Flag that indicates whether or not this execution has been resumed.
$suspended boolean Flag that indicates whether or not this execution has been suspended.
$threads array Nodes of the workflow that started a new thread of execution.
$variables array Workflow variables.
$waitingFor array Workflow variables the execution is waiting for.

Открытые методы

Метод Описание
__get ( string $propertyName ) : mixed Property read access.
__isset ( string $propertyName ) : boolean Property isset access.
__set ( string $propertyName, mixed $val ) Property write access.
activate ( ezcWorkflowNode $node, boolean $notifyPlugins = true ) : boolean Activates a node and returns true if it was activated, false if not.
addListener ( ezcWorkflowExecutionListener $listener ) : boolean Adds a listener to this execution.
addPlugin ( ezcWorkflowExecutionPlugin $plugin ) : boolean Adds a plugin to this execution.
addWaitingFor ( ezcWorkflowNode $node, string $variableName, ezcWorkflowCondition $condition ) Adds a variable that an (input) node is waiting for.
cancel ( ezcWorkflowNode $node = null ) Cancels workflow execution with the node $endNode.
end ( ezcWorkflowNode $node = null ) Ends workflow execution with the node $endNode.
endThread ( integer $threadId ) Ends the thread with id $threadId
getActivatedNodes ( ) : array Returns the activated nodes.
getId ( ) : integer Returns the execution ID.
getNumSiblingThreads ( integer $threadId ) : integer Returns the number of siblings for a given thread.
getParentThreadId ( integer $threadId ) : integer Returns the id of the parent thread for a given thread.
getSubExecution ( integer $id = null, boolean $interactive = true ) : ezcWorkflowExecution Returns a new execution object for a sub workflow.
getVariable ( string $variableName ) Returns a variable.
getVariables ( ) : array Returns the variables.
getWaitingFor ( ) : array Returns the variables that (input) nodes are waiting for.
hasEnded ( ) : boolean Returns true when the workflow execution has ended.
hasVariable ( string $variableName ) : boolean Checks whether or not a workflow variable has been set.
isCancelled ( ) : boolean Returns true when the workflow execution has been cancelled.
isResumed ( ) : boolean Returns true when the workflow execution has been resumed.
isSuspended ( ) : boolean Returns true when the workflow execution has been suspended.
removeListener ( ezcWorkflowExecutionListener $listener ) : boolean Removes a listener from this execution.
removePlugin ( ezcWorkflowExecutionPlugin $plugin ) : boolean Removes a plugin from this execution.
resume ( array $inputData = [] ) Resumes workflow execution of a suspended workflow.
setVariable ( string $variableName, mixed $value ) : mixed Sets a variable.
setVariables ( array $variables ) Sets the variables.
start ( integer $parentId = null ) : mixed Starts the execution of the workflow and returns the execution id.
startThread ( integer $parentId = null, integer $numSiblings = 1 ) : integer Start a new thread and returns the id of the new thread.
suspend ( ) Suspends workflow execution.
unsetVariable ( string $variableName ) : true, Unsets a variable.

Защищенные методы

Метод Описание
doEnd ( ) Called by end() when workflow execution is ended.
doGetSubExecution ( integer $id = null ) : ezcWorkflowExecution Returns a new execution object for a sub workflow.
doResume ( ) Called by resume() when workflow execution is resumed.
doStart ( integer $parentId ) Called by start() when workflow execution is initiated.
doSuspend ( ) Called by suspend() when workflow execution is suspended.
execute ( ) The workflow engine's main execution loop. It is started by start() and resume().
loadFromVariableHandlers ( ) Loads data from variable handlers and merge it with the current execution data.
saveToVariableHandlers ( ) Saves data to execution data handlers.

Описание методов

__get() публичный Метод

Property read access.
public __get ( string $propertyName ) : mixed
$propertyName string Name of the property.
Результат mixed Value of the property or null.

__isset() публичный Метод

Property isset access.
public __isset ( string $propertyName ) : boolean
$propertyName string Name of the property.
Результат boolean True is the property is set, otherwise false.

__set() публичный Метод

Property write access.
public __set ( string $propertyName, mixed $val )
$propertyName string Name of the property.
$val mixed The value for the property.

activate() публичный Метод

The node will only be activated if the node is executable. See {@link ezcWorkflowNode::isExecutable()}.
public activate ( ezcWorkflowNode $node, boolean $notifyPlugins = true ) : boolean
$node ezcWorkflowNode
$notifyPlugins boolean
Результат boolean

addListener() публичный Метод

Adds a listener to this execution.
public addListener ( ezcWorkflowExecutionListener $listener ) : boolean
$listener ezcWorkflowExecutionListener
Результат boolean true when the listener was added, false otherwise.

addPlugin() публичный Метод

Adds a plugin to this execution.
public addPlugin ( ezcWorkflowExecutionPlugin $plugin ) : boolean
$plugin ezcWorkflowExecutionPlugin
Результат boolean true when the plugin was added, false otherwise.

addWaitingFor() публичный Метод

Adds a variable that an (input) node is waiting for.
public addWaitingFor ( ezcWorkflowNode $node, string $variableName, ezcWorkflowCondition $condition )
$node ezcWorkflowNode
$variableName string
$condition ezcWorkflowCondition

cancel() публичный Метод

Cancels workflow execution with the node $endNode.
public cancel ( ezcWorkflowNode $node = null )
$node ezcWorkflowNode

doEnd() абстрактный защищенный Метод

Reimplementations can use this method to remove execution data from the persistent medium.
abstract protected doEnd ( )

doGetSubExecution() абстрактный защищенный Метод

Called by getSubExecution to get a new execution environment for the new execution thread. Reimplementations must return a new execution environment similar to themselves.
abstract protected doGetSubExecution ( integer $id = null ) : ezcWorkflowExecution
$id integer
Результат ezcWorkflowExecution

doResume() абстрактный защищенный Метод

Reimplementations can use this method to fetch execution data if necessary..
abstract protected doResume ( )

doStart() абстрактный защищенный Метод

Reimplementations can use this method to store workflow information to a persistent medium when execution is started.
abstract protected doStart ( integer $parentId )
$parentId integer

doSuspend() абстрактный защищенный Метод

Reimplementations can use this method to variable and node information to a persistent medium.
abstract protected doSuspend ( )

end() публичный Метод

End nodes must call this method to end the execution.
public end ( ezcWorkflowNode $node = null )
$node ezcWorkflowNode

endThread() публичный Метод

Ends the thread with id $threadId
public endThread ( integer $threadId )
$threadId integer

execute() защищенный Метод

The workflow engine's main execution loop. It is started by start() and resume().
protected execute ( )

getActivatedNodes() публичный Метод

Returns the activated nodes.
public getActivatedNodes ( ) : array
Результат array

getId() публичный Метод

Returns the execution ID.
public getId ( ) : integer
Результат integer

getNumSiblingThreads() публичный Метод

Returns the number of siblings for a given thread.
public getNumSiblingThreads ( integer $threadId ) : integer
$threadId integer The id of the thread for which to return the number of siblings.
Результат integer

getParentThreadId() публичный Метод

Returns the id of the parent thread for a given thread.
public getParentThreadId ( integer $threadId ) : integer
$threadId integer The id of the thread for which to return the parent thread id.
Результат integer

getSubExecution() публичный Метод

If this method is used to resume a subworkflow you must provide the execution id through $id. If $interactive is false an ezcWorkflowExecutionNonInteractive will be returned. This method can be used by nodes implementing sub-workflows to get a new execution environment for the subworkflow.
public getSubExecution ( integer $id = null, boolean $interactive = true ) : ezcWorkflowExecution
$id integer
$interactive boolean
Результат ezcWorkflowExecution

getVariable() публичный Метод

Returns a variable.
public getVariable ( string $variableName )
$variableName string

getVariables() публичный Метод

Returns the variables.
public getVariables ( ) : array
Результат array

getWaitingFor() публичный Метод

Returns the variables that (input) nodes are waiting for.
public getWaitingFor ( ) : array
Результат array

hasEnded() публичный Метод

Returns true when the workflow execution has ended.
public hasEnded ( ) : boolean
Результат boolean

hasVariable() публичный Метод

Checks whether or not a workflow variable has been set.
public hasVariable ( string $variableName ) : boolean
$variableName string
Результат boolean true when the variable exists and false otherwise.

isCancelled() публичный Метод

Returns true when the workflow execution has been cancelled.
public isCancelled ( ) : boolean
Результат boolean

isResumed() публичный Метод

Returns true when the workflow execution has been resumed.
public isResumed ( ) : boolean
Результат boolean

isSuspended() публичный Метод

Returns true when the workflow execution has been suspended.
public isSuspended ( ) : boolean
Результат boolean

loadFromVariableHandlers() защищенный Метод

Loads data from variable handlers and merge it with the current execution data.
protected loadFromVariableHandlers ( )

removeListener() публичный Метод

Removes a listener from this execution.
public removeListener ( ezcWorkflowExecutionListener $listener ) : boolean
$listener ezcWorkflowExecutionListener
Результат boolean true when the listener was removed, false otherwise.

removePlugin() публичный Метод

Removes a plugin from this execution.
public removePlugin ( ezcWorkflowExecutionPlugin $plugin ) : boolean
$plugin ezcWorkflowExecutionPlugin
Результат boolean true when the plugin was removed, false otherwise.

resume() публичный Метод

$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.
public resume ( array $inputData = [] )
$inputData array The new input data.

saveToVariableHandlers() защищенный Метод

Saves data to execution data handlers.
protected saveToVariableHandlers ( )

setVariable() публичный Метод

Sets a variable.
public setVariable ( string $variableName, mixed $value ) : mixed
$variableName string
$value mixed
Результат mixed the value that the variable has been set to

setVariables() публичный Метод

Sets the variables.
public setVariables ( array $variables )
$variables array

start() публичный Метод

$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.
public start ( integer $parentId = null ) : mixed
$parentId integer
Результат mixed Execution ID if the workflow has been suspended, null otherwise.

startThread() публичный Метод

Start a new thread and returns the id of the new thread.
public startThread ( integer $parentId = null, integer $numSiblings = 1 ) : integer
$parentId integer The id of the parent thread.
$numSiblings integer The number of threads that are started by the same node.
Результат integer

suspend() публичный Метод

This method is usually called by the execution environment when there are no more more activated nodes that can be executed. This is commonly the case with input nodes waiting for input. This method calls doSuspend() before calling saveToVariableHandlers() allowing reimplementations to save variable and node information.
public suspend ( )

unsetVariable() публичный Метод

Unsets a variable.
public unsetVariable ( string $variableName ) : true,
$variableName string
Результат true,

Описание свойств

$activatedNodes защищенное свойство

Nodes of the workflow being executed that are activated.
protected ezcWorkflowNode[] $activatedNodes
Результат ezcWorkflowNode[]

$cancelled защищенное свойство

Flag that indicates whether or not this execution has been cancelled.
protected bool $cancelled
Результат boolean

$ended защищенное свойство

Flag that indicates whether or not this execution has ended.
protected bool $ended
Результат boolean

$id защищенное свойство

Execution ID.
protected int $id
Результат integer

$nextThreadId защищенное свойство

Sequence for thread ids.
protected int $nextThreadId
Результат integer

$numActivatedEndNodes защищенное свойство

Number of activated end nodes.
protected int $numActivatedEndNodes
Результат integer

$numActivatedNodes защищенное свойство

Number of activated nodes.
protected int $numActivatedNodes
Результат integer

$plugins защищенное свойство

Plugins registered for this execution.
protected array $plugins
Результат array

$properties защищенное свойство

Container to hold the properties
protected array(string=>mixed) $properties
Результат array(string=>mixed)

$resumed защищенное свойство

Flag that indicates whether or not this execution has been resumed.
protected bool $resumed
Результат boolean

$suspended защищенное свойство

Flag that indicates whether or not this execution has been suspended.
protected bool $suspended
Результат boolean

$threads защищенное свойство

Nodes of the workflow that started a new thread of execution.
protected array $threads
Результат array

$variables защищенное свойство

Workflow variables.
protected array $variables
Результат array

$waitingFor защищенное свойство

Workflow variables the execution is waiting for.
protected array $waitingFor
Результат array