## Apache Zeta Components Manual :: Docs For Class ezcWorkflow

### Workflow::ezcWorkflow

### Class ezcWorkflow

Class representing a workflow.

Source for this file: /Workflow/src/workflow.php

### Implements interfaces:

- Countable (internal interface)
- ezcWorkflowVisitable

Version: | //autogen//

### Properties

ezcWorkflowDefinitonStorage | read/write | `$definitionStorage` The definition handler used to fetch sub workflows on demand. This property is set automatically if you load a workflow using a workflow definition storage.
ezcWorkflowNodeEnd | read | `$endNode` The default end node of the workflow.
ezcWorkflowNodeFinally | read | `$finallyNode` The start of a node sequence that is executed when a workflow execution is cancelled.
int | read/write | `$id` Unique ID set automatically by the definition handler when the workflow is stored.
string | read/write | `$name` A unique name (accross the system) for this workflow.
array(ezcWorkflowNode) | read | `$nodes` All the nodes of this workflow.
ezcWorkflowNodeStart | read | `$startNode` The unique start node of the workflow.
int | read/write | `$version` The version of the workflow. This must be incremented manually whenever you want a new version.

### Member Variables

protected array(string=>mixed) | `$properties = array( 'definitionStorage' => null, 'id' => false, 'name' => '', 'startNode' => null, 'endNode' => null, 'finallyNode' => null, 'version' => 1 )` Container to hold the properties
protected array | `$variableHandlers = array()` The variable handlers of this workflow.

### Method Summary

public ezcWorkflow | `__construct( $name , [ $startNode = null] , [ $endNode = null] , [ $finallyNode = null] )` Constructs a new workflow object with the name $name.
public void | `accept( $visitor )` Overridden implementation of accept() calls accept on the start node.
public void | `addVariableHandler( $variableName , $className )` Sets the class $className to handle the variable named $variableName.
public integer | `count( )` Returns the number of nodes of this workflow.
public array | `getVariableHandlers( )` Returns the variable handlers.
public boolean | `hasSubWorkflows( )` Returns true when the workflow has sub workflows (ie. when it contains ezcWorkflowNodeSubWorkflow nodes) and false otherwise.
public boolean | `isInteractive( )` Returns true when the workflow requires user interaction (ie. when it contains ezcWorkflowNodeInput nodes) and false otherwise.
public boolean | `removeVariableHandler( $variableName )` Removes the handler for $variableName and returns true on success.
public void | `reset( )` Resets the nodes of this workflow.
public void | `setVariableHandlers( $variableHandlers )` Sets handlers for multiple variables.
public void | `verify( )` Verifies the specification of this workflow.

### Methods

#### __construct

ezcWorkflow __construct( string $name , [ezcWorkflowNodeStart $startNode = null] , [ezcWorkflowNodeEnd $endNode = null] , [ezcWorkflowNodeFinally $finallyNode = null] )

Constructs a new workflow object with the name $name.

Use $startNode and $endNode parameters if you don't want to use the default start and end nodes.

$name must uniquely identify the workflow within the system.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$name` | string | The name of the workflow.
`$startNode` | ezcWorkflowNodeStart | The start node of the workflow.
`$endNode` | ezcWorkflowNodeEnd | The default end node of the workflow.
`$finallyNode` | ezcWorkflowNodeFinally | The start of a node sequence that is executed when a workflow execution is cancelled.

#### accept

void accept( ezcWorkflowVisitor $visitor )

Overridden implementation of accept() calls accept on the start node.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$visitor` | ezcWorkflowVisitor |

##### Implementation of:

Method | Description
--- | ---
`ezcWorkflowVisitable::accept()` | Accepts the visitor.

#### addVariableHandler

void addVariableHandler( string $variableName , string $className )

Sets the class $className to handle the variable named $variableName.

$className must be the name of a class implementing the ezcWorkflowVariableHandler interface.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$variableName` | string |
`$className` | string |

##### Exceptions:

Type | Description
--- | ---
`ezcWorkflowInvalidWorkflowException` | if $className does not contain the name of a valid class implementing ezcWorkflowVariableHandler

#### count

integer count( )

Returns the number of nodes of this workflow.

##### Implementation of:

Method | Description
--- | ---
`Countable::count` |

#### getVariableHandlers

array getVariableHandlers( )

Returns the variable handlers.

The format of the returned array is array( 'variableName' => ezcWorkflowVariableHandler )

#### hasSubWorkflows

boolean hasSubWorkflows( )

Returns true when the workflow has sub workflows (ie. when it contains ezcWorkflowNodeSubWorkflow nodes) and false otherwise.

#### isInteractive

boolean isInteractive( )

Returns true when the workflow requires user interaction (ie. when it contains ezcWorkflowNodeInput nodes) and false otherwise.

#### removeVariableHandler

boolean removeVariableHandler( string $variableName )

Removes the handler for $variableName and returns true on success.

Returns false if no handler was set for $variableName.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$variableName` | string |

#### reset

void reset( )

Resets the nodes of this workflow.

See the documentation of ezcWorkflowVisitorReset for details.

#### setVariableHandlers

void setVariableHandlers( $variableHandlers )

Sets handlers for multiple variables.

The format of $variableHandlers is array( 'variableName' => ezcWorkflowVariableHandler )

##### Parameters:

Name | Type | Description
--- | --- | ---
`$variableHandlers` | array |

##### Exceptions:

Type | Description
--- | ---
`ezcWorkflowInvalidWorkflowException` | if $className does not contain the name of a valid class implementing ezcWorkflowVariableHandler

#### verify

void verify( )

Verifies the specification of this workflow.

See the documentation of ezcWorkflowVisitorVerification for details.

##### Exceptions:

Type | Description
--- | ---
`ezcWorkflowInvalidWorkflowException` | if the specification of this workflow is not correct.

Documentation generated by phpDocumentor 1.4.3