BusinessProcess: add new helper functions

Will make code easier to read
This commit is contained in:
Thomas Gelf 2015-01-28 19:56:52 +01:00
parent 47b8f00900
commit b0492484fa

View file

@ -191,6 +191,26 @@ class BusinessProcess
return array_key_exists($name, $this->nodes);
}
public function createService($host, $service)
{
$node = new ServiceNode(
$this,
(object) array(
'hostname' => $host,
'service' => $service
)
);
$this->nodes[$host . ';' . $service] = $node;
return $node;
}
public function createHost($host)
{
$node = new HostNode($this, (object) array('hostname' => $host));
$this->nodes[$host . ';Hoststatus'] = $node;
return $node;
}
public function getNode($name)
{
if (array_key_exists($name, $this->nodes)) {
@ -221,6 +241,12 @@ class BusinessProcess
);
}
public function addObjectName($name)
{
$this->all_checks[$name] = 1;
return $this;
}
public function addNode($name, Node $node)
{
if (array_key_exists($name, $this->nodes)) {