Esempio n. 1
0
 /**
  * @param mixed $id
  * @return array|mixed
  */
 public function get($id)
 {
     $processLog = $this->processLogFinder->getLoggedProcess($id);
     if ($processLog === null) {
         return $this->notFoundAction();
     }
     $processLog['events'] = $this->convertToClientProcessEvents($this->processStreamReader->getStreamOfProcess($id));
     $processDefinitions = $this->systemConfig->getProcessDefinitions();
     if (!isset($processDefinitions[$processLog['start_message']])) {
         //@TODO: Provide better error, so that the client can show the user a message that config is missing
         return $this->notFoundAction();
     }
     $processDefinition = $processDefinitions[$processLog['start_message']];
     $processDefinition = ProcessToClientTranslator::translate($processLog['start_message'], $processDefinition, $this->systemConfig->getAllAvailableProcessingTypes(), $this->scriptLocation);
     $processLog['tasks'] = $processDefinition['tasks'];
     $this->populateTaskEvents($processLog);
     return ['log' => $processLog];
 }
 /**
  * @param string $startMessage
  * @param array $processDefinition
  * @param array $knownProcessingTypes
  * @return array
  */
 private function convertToClientProcess($startMessage, array $processDefinition, array $knownProcessingTypes)
 {
     return ProcessToClientTranslator::translate($startMessage, $processDefinition, $knownProcessingTypes, $this->scriptLocation);
 }