mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-25 00:59:34 -05:00
BpNode: remove code related to legacy config
This commit is contained in:
parent
75dc5e0ef6
commit
149696fb50
1 changed files with 16 additions and 56 deletions
|
|
@ -428,6 +428,22 @@ class BpNode extends Node
|
||||||
return $this->children;
|
return $this->children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return BpNode[]
|
||||||
|
*/
|
||||||
|
public function getChildBpNodes()
|
||||||
|
{
|
||||||
|
$children = array();
|
||||||
|
|
||||||
|
foreach ($this->getChildren() as $name => $child) {
|
||||||
|
if ($child instanceof BpNode) {
|
||||||
|
$children[$name] = $child;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $children;
|
||||||
|
}
|
||||||
|
|
||||||
protected function assertNumericOperator()
|
protected function assertNumericOperator()
|
||||||
{
|
{
|
||||||
if (! is_numeric($this->operator)) {
|
if (! is_numeric($this->operator)) {
|
||||||
|
|
@ -435,62 +451,6 @@ class BpNode extends Node
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toLegacyConfigString(& $rendered = array())
|
|
||||||
{
|
|
||||||
$cfg = '';
|
|
||||||
if (array_key_exists($this->name, $rendered)) {
|
|
||||||
return $cfg;
|
|
||||||
}
|
|
||||||
$rendered[$this->name] = true;
|
|
||||||
$children = array();
|
|
||||||
|
|
||||||
foreach ($this->getChildren() as $name => $child) {
|
|
||||||
$children[] = (string) $child;
|
|
||||||
if (array_key_exists($name, $rendered)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($child instanceof BpNode) {
|
|
||||||
$cfg .= $child->toLegacyConfigString($rendered) . "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$eq = '=';
|
|
||||||
$op = $this->operator;
|
|
||||||
if (is_numeric($op)) {
|
|
||||||
$eq = '= ' . $op . ' of:';
|
|
||||||
$op = '+';
|
|
||||||
}
|
|
||||||
|
|
||||||
$strChildren = implode(' ' . $op . ' ', $children);
|
|
||||||
if ((count($children) < 2) && $op !== '&') {
|
|
||||||
$strChildren = $op . ' ' . $strChildren;
|
|
||||||
}
|
|
||||||
$cfg .= sprintf(
|
|
||||||
"%s %s %s\n",
|
|
||||||
$this->name,
|
|
||||||
$eq,
|
|
||||||
$strChildren
|
|
||||||
);
|
|
||||||
if ($this->hasAlias() || $this->getDisplay() > 0) {
|
|
||||||
$prio = $this->getDisplay();
|
|
||||||
$cfg .= sprintf(
|
|
||||||
"display %s;%s;%s\n",
|
|
||||||
$prio,
|
|
||||||
$this->name,
|
|
||||||
$this->getAlias()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if ($this->hasInfoUrl()) {
|
|
||||||
$cfg .= sprintf(
|
|
||||||
"info_url;%s;%s\n",
|
|
||||||
$this->name,
|
|
||||||
$this->getInfoUrl()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $cfg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function operatorHtml()
|
public function operatorHtml()
|
||||||
{
|
{
|
||||||
switch ($this->operator) {
|
switch ($this->operator) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue