Permalink
Browse files

Initial import

  • Loading branch information...
0 parents commit 23558fcb56cdd2f79ae0fcab6e1caed485de022b @lorenzo committed Jul 31, 2009
Showing 392 changed files with 28,011 additions and 0 deletions.
No changes.
@@ -0,0 +1,62 @@
+CREATE TABLE workflow_workflows (
+ id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+ name VARCHAR(32) NOT NULL,
+ version INTEGER UNSIGNED NOT NULL DEFAULT 1,
+ created INTEGER NOT NULL,
+
+ PRIMARY KEY (id),
+ UNIQUE KEY name_version (name, version)
+) ENGINE=InnoDB;
+
+CREATE TABLE workflow_nodes (
+ id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+ workflow_id INTEGER UNSIGNED NOT NULL REFERENCES workflow_workflows.id,
+ class VARCHAR(255) NOT NULL,
+ configuration TEXT NOT NULL,
+
+ PRIMARY KEY (id),
+ KEY workflow_id (workflow_id)
+) ENGINE=InnoDB;
+
+CREATE TABLE workflow_node_connections (
+ incoming_node_id INTEGER UNSIGNED NOT NULL,
+ outgoing_node_id INTEGER UNSIGNED NOT NULL,
+
+ KEY incoming_node_id (incoming_node_id)
+) ENGINE=InnoDB;
+
+CREATE TABLE workflow_variable_handlers (
+ id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+ workflow_id INTEGER UNSIGNED NOT NULL REFERENCES workflow_workflows.id,
+ variable VARCHAR(255) NOT NULL,
+ class VARCHAR(255) NOT NULL,
+
+ PRIMARY KEY (id),
+ UNIQUE KEY (workflow_id, class)
+) ENGINE=InnoDB;
+
+CREATE TABLE workflow_executions (
+ id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+ workflow_id INTEGER UNSIGNED NOT NULL REFERENCES workflow_workflows.id,
+ parent_id INTEGER UNSIGNED NOT NULL REFERENCES workflow_executions.id,
+ started TINYINT(1) NOT NULL,
+ variables TEXT NOT NULL,
+ waiting_for TEXT NOT NULL,
+ threads TEXT NOT NULL,
+ next_thread_id INTEGER UNSIGNED NOT NULL,
+
+ PRIMARY KEY (id),
+ KEY execution_parent (parent_id)
+) ENGINE=InnoDB;
+
+CREATE TABLE workflow_execution_states (
+ id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+ execution_id INTEGER UNSIGNED NOT NULL REFERENCES workflow_executions.id,
+ node_id INTEGER UNSIGNED NOT NULL REFERENCES workflow_nodes.id,
+ state TEXT NOT NULL,
+ activated_from TEXT NOT NULL,
+ thread_id INTEGER UNSIGNED NOT NULL,
+
+ PRIMARY KEY (id),
+ UNIQUE KEY (execution_id, node_id)
+) ENGINE=InnoDB;
@@ -0,0 +1,57 @@
+<?php
+
+class TestsController extends WorkFlowAppController {
+
+ var $uses = array();
+
+ function index() {
+ $workflow = new ezcWorkflow( 'Test' );
+ $input = new ezcWorkflowNodeInput(
+ array( 'choice' => new ezcWorkflowConditionIsBool )
+ );
+ // Add the previously created Input node
+ // as an outgoing node to the start node.
+ $workflow->startNode->addOutNode( $input );
+ #
+ // Create a new Exclusive Choice node and add it as an
+ // outgoing node to the previously created Input node.
+ // This node will choose which output to run based on the
+ // choice workflow variable.
+ $branch = new ezcWorkflowNodeExclusiveChoice;
+ $branch->addInNode( $input );
+ #
+ // Either $true or $false will be run depending on
+ // the above choice.
+ // Note that neither $true nor $false are valid action nodes.
+ // see the next example
+ $trueNode = new ezcWorkflowNodeAction( 'PrintTrue' );
+ $falseNode = new ezcWorkflowNodeAction( 'PrintFalse' );
+ #
+ // Branch
+ // Condition: Variable "choice" has boolean value "true".
+ // Action: PrintTrue service object.
+ $branch->addConditionalOutNode(
+ new ezcWorkflowConditionVariable( 'choice', new ezcWorkflowConditionIsTrue ),
+ $trueNode );
+ #
+ // Branch
+ // Condition: Variable "choice" has boolean value "false".
+ // Action: PrintFalse service object.
+ $branch->addConditionalOutNode(
+ new ezcWorkflowConditionVariable( 'choice', new ezcWorkflowConditionIsFalse ),
+ $falseNode
+ );
+ #
+ // Create SimpleMerge node and add the two possible threads of
+ // execution as incoming nodes of the end node.
+ $merge = new ezcWorkflowNodeSimpleMerge;
+ $merge->addInNode( $trueNode );
+ $merge->addInNode( $falseNode );
+ $merge->addOutNode( $workflow->endNode );
+ // Set up workflow definition storage (XML).
+ $definition = new ezcWorkflowDefinitionStorageXml( TMP );
+ #
+ // Save workflow definition to database.
+ $definition->save( $workflow );
+ }
+}
@@ -0,0 +1,53 @@
+<?php
+class WorkflowExecution extends WorkflowAppModel {
+ var $name = 'WorkflowExecution';
+ //The Associations below have been created with all possible keys, those that are not needed can be removed
+
+ var $belongsTo = array(
+ 'Workflow' => array(
+ 'className' => 'Workflow.WorkflowWorkflow',
+ 'foreignKey' => 'workflow_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ ),
+ 'ParentWorkflowExecution' => array(
+ 'className' => 'Workflow.WorkflowExecution',
+ 'foreignKey' => 'parent_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ )
+ );
+
+ var $hasMany = array(
+ 'ChildWorkflowExecution' => array(
+ 'className' => 'Workflow.WorkflowExecution',
+ 'foreignKey' => 'parent_id',
+ 'dependent' => true,
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => '',
+ 'limit' => '',
+ 'offset' => '',
+ 'exclusive' => true,
+ 'finderQuery' => '',
+ 'counterQuery' => ''
+ ),
+ 'State' => array(
+ 'className' => 'Workflow.WorkflowExecutionState',
+ 'foreignKey' => 'execution_id',
+ 'dependent' => true,
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => '',
+ 'limit' => '',
+ 'offset' => '',
+ 'exclusive' => true,
+ 'finderQuery' => '',
+ 'counterQuery' => ''
+ )
+ );
+
+}
+?>
@@ -0,0 +1,25 @@
+<?php
+class WorkflowNode extends WorkflowAppModel {
+ var $name = 'WorkflowNode';
+ //The Associations below have been created with all possible keys, those that are not needed can be removed
+
+ var $belongsTo = array(
+ 'Workflow' => array(
+ 'className' => 'Workflow.WorkflowWorkflow',
+ 'foreignKey' => 'workflow_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ )
+ );
+
+ var $hasAndBelongsToMany = array(
+ 'OutNode' => array(
+ 'className' => 'Workflow.WorkflowNode',
+ 'foreignKey' => 'incoming_node_id',
+ 'associationForeignKey' => 'outgoing_node_id',
+ 'with' => 'workflow.WorkflowNodeConnection'
+ )
+ );
+}
+?>
@@ -0,0 +1,26 @@
+<?php
+class WorkflowNodeConnection extends WorkflowAppModel {
+ var $name = 'WorkflowNodeConnection';
+ var $primaryKey = false;
+ //The Associations below have been created with all possible keys, those that are not needed can be removed
+
+ var $belongsTo = array(
+ 'IncomingNode' => array(
+ 'className' => 'Workflow.WorkflowNode',
+ 'foreignKey' => 'incoming_node_id',
+ 'type' => 'INNER',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ ),
+ 'OutgoingNode' => array(
+ 'className' => 'Workflow.WorkflowNode',
+ 'foreignKey' => 'outgoing_node_id',
+ 'type' => 'INNER',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ )
+ );
+}
+?>
@@ -0,0 +1,16 @@
+<?php
+class WorkflowVariableHandler extends WorkflowAppModel {
+ var $name = 'WorkflowVariableHandler';
+ //The Associations below have been created with all possible keys, those that are not needed can be removed
+
+ var $belongsTo = array(
+ 'Workflow' => array(
+ 'className' => 'Workflow.WorkflowWorkflow',
+ 'foreignKey' => 'workflow_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ )
+ );
+}
+?>
@@ -0,0 +1,16 @@
+<?php
+App::import('Model','workflow.WorkFlowWorkflow');
+class WorkflowWorkflowStorage extends WorkflowWorkFlow Implements ezcWorkflowDefinitionStorage {
+ var $name = 'WorkflowWorkflowStorage';
+ var $useTable = false;
+ //The Associations below have been created with all possible keys, those that are not needed can be removed
+
+ function save(ezcWorlflow $workflow) {
+
+ }
+
+ function loadByName($name,$version = 0) {
+
+ }
+}
+?>
Oops, something went wrong.

0 comments on commit 23558fc

Please sign in to comment.