Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function executeCommand(ProcessEngine $engine)
 {
     $task = $engine->getTaskService()->createTaskQuery()->taskId($this->taskId)->findOne();
     $engine->notify(new UserTaskCompletedEvent($task, $engine));
     $sql = "\tDELETE FROM `#__bpmn_user_task`\r\n\t\t\t\t\tWHERE `id` = :id\r\n\t\t";
     $stmt = $engine->prepareQuery($sql);
     $stmt->bindValue('id', $this->taskId);
     $stmt->execute();
     $engine->debug('Completed user task "{task}" with id {id}', ['task' => $task->getName(), 'id' => (string) $task->getId()]);
     $executionId = $task->getExecutionId();
     if ($executionId !== NULL) {
         $engine->findExecution($executionId)->signal('user-task', unserialize($this->variables));
     }
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function executeCommand(ProcessEngine $engine)
 {
     $task = $engine->getTaskService()->createTaskQuery()->taskId($this->taskId)->findOne();
     if (!$task->isClaimed()) {
         throw new \RuntimeException(sprintf('User task %s is not claimed', $task->getId()));
     }
     $sql = "\tUPDATE `#__bpmn_user_task`\r\n\t\t\t\t\tSET `claimed_at` = :time,\r\n\t\t\t\t\t\t`claimed_by` = :assignee\r\n\t\t\t\t\tWHERE `id` = :id\r\n\t\t";
     $stmt = $engine->prepareQuery($sql);
     $stmt->bindValue('time', NULL);
     $stmt->bindValue('assignee', NULL);
     $stmt->bindValue('id', $task->getId());
     $stmt->execute();
     $task = $engine->getTaskService()->createTaskQuery()->taskId($this->taskId)->findOne();
     $engine->notify(new UserTaskUnclaimedEvent($task, $engine));
     $engine->debug('User task "{task}" unclaimed', ['task' => $task->getName()]);
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public function executeCommand(ProcessEngine $engine)
 {
     $id = UUID::createRandom();
     $activityId = NULL;
     if ($this->executionId !== NULL) {
         $activityId = $engine->findExecution($this->executionId)->getNode()->getId();
     }
     $sql = "\tINSERT INTO `#__bpmn_user_task`\r\n\t\t\t\t\t\t(`id`, `execution_id`, `name`, `documentation`, `activity`, `created_at`, `priority`, `due_at`)\r\n\t\t\t\t\tVALUES\r\n\t\t\t\t\t\t(:id, :eid, :name, :doc, :activity, :created, :priority, :due)\r\n\t\t";
     $stmt = $engine->prepareQuery($sql);
     $stmt->bindValue('id', $id);
     $stmt->bindValue('eid', $this->executionId);
     $stmt->bindValue('name', $this->name);
     $stmt->bindValue('doc', $this->documentation);
     $stmt->bindValue('activity', $activityId);
     $stmt->bindValue('created', time());
     $stmt->bindValue('priority', $this->priority);
     $stmt->bindValue('due', $this->dueDate);
     $stmt->execute();
     $engine->debug('Created user task "{task}" with id {id}', ['task' => $this->name, 'id' => (string) $id]);
     $task = $engine->getTaskService()->createTaskQuery()->taskId($id)->findOne();
     $engine->notify(new UserTaskCreatedEvent($task, $engine));
     return $task;
 }
Esempio n. 4
0
 /**
  * {@inheritdoc}
  */
 public function executeCommand(ProcessEngine $engine)
 {
     $execution = $engine->findExecution($this->executionId);
     $engine->notify(new MessageThrownEvent(new DelegateExecution($execution), $engine));
     $execution->signal();
 }