Exemplo n.º 1
0
 public function callback(Information $info, Act $dataContainer, Action $action)
 {
     $data = $dataContainer->getExternalData();
     if (!is_numeric($data)) {
         $data = 0;
     }
     $data++;
     $dataContainer->setExternalData($data);
     $action->updateTask($dataContainer);
     if ($action->isUpdateTaskSucceeded()) {
         $action->endTask();
     }
 }
Exemplo n.º 2
0
 public function updateTask(ActPacket $actPacket)
 {
     // If it's a recurring type task, and the old value of starting date time is not change, then updated it
     if ($actPacket->getTypeId() == Task::TYPE_ID_RECURRENT && $actPacket->getStartingDateTime() == $this->actPacket->getStartingDateTime()) {
         $actPacket->setStartingDateTime(date('Y-m-d H:i:s'));
     }
     $id = $this->currentTask->getId();
     $request = new Request([['id' => $id], ['typeId' => $actPacket->getTypeId(), 'repeatingInterval' => $actPacket->getRepeatingInterval(), 'startingDateTime' => $actPacket->getStartingDateTime(), 'priority' => $actPacket->getPriority(), 'externalTypeId' => $actPacket->getExternalTypeId(), 'externalId' => $actPacket->getExternalId(), 'externalData' => $actPacket->getExternalData()]]);
     $this->runUseCaseWithNoOfRetriesOnFail('task|update', $request, $this->getMaxRetries());
     if ($this->getUseCaseResponseStatus() == Response::STATUS_FAIL) {
         $this->lastOperationSuccess = false;
     }
     // Update the current task
     $this->currentTask->setTypeId($actPacket->getTypeId());
     $this->lastOperationSuccess = true;
 }