mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-20 23:00:16 -05:00
BusinessProcess,Node: new helper methods
Mostly (but not only) useful for tests
This commit is contained in:
parent
656a5ada0e
commit
4506181f0c
2 changed files with 36 additions and 0 deletions
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue