Author: sb
Date: Tue Oct 2 16:43:47 2007
New Revision: 6337
Log:
- Better handling of default node configurations.
Modified:
trunk/Workflow/ChangeLog
trunk/Workflow/src/definition_storage/xml.php
trunk/Workflow/src/interfaces/node.php
trunk/Workflow/src/util.php
trunk/WorkflowDatabaseTiein/ChangeLog
trunk/WorkflowDatabaseTiein/src/definition_storage.php
Modified: trunk/Workflow/ChangeLog
==============================================================================
--- trunk/Workflow/ChangeLog [iso-8859-1] (original)
+++ trunk/Workflow/ChangeLog [iso-8859-1] Tue Oct 2 16:43:47 2007
@@ -9,6 +9,7 @@
node classes. This makes it possible to have custom node classes handled by
the XML definition storage.
+- Default node configurations are handled better now.
- Implemented issue #10883: Apply comparison conditions to two variables.
- Implemented issue #10918: Error messages when loading invalid XML.
- Implemented issue #10985: Mapping variables between parent and sub workflows.
Modified: trunk/Workflow/src/definition_storage/xml.php
==============================================================================
--- trunk/Workflow/src/definition_storage/xml.php [iso-8859-1] (original)
+++ trunk/Workflow/src/definition_storage/xml.php [iso-8859-1] Tue Oct 2
16:43:47 2007
@@ -105,15 +105,19 @@
foreach ( $document->getElementsByTagName( 'node' ) as $node )
{
- $id = (int)$node->getAttribute( 'id' );
- $className = 'ezcWorkflowNode' . $node->getAttribute( 'type' );
- $configuration = '';
+ $id = (int)$node->getAttribute( 'id' );
+ $className = 'ezcWorkflowNode' . $node->getAttribute( 'type' );
if ( class_exists( $className ) )
{
$configuration = call_user_func_array(
array( $className, 'configurationFromXML' ), array( $node )
);
+
+ if ( is_null( $configuration ) )
+ {
+ $configuration = ezcWorkflowUtil::getDefaultConfiguration(
$className );
+ }
}
$nodes[$id] = new $className( $configuration );
Modified: trunk/Workflow/src/interfaces/node.php
==============================================================================
--- trunk/Workflow/src/interfaces/node.php [iso-8859-1] (original)
+++ trunk/Workflow/src/interfaces/node.php [iso-8859-1] Tue Oct 2 16:43:47 2007
@@ -162,9 +162,12 @@
*
* @param mixed $configuration
*/
- public function __construct( $configuration = '' )
- {
- $this->configuration = $configuration;
+ public function __construct( $configuration = null )
+ {
+ if ( $configuration !== null )
+ {
+ $this->configuration = $configuration;
+ }
$this->setActivationState( self::WAITING_FOR_ACTIVATION );
$this->initState();
Modified: trunk/Workflow/src/util.php
==============================================================================
--- trunk/Workflow/src/util.php [iso-8859-1] (original)
+++ trunk/Workflow/src/util.php [iso-8859-1] Tue Oct 2 16:43:47 2007
@@ -42,6 +42,27 @@
}
/**
+ * Returns the default configuration for a node class.
+ *
+ * @param string $className
+ * @return mixed
+ */
+ public static function getDefaultConfiguration( $className )
+ {
+ $configuration = null;
+
+ $class = new ReflectionClass( $className );
+ $defaults = $class->getDefaultProperties();
+
+ if ( isset( $defaults['configuration'] ) )
+ {
+ $configuration = $defaults['configuration'];
+ }
+
+ return $configuration;
+ }
+
+ /**
* Returns a compact textual representation of a PHP variable.
*
* @param mixed $variable
Modified: trunk/WorkflowDatabaseTiein/ChangeLog
==============================================================================
--- trunk/WorkflowDatabaseTiein/ChangeLog [iso-8859-1] (original)
+++ trunk/WorkflowDatabaseTiein/ChangeLog [iso-8859-1] Tue Oct 2 16:43:47 2007
@@ -1,3 +1,9 @@
+1.1alpha1 - [RELEASEDATE]
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- Default node configurations are handled better now.
+
+
1.0 - Monday 02 July 2007
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Modified: trunk/WorkflowDatabaseTiein/src/definition_storage.php
==============================================================================
--- trunk/WorkflowDatabaseTiein/src/definition_storage.php [iso-8859-1]
(original)
+++ trunk/WorkflowDatabaseTiein/src/definition_storage.php [iso-8859-1] Tue Oct
2 16:43:47 2007
@@ -97,8 +97,17 @@
// Create node objects.
foreach ( $result as $node )
{
+ $configuration = ezcWorkflowDatabaseUtil::unserialize(
+ $node['node_configuration'], null
+ );
+
+ if ( is_null( $configuration ) )
+ {
+ $configuration = ezcWorkflowUtil::getDefaultConfiguration(
$node['node_class'] );
+ }
+
$nodes[$node['node_id']] = new $node['node_class'](
- ezcWorkflowDatabaseUtil::unserialize(
$node['node_configuration'], '' )
+ $configuration
);
$nodes[$node['node_id']]->setId( $node['node_id'] );
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components