* startNode->addOutNode( $split ); * $nodeExec1 = ....; // create nodes for the first thread of execution here.. * $nodeExec2 = ....; // create nodes for the second thread of execution here.. * * $disc = new ezcWorkflowNodeDiscriminator(); * $disc->addInNode( $nodeExec1 ); * $disc->addInNode( $nodeExec2 ); * $disc->addOutNode( $workflow->endNode ); * ?> * * * @package Workflow * @version //autogen// */ class ezcWorkflowNodeDiscriminator extends ezcWorkflowNodeMerge { /** * Activate this node. * * @param ezcWorkflowExecution $execution * @param ezcWorkflowNode $activatedFrom * @param int $threadId * @ignore */ public function activate( ezcWorkflowExecution $execution, ezcWorkflowNode $activatedFrom = null, $threadId = 0 ) { $this->prepareActivate( $execution, $threadId ); $this->setThreadId( $execution->getParentThreadId( $threadId ) ); $numActivated = count( $this->state['threads'] ); if ( $numActivated == 1 ) { $this->activateNode( $execution, $this->outNodes[0] ); } else if ( $numActivated == $execution->getNumSiblingThreads( $threadId ) ) { parent::activate( $execution, $activatedFrom, $this->threadId ); } $execution->endThread( $threadId ); } /** * Executes this node. * * @param ezcWorkflowExecution $execution * @return boolean true when the node finished execution, * and false otherwise * @ignore */ public function execute( ezcWorkflowExecution $execution ) { $this->initState(); return parent::execute( $execution ); } } ?>