diff --git a/library/Businessprocess/BusinessProcess.php b/library/Businessprocess/BusinessProcess.php index 6e89b57..88989c2 100644 --- a/library/Businessprocess/BusinessProcess.php +++ b/library/Businessprocess/BusinessProcess.php @@ -468,6 +468,26 @@ class BusinessProcess return $node; } + /** + * Create and attach a new process (BpNode) + * + * @param string $name Process name + * @param string $operator Operator (defaults to &) + * + * @return BpNode + */ + public function createBp($name, $operator = '&') + { + $node = new BpNode($this, (object) array( + 'name' => $name, + 'operator' => $operator, + 'child_names' => array(), + )); + + $this->addNode($name, $node); + return $node; + } + public function createImportedNode($config, $name) { $node = new ImportedNode($this, (object) array('name' => $name, 'configName' => $config)); @@ -475,6 +495,11 @@ class BusinessProcess return $node; } + /** + * @param $name + * @return Node + * @throws Exception + */ public function getNode($name) { if (array_key_exists($name, $this->nodes)) { diff --git a/library/Businessprocess/Node.php b/library/Businessprocess/Node.php index fba675b..6636db8 100644 --- a/library/Businessprocess/Node.php +++ b/library/Businessprocess/Node.php @@ -163,6 +163,17 @@ abstract class Node return $this; } + /** + * Forget my state + * + * @return $this + */ + public function clearState() + { + $this->state = null; + return $this; + } + public function setAck($ack = true) { $this->ack = $ack;