public function addStep(Ezer_Step &$step) { // overwrite any flow definition $step->in_flows = array(); $step->out_flows = array(); $sources = $step->getSources(); if ($sources && is_array($sources) && count($sources)) { foreach ($sources as $source) { $source_name = $source->getStepName(); $source_step =& $this->getStep($source_name); if ($source_step) { $source_step->setOutFlow($step); $step->setInFlow($source_step); } } } $targets = $step->getTargets(); if ($targets && is_array($targets) && count($targets)) { foreach ($targets as $target) { $target_name = $target->getStepName(); $target_step =& $this->getStep($target_name); if ($target_step) { $target_step->setInFlow($step); $step->setOutFlow($target_step); } } } parent::addStep($step); }
public function add(Ezer_Step &$step) { // overwrite any flow definition $step->in_flows = array(); $step->out_flows = array(); $sources = $step->getSources(); if ($sources && $sources instanceof Ezer_Array) { $arr_sources = (array) $sources; foreach ($arr_sources as $source) { $source_name = $source->getStepName(); $source_step =& $this->getStep($source_name); if ($source_step) { $source_step->setOutFlow($step); $step->setInFlow($source_step); } } } $targets = $step->getTargets(); if ($targets && $targets instanceof Ezer_Array) { $arr_targets = (array) $targets; foreach ($arr_targets as $target) { $target_name = $target->getStepName(); $target_step =& $this->getStep($target_name); if ($target_step) { $target_step->setInFlow($step); $step->setOutFlow($target_step); } } } parent::add($step); }
public function addStep(Ezer_Step &$step) { if (count($this->steps)) { throw new Ezer_TooManyStepsException(get_class($this)); } // overwrite any flow definition $step->in_flows = array(); $step->out_flows = array(); parent::addStep($step); }
public function addStep(Ezer_Step &$step) { // overwrite any flow definition $step->in_flows = array(); $step->out_flows = array(); if (count($this->steps)) { throw new Ezer_SyntaxException('Foreach object can contain only one step [' . $step->getName() . ']'); } parent::addStep($step); }
public function addStep(Ezer_Step &$step) { // overwrite any flow definition $step->in_flows = array(); $step->out_flows = array(); parent::addStep($step); $last_index = count($this->steps) - 1; if ($last_index <= 0) { return; } $last_step =& $this->steps[$last_index]; $prev_step =& $this->steps[$last_index - 1]; $last_step->in_flows[$prev_step->id] = $prev_step; $prev_step->out_flows[$last_step->id] = $last_step; }
public function add(Ezer_Step $value) { // overwrite any flow definition $value->in_flows = array(); $value->out_flows = array(); if ($value instanceof Ezer_If) { $value->canElse = false; $this->elseifs[] = $value; return; } if ($value instanceof Ezer_Else) { if (!$value->canElse) { throw new Ezer_SyntaxException('ElseIf object can not contain Else object'); } $this->else = $value; return; } if (count($this->steps)) { throw new Ezer_SyntaxException('If object can contain only on step'); } parent::add($value); }
public static function parse(Ezer_StepContainer $stepContainer, DOMElement $element) { $stepContainer->setName($element->getAttribute('name')); for ($i = 0; $i < $element->childNodes->length; $i++) { $childElement = $element->childNodes->item($i); if ($childElement->parentNode !== $element) { continue; } if ($childElement instanceof DOMComment || $childElement instanceof DOMText) { continue; } switch ($childElement->nodeName) { case 'import': // ignore, relevant for process only break; case 'variables': // ignore, relevant for scope only break; case 'condition': case 'else': case 'elseif': // ignore, relevant for if only break; case 'flow': $stepContainer->addStep(new Ezer_XmlFlow($childElement)); break; case 'sequence': $stepContainer->addStep(new Ezer_XmlSequence($childElement)); break; case 'activity': $stepContainer->addStep(new Ezer_XmlActivityStep($childElement)); break; case 'assign': $stepContainer->addStep(new Ezer_XmlAssignStep($childElement)); break; case 'if': $stepContainer->addStep(new Ezer_XmlIf($childElement)); break; case 'foreach': // TODO - implement foreach // TODO - implement foreach case 'repeatUntil': // TODO - implement repeatUntil // TODO - implement repeatUntil case 'while': // TODO - implement while // TODO - implement while case 'switch': // TODO - implement switch // TODO - implement switch case 'empty': // TODO - implement empty // TODO - implement empty case 'wait': // TODO - implement wait // TODO - implement wait case 'terminate': // TODO - implement terminate // TODO - implement terminate case 'throw': // TODO - implement throw // TODO - implement throw case 'rethrow': // TODO - implement rethrow // TODO - implement rethrow default: throw new Ezer_XmlPersistanceElementNotMappedException($childElement->nodeName); } } }
public static function load(Ezer_StepContainer $stepContainer, Ezer_IntStepContainer $container) { $stepContainer->setName($container->getName()); $steps = $container->getSteps(); foreach ($steps as $step) { switch ($step->getType()) { case Ezer_IntStep::STEP_TYPE_SCOPE: $stepContainer->addStep(new Ezer_DbScope($step)); break; case Ezer_IntStep::STEP_TYPE_FLOW: $stepContainer->addStep(new Ezer_DbFlow($step)); break; case Ezer_IntStep::STEP_TYPE_SEQUENCE: $stepContainer->addStep(new Ezer_DbSequence($step)); break; case Ezer_IntStep::STEP_TYPE_ACTIVITY: $stepContainer->addStep(new Ezer_DbActivityStep($step)); break; case Ezer_IntStep::STEP_TYPE_ASSIGN: $stepContainer->addStep(new Ezer_DbAssignStep($step)); break; case Ezer_IntStep::STEP_TYPE_IF: if ($stepContainer instanceof Ezer_If) { $stepContainer->addElseIf(new Ezer_DbIf($step)); } else { $stepContainer->addStep(new Ezer_DbIf($step)); } break; case Ezer_IntStep::STEP_TYPE_ELSE: if ($stepContainer instanceof Ezer_If) { $stepContainer->setElse(new Ezer_DbElse($step)); } break; case Ezer_IntStep::STEP_TYPE_FOREACH: $stepContainer->addStep(new Ezer_DbForeach($step)); break; // case Ezer_IntStep::STEP_TYPE_REPEAT_UNTIL: // $stepContainer->addStep(new Ezer_DbRepeatUntil($step)); // break; // // case Ezer_IntStep::STEP_TYPE_WHILE: // $stepContainer->addStep(new Ezer_DbWhile($step)); // break; // // case Ezer_IntStep::STEP_TYPE_SWITCH: // $stepContainer->addStep(new Ezer_DbSwitch($step)); // break; // // case Ezer_IntStep::STEP_TYPE_EMPTY: // $stepContainer->addStep(new Ezer_DbEmpty($step)); // break; // // case Ezer_IntStep::STEP_TYPE_WAIT: // $stepContainer->addStep(new Ezer_DbWait($step)); // break; // // case Ezer_IntStep::STEP_TYPE_TERMINATE: // $stepContainer->addStep(new Ezer_DbTerminate($step)); // break; // // case Ezer_IntStep::STEP_TYPE_THROW: // $stepContainer->addStep(new Ezer_DbThrow($step)); // break; // // case Ezer_IntStep::STEP_TYPE_RETHROW: // $stepContainer->addStep(new Ezer_DbRethrow($step)); // break; } } }