public function startAppAction()
 {
     $workflows = $this->workflowFinder->findAll();
     $viewModel = new ViewModel(['workflows' => $workflows, 'processes' => array_values(Func::map($this->systemConfig->getProcessDefinitions(), function ($definition, $message) {
         return $this->convertToClientProcess($message, $definition, $this->systemConfig->getAllAvailableProcessingTypes());
     })), 'connectors' => array_values(Func::map($this->systemConfig->getConnectors(), function ($connector, $id) {
         $connector['id'] = $id;
         if (!isset($connector['metadata']) || empty($connector['metadata'])) {
             //Force empty object
             $connector['metadata'] = new \stdClass();
         }
         return $connector;
     })), 'available_processing_types' => $this->getProcessingTypesForClient(), 'available_manipulation_scripts' => $this->scriptLocation->getScriptNames(), 'locations' => $this->locationTranslator->getLocations(), 'available_process_types' => [['value' => \Prooph\Processing\Processor\Definition::PROCESS_LINEAR_MESSAGING, 'label' => $this->i18nTranslator->translate('Linear Process')], ['value' => \Prooph\Processing\Processor\Definition::PROCESS_PARALLEL_FOR_EACH, 'label' => $this->i18nTranslator->translate('Foreach Process')]], 'available_task_types' => [['value' => \Prooph\Processing\Processor\Definition::TASK_COLLECT_DATA, 'label' => $this->i18nTranslator->translate('Collect Data')], ['value' => \Prooph\Processing\Processor\Definition::TASK_PROCESS_DATA, 'label' => $this->i18nTranslator->translate('Process Data')], ['value' => \Prooph\Processing\Processor\Definition::TASK_MANIPULATE_PAYLOAD, 'label' => $this->i18nTranslator->translate('Run Manipulation Script')]], 'available_messages' => [['value' => 'collect-data', 'label' => $this->i18nTranslator->translate('Collect Data Message')], ['value' => 'data-collected', 'label' => $this->i18nTranslator->translate('Data Collected Message')], ['value' => 'process-data', 'label' => $this->i18nTranslator->translate('Process Data Message')]]]);
     $viewModel->setTemplate('prooph.link.process-manager/process-manager/app');
     $this->layout()->setVariable('includeRiotJs', true);
     return $viewModel;
 }
Exemplo n.º 2
0
 /**
  * Initializes method of Func passed as first argument with provided arguments.
  * Pass null for arguments that you wanna skip even when you wanna skip the last argument!
  *
  * @example
  * <code>
  *   $doAnythingWithEach = Func::prepare('map', null, function($value) { return do_anything_with($value); });
  *   $result = $doAnythingWithEach([1,2,3]);
  * </code>
  */
 public static function prepare()
 {
     $orgArgs = func_get_args();
     if (count($orgArgs) < 2) {
         throw new \BadMethodCallException('Func::prepare requires at least two arguments. First should be the function to prepare followed by arguments for that function');
     }
     $func = array_shift($orgArgs);
     return function () use($func, $orgArgs) {
         $additionalArgs = func_get_args();
         foreach ($orgArgs as $index => $arg) {
             if (is_null($arg)) {
                 $additionalArg = array_shift($additionalArgs);
                 if (is_null($additionalArg)) {
                     throw new \BadMethodCallException('Parameter mismatch detected for prepared function: ' . (string) $func);
                 }
                 $orgArgs[$index] = $additionalArg;
             }
         }
         return Func::call($func, $orgArgs);
     };
 }
Exemplo n.º 3
0
 public function detailsAction()
 {
     $processId = ProcessId::fromString($this->params('process_id'));
     $process = $this->processLogger->getLoggedProcess($processId);
     if (is_null($process)) {
         return $this->notFoundAction();
     }
     $process['events'] = $this->convertToClientProcessEvents($this->processStreamReader->getStreamOfProcess($processId));
     if (!isset($process['start_message']) || !isset($this->systemConfig->getProcessDefinitions()[$process['start_message']])) {
         return $this->incompleteAction($process);
     }
     $definition = $this->convertToClientProcess($process['start_message'], $this->systemConfig->getProcessDefinitions()[$process['start_message']], $this->systemConfig->getAllAvailableProcessingTypes());
     $process = array_merge($process, $definition);
     $this->populateTaskEvents($process);
     $view = new ViewModel(['process' => $process, 'available_processing_types' => $this->getProcessingTypesForClient(), 'available_task_types' => \Prooph\Processing\Processor\Definition::getAllTaskTypes(), 'available_manipulation_scripts' => $this->scriptLocation->getScriptNames(), 'locations' => $this->locationTranslator->getLocations(), 'connectors' => array_values(Func::map($this->systemConfig->getConnectors(), function ($connector, $id) {
         $connector['id'] = $id;
         return $connector;
     }))]);
     $view->setTemplate('prooph/link/monitor/process-view/process-details-app');
     $this->layout()->setVariable('includeRiotJs', true);
     return $view;
 }
Exemplo n.º 4
0
 /**
  * @test
  */
 public function it_applies_premap_callback_to_payload_collection()
 {
     $stringCollection = ["a string", 100, "yet another string"];
     $collection = StringCollection::fromNativeValue($stringCollection);
     $payload = Payload::fromType($collection);
     $string_cast = Func::prepare('premap', null, function ($item, $key, \Iterator $collection) {
         return (string) $item;
     });
     $string_cast($payload);
     $this->assertEquals(["a string", "100", "yet another string"], $payload->extractTypeData());
 }
Exemplo n.º 5
0
<?php

/*
 * This file is part of the prooph processing framework.
 * (c) 2014-2015 prooph software GmbH <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 * 
 * Date: 12/5/14 - 10:49 PM
 */
return function (\Prooph\Processing\Message\Payload $payload) {
    return \Prooph\Processing\Functional\Func::manipulate($payload, function ($string) {
        return $string . ' World';
    });
};