Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function enter(VirtualExecution $execution)
 {
     $model = $execution->getProcessModel();
     $execution->getEngine()->debug('Starting sub process "{process}"', ['process' => $this->getStringValue($this->name, $execution->getExpressionContext())]);
     $startNode = $model->findNode($this->startNodeId);
     if (!$startNode->getBehavior() instanceof NoneStartEventBehavior) {
         throw new \RuntimeException(sprintf('Cannot start sub process %s ("%s") because it is missing start node %s', $execution->getNode()->getId(), $this->getStringValue($this->name, $execution->getExpressionContext()), $this->startNodeId));
     }
     $execution->waitForSignal();
     $sub = $execution->createNestedExecution($model, $startNode, true, false);
     $sub->execute($startNode);
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 public function enter(VirtualExecution $execution)
 {
     $context = $execution->getExpressionContext();
     $command = new CreateUserTaskCommand($this->getStringValue($this->name, $context), (int) $this->getIntegerValue($this->priority, $context), $execution, $this->getStringValue($this->documentation, $context));
     if (NULL !== ($due = $this->getDateValue($this->dueDate, $context))) {
         $command->setDueDate($due);
     }
     $task = $execution->getEngine()->executeCommand($command);
     if ($this->assignee !== NULL) {
         $execution->getEngine()->pushCommand(new ClaimUserTaskCommand($task->getId(), $this->getStringValue($this->assignee, $context)));
     }
     $execution->waitForSignal();
 }
Beispiel #3
0
 /**
  * {@inheritdoc}
  */
 public function enter(VirtualExecution $execution)
 {
     $context = $execution->getExpressionContext();
     $definition = $execution->getEngine()->getRepositoryService()->createProcessDefinitionQuery()->processDefinitionKey($this->processDefinitionKey)->findOne();
     $execution->getEngine()->debug('Starting process {process} from call activity "{task}"', ['process' => $this->processDefinitionKey, 'task' => $this->getStringValue($this->name, $context)]);
     $start = $definition->getModel()->findInitialNodes();
     if (count($start) !== 1) {
         throw new \RuntimeException(sprintf('Missing single non start event in process %s', $definition->getKey()));
     }
     $startNode = array_shift($start);
     $sub = $execution->createNestedExecution($definition->getModel(), $startNode, true, true);
     foreach ($this->inputs as $target => $source) {
         if ($source instanceof ExpressionInterface) {
             $sub->setVariable($target, $source($context));
         } elseif ($execution->hasVariable($source)) {
             $sub->setVariable($target, $execution->getVariable($source));
         }
     }
     $execution->waitForSignal();
     $sub->execute($startNode);
 }
 /**
  * {@inheritdoc}
  */
 public function enter(VirtualExecution $execution)
 {
     $execution->waitForSignal();
 }
 /**
  * {@inheritdoc}
  */
 public function enter(VirtualExecution $execution)
 {
     $execution->getEngine()->pushCommand(new ThrowMessageCommand($execution));
     $execution->waitForSignal();
 }
 /**
  * {@inheritdoc}
  */
 public function enter(VirtualExecution $execution)
 {
     $execution->getEngine()->pushCommand(new SignalEventReceivedCommand($this->signalName, NULL, [], $execution));
     $execution->waitForSignal();
 }
Beispiel #7
0
 /**
  * Delegate signal to a target node using the same execution.
  * 
  * @param VirtualExecution $execution
  * @param string $signal
  * @param array $variables
  * @param array $delegation
  * @return boolean Returns true if the signal could be delegated.
  */
 protected function delegateSignal(VirtualExecution $execution, $signal, array $variables, array $delegation)
 {
     if (empty($delegation['nodeId'])) {
         return false;
     }
     $node = $execution->getProcessModel()->findNode($delegation['nodeId']);
     $execution->getEngine()->debug('Delegating signal <{signal}> to {node}', ['signal' => $signal === NULL ? 'NULL' : $signal, 'node' => (string) $node]);
     $execution->setNode($node);
     $execution->waitForSignal();
     $execution->signal($signal, $variables);
     return true;
 }