/**
* Prepares this node for activation.
*
* @param ezcWorkflowExecution $execution
* @param int $threadId
* @throws ezcWorkflowExecutionException
*/
protected function prepareActivate(ezcWorkflowExecution $execution, $threadId = 0)
{
$parentThreadId = $execution->getParentThreadId($threadId);
if ($this->state['siblings'] == -1) {
$this->state['siblings'] = $execution->getNumSiblingThreads($threadId);
} else {
foreach ($this->state['threads'] as $oldThreadId) {
if ($parentThreadId != $execution->getParentThreadId($oldThreadId)) {
throw new ezcWorkflowExecutionException('Cannot synchronize threads that were started by different branches.');
}
}
}
$this->state['threads'][] = $threadId;
}