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

### Workflow::ezcWorkflowDefinitionStorageXml

### Class ezcWorkflowDefinitionStorageXml

XML workflow definition storage handler.

The definitions are stored inside the directory specified to the constructor with the name: [workflowName]_[workflowVersion].xml where the name of the workflow has dots and spaces replaced by '_'.

Source for this file: /Workflow/src/definition_storage/xml.php

### Implements interfaces:

- ezcWorkflowDefinitionStorage

Version: | //autogen//
Todo: | DTD for the XML file.

### Member Variables

protected string | `$directory` The directory that holds the XML files.

### Method Summary

public static DOMElement | `conditionToXml( $condition , $document )` "Convert" an ezcWorkflowCondition object into an DOMElement object.
public static DOMElement | `variableToXml( $variable , $document )` "Convert" a PHP variable into an DOMElement object.
public static ezcWorkflowCondition | `xmlToCondition( $element )` "Convert" an DOMElement object into an ezcWorkflowCondition object.
public static mixed | `xmlToVariable( $element )` "Convert" an DOMElement object into a PHP variable.
public ezcWorkflowDefinitionStorageXml | `__construct( [ $directory = ''] )` Constructs a new definition loader that loads definitions from $directory.
protected integer | `getCurrentVersion( $workflowName )` Returns the current version number for a given workflow name.
protected string | `getFilename( $workflowName , $workflowVersion )` Returns the filename with path for given workflow name and version.
protected string | `getFilesystemWorkflowName( $workflowName )` Returns a safe filesystem name for a given workflow.
public ezcWorkflow | `loadByName( $workflowName , [ $workflowVersion = 0] )` Load a workflow definition from a file.
public ezcWorkflow | `loadFromDocument( $document )` Load a workflow definition from a DOMDocument.
public void | `save( $workflow )` Save a workflow definition to a file.
public DOMDocument | `saveToDocument( $workflow , $workflowVersion )` Save a workflow definition to a DOMDocument.

### Methods

#### conditionToXml

static DOMElement conditionToXml( ezcWorkflowCondition $condition , $document )

"Convert" an ezcWorkflowCondition object into an DOMElement object.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$condition` | ezcWorkflowCondition |
`$document` | DOMDocument |

#### variableToXml

static DOMElement variableToXml( mixed $variable , $document )

"Convert" a PHP variable into an DOMElement object.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$variable` | mixed |
`$document` | DOMDocument |

#### xmlToCondition

static ezcWorkflowCondition xmlToCondition( $element )

"Convert" an DOMElement object into an ezcWorkflowCondition object.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$element` | DOMElement |

#### xmlToVariable

static mixed xmlToVariable( $element )

"Convert" an DOMElement object into a PHP variable.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$element` | DOMElement |

#### __construct

ezcWorkflowDefinitionStorageXml __construct( [string $directory = ''] )

Constructs a new definition loader that loads definitions from $directory.

$directory must contain the trailing '/'

##### Parameters:

Name | Type | Description
--- | --- | ---
`$directory` | string | The directory that holds the XML files.

#### getCurrentVersion

integer getCurrentVersion( string $workflowName )

Returns the current version number for a given workflow name.

##### Parameters:

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

#### getFilename

string getFilename( string $workflowName , int $workflowVersion )

Returns the filename with path for given workflow name and version.

The name of the workflow file is of the format [workFlowName]_[workFlowVersion].xml

##### Parameters:

Name | Type | Description
--- | --- | ---
`$workflowName` | string |
`$workflowVersion` | int |

#### getFilesystemWorkflowName

string getFilesystemWorkflowName( string $workflowName )

Returns a safe filesystem name for a given workflow.

This method replaces whitespace and '.' with '_'.

##### Parameters:

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

#### loadByName

ezcWorkflow loadByName( string $workflowName , [int $workflowVersion = 0] )

Load a workflow definition from a file.

When the $workflowVersion argument is omitted, the most recent version is loaded.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$workflowName` | string |
`$workflowVersion` | int |

##### Exceptions:

Type | Description
--- | ---
`ezcWorkflowDefinitionStorageException` |

##### Implementation of:

Method | Description
--- | ---
`ezcWorkflowDefinitionStorage::loadByName()` | Load a workflow definition by name.

#### loadFromDocument

ezcWorkflow loadFromDocument( $document )

Load a workflow definition from a DOMDocument.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$document` | DOMDocument |

#### save

void save( ezcWorkflow $workflow )

Save a workflow definition to a file.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$workflow` | ezcWorkflow |

##### Exceptions:

Type | Description
--- | ---
`ezcWorkflowDefinitionStorageException` |

##### Implementation of:

Method | Description
--- | ---
`ezcWorkflowDefinitionStorage::save()` | Save a workflow definition to the database.

#### saveToDocument

DOMDocument saveToDocument( ezcWorkflow $workflow , int $workflowVersion )

Save a workflow definition to a DOMDocument.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$workflow` | ezcWorkflow |
`$workflowVersion` | int |

Documentation generated by phpDocumentor 1.4.3