mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-20 14:50:11 -05:00
Node, BusinessProcess: add and unify helpers
BusinessProcess will be reduced and is going to be a special root node
This commit is contained in:
parent
0a1c14c01a
commit
31626b4728
2 changed files with 75 additions and 0 deletions
|
|
@ -18,10 +18,39 @@ class BusinessProcess
|
|||
protected $root_nodes = array();
|
||||
protected $all_checks = array();
|
||||
protected $hosts = array();
|
||||
protected $simulationMode = false;
|
||||
protected $editMode = false;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function hasBeenChanged()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function setSimulationMode($mode = true)
|
||||
{
|
||||
$this->simulationMode = (bool) $mode;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isSimulationMode()
|
||||
{
|
||||
return $this->simulationMode;
|
||||
}
|
||||
|
||||
public function setEditMode($mode = true)
|
||||
{
|
||||
$this->editMode = (bool) $mode;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isEditMode()
|
||||
{
|
||||
return $this->editMode;
|
||||
}
|
||||
/*
|
||||
public function getObjectIds()
|
||||
{
|
||||
|
|
@ -113,11 +142,26 @@ class BusinessProcess
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getChildren()
|
||||
{
|
||||
return $this->getRootNodes();
|
||||
}
|
||||
|
||||
public function countChildren()
|
||||
{
|
||||
return count($this->root_nodes);
|
||||
}
|
||||
|
||||
public function getRootNodes()
|
||||
{
|
||||
return $this->root_nodes;
|
||||
}
|
||||
|
||||
public function getNodes()
|
||||
{
|
||||
return $this->nodes;
|
||||
}
|
||||
|
||||
public function hasNode($name)
|
||||
{
|
||||
return array_key_exists($name, $this->nodes);
|
||||
|
|
|
|||
|
|
@ -39,6 +39,11 @@ abstract class Node
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function hasBeenChanged()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isMissing()
|
||||
{
|
||||
return $this->missing;
|
||||
|
|
@ -123,6 +128,11 @@ abstract class Node
|
|||
return $this->duration;
|
||||
}
|
||||
|
||||
public function isHandled()
|
||||
{
|
||||
return $this->isInDowntime() || $this->isAcknowledged();
|
||||
}
|
||||
|
||||
public function isInDowntime()
|
||||
{
|
||||
if ($this->downtime === null) {
|
||||
|
|
@ -139,11 +149,32 @@ abstract class Node
|
|||
return $this->ack;
|
||||
}
|
||||
|
||||
|
||||
public function isSimulationMode()
|
||||
{
|
||||
return $this->bp->isSimulationMode();
|
||||
}
|
||||
|
||||
public function isEditMode()
|
||||
{
|
||||
return $this->bp->isEditMode();
|
||||
}
|
||||
|
||||
public function hasChildren()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function countChildren()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function getChildren()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->name;
|
||||
|
|
|
|||
Loading…
Reference in a new issue