public function activate(ezcWorkflowNode $node, $notifyPlugins = true)
{
// Only activate the node when
// - the execution of the workflow has not been cancelled,
// - the node is ready to be activated,
// - and the node is not already activated.
if ($this->cancelled || !$node->isExecutable() || ezcWorkflowUtil::findObject($this->activatedNodes, $node) !== false) {
return false;
}
$activateNode = true;
foreach ($this->plugins as $plugin) {
$activateNode = $plugin->beforeNodeActivated($this, $node);
if (!$activateNode) {
// @codeCoverageIgnoreStart
break;
// @codeCoverageIgnoreEnd
}
}
if ($activateNode) {
// Add node to list of activated nodes.
$this->activatedNodes[] = $node;
$this->numActivatedNodes++;
if ($node instanceof ezcWorkflowNodeEnd) {
$this->numActivatedEndNodes++;
}
if ($notifyPlugins) {
foreach ($this->plugins as $plugin) {
$plugin->afterNodeActivated($this, $node);
}
}
return true;
} else {
// @codeCoverageIgnoreStart
return false;
// @codeCoverageIgnoreEnd
}
}