diff --git a/library/Businessprocess/BpNode.php b/library/Businessprocess/BpNode.php index d9e91c4..f413c96 100644 --- a/library/Businessprocess/BpNode.php +++ b/library/Businessprocess/BpNode.php @@ -19,6 +19,7 @@ class BpNode extends Node protected $alias; protected $counters; protected $missing = null; + protected $missingChildren; protected static $emptyStateSummary = array( 'OK' => 0, @@ -135,6 +136,25 @@ class BpNode extends Node return $this->missing; } + public function getMissingChildren() + { + if ($this->missingChildren === null) { + foreach ($this->getChildren() as $child) { + if ($child->isMissing()) { + $missing[(string) $child] = $child; + } + + foreach ($child->getMissingChildren() as $m) { + $missing[(string) $m] = $m; + } + } + + $this->missingChildren = $missing; + } + + return $this->missingChildren; + } + public function getOperator() { return $this->operator; diff --git a/library/Businessprocess/Node.php b/library/Businessprocess/Node.php index 4133b1c..3652454 100644 --- a/library/Businessprocess/Node.php +++ b/library/Businessprocess/Node.php @@ -127,6 +127,16 @@ abstract class Node return $this->missing; } + public function hasMissingChildren() + { + return count($this->getMissingChildren() > 0); + } + + public function getMissingChildren() + { + return array(); + } + public function hasInfoUrl() { return false; @@ -334,7 +344,11 @@ abstract class Node if ($this->isMissing()) { return array('missing'); } elseif ($state === 'ok') { - return array('ok'); + if ($this->hasMissingChildren()) { + return array('ok', 'missing-children'); + } else { + return array('ok'); + } } else { return array('problem', $state); }