mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-24 08:39:34 -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;
|
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)
|
public function createImportedNode($config, $name)
|
||||||
{
|
{
|
||||||
$node = new ImportedNode($this, (object) array('name' => $name, 'configName' => $config));
|
$node = new ImportedNode($this, (object) array('name' => $name, 'configName' => $config));
|
||||||
|
|
@ -475,6 +495,11 @@ class BusinessProcess
|
||||||
return $node;
|
return $node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $name
|
||||||
|
* @return Node
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
public function getNode($name)
|
public function getNode($name)
|
||||||
{
|
{
|
||||||
if (array_key_exists($name, $this->nodes)) {
|
if (array_key_exists($name, $this->nodes)) {
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,17 @@ abstract class Node
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forget my state
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function clearState()
|
||||||
|
{
|
||||||
|
$this->state = null;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function setAck($ack = true)
|
public function setAck($ack = true)
|
||||||
{
|
{
|
||||||
$this->ack = $ack;
|
$this->ack = $ack;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue