blob: 609d7049c5a47f4a29feeff5700354237841d18d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
<?php
namespace Icinga\Module\Businessprocess\Modification;
use Icinga\Module\Businessprocess\BpConfig;
class NodeCopyAction extends NodeAction
{
/**
* @param BpConfig $config
* @return bool
*/
public function appliesTo(BpConfig $config)
{
$name = $this->getNodeName();
if (! $config->hasBpNode($name)) {
$this->error('Process "%s" not found', $name);
}
if ($config->hasRootNode($name)) {
$this->error('A toplevel node with name "%s" already exists', $name);
}
return true;
}
/**
* @param BpConfig $config
*/
public function applyTo(BpConfig $config)
{
$name = $this->getNodeName();
$rootNodes = $config->getRootNodes();
$config->addRootNode($name)
->getBpNode($name)
->setDisplay(end($rootNodes)->getDisplay() + 1);
}
}
|