@return MetadataInterface

@throws Exception\WorkflowDispatchEventException
507040
public function getMetadata()
    {
        if (null === $this->metadata) {
            $errMsg = 'metadata not found';
            throw new Exception\WorkflowDispatchEventException($errMsg);
        }

        return $this->metadata;
    }
77846
public function loadMetadataForAction($controllerClassName, $actionMethod)
    {
        $key = $controllerClassName . '_' . $actionMethod;
        if (array_key_exists($key, $this->classAnnotations)) {
            return $this->classAnnotations[$key];
        }

        $r = new \ReflectionClass($controllerClassName);
        $rMethod = $r->getMethod($actionMethod);

        $metadata = new Metadata();


        /** @var Annotation\WorkflowDispatch|null $workflowDispatchAnnotation */
        $workflowDispatchAnnotation = $this->getReader()->getMethodAnnotation($rMethod, Annotation\WorkflowDispatch::class);
        if (null !== $workflowDispatchAnnotation) {
            $metadata->setWorkflowDispatch($workflowDispatchAnnotation->enabled);
            $metadata->setWorkflowRunType($workflowDispatchAnnotation->activity);
        }

        /** @var Annotation\PrepareData|null $prepareDataAnnotation */
        $prepareDataAnnotation = $this->getReader()->getMethodAnnotation($rMethod, Annotation\PrepareData::class);
        if ($prepareDataAnnotation) {
            $metadata->setFlagRunPrepareData($prepareDataAnnotation->enabled);
            $metadata->setPrepareDataMethod($prepareDataAnnotation->type);
            $metadata->setPrepareDataHandler($prepareDataAnnotation->handler);
        }


        /** @var Annotation\DispatchConditions|null $dispatchConditionsAnnotation */
        $dispatchConditionsAnnotation = $this->getReader()->getMethodAnnotation($rMethod, Annotation\DispatchConditions::class);
        if ($dispatchConditionsAnnotation && is_array($dispatchConditionsAnnotation->conditions) && count($dispatchConditionsAnnotation->conditions) > 0) {
            $metadata->setFlagHasConditions(true);
            foreach ($dispatchConditionsAnnotation->conditions as $condition) {
                if (!$condition instanceof Condition) {
                    $errMsg = 'Invalid condition annotation';
                    throw new Exception\AnnotationReaderException($errMsg);
                }
                $conditionMetadata = new DispatchConditionMetadata($condition->type, $condition->handler, $condition->params);

                $metadata->addConditions($conditionMetadata);
            }
        }
//
//        /** @var Annotation\WorkflowRouterMap|null $workflowRouterMapAnnotation */
//        $workflowRouterMapAnnotation = $this->getReader()->getMethodAnnotation($rMethod, Annotation\WorkflowRouterMap::class);
//        if ($workflowRouterMapAnnotation) {
//            $metadata->setWorkflowManagerNameRouterParam($workflowRouterMapAnnotation->managerName);
//            $metadata->setWorkflowActionNameRouterParam($workflowRouterMapAnnotation->actionName);
//            $metadata->setWorkflowNameRouterParam($workflowRouterMapAnnotation->name);
//            $metadata->setEntryIdRouterParam($workflowRouterMapAnnotation->entryId);
//        }
//
//        $metadata->validate();

        return $metadata;
    }
81565
public function getMetadata(Metadata $metadata = null, \Exception $exception = null)
	{
		$metadata = isset($metadata) ? $metadata : new Metadata();

		if (!$metadata->getSeverity())
		{
			if ($exception instanceof ErrorException)
			{
				$metadata->setSeverity($exception->getSeverity());
			}
			elseif ($exception instanceof \Exception)
			{
				$metadata->setSeverity(Severity::ERROR);
			}
			else
			{
				$metadata->setSeverity(Severity::NOTICE);
			}
		}

		foreach ($this->processorManager->all() as $processor)
		{
			$processor->process($metadata, $exception);
		}

		return $metadata;
	}
532477
public function transform($workflowProfile, array $params = array())
    {
        if (!$workflowProfile instanceof WorkflowProfileInterface) {
            throw new TransformerParameterTypeException();
        }

        $facade = $this->newFacade();

        $facade->id = $workflowProfile->getId();
        $facade->label = $this->multiLanguagesChoiceManager->choose($workflowProfile->getLabels());
        $facade->description = $this->multiLanguagesChoiceManager->choose($workflowProfile->getDescriptions());
        if ($this->hasGroup(CMSGroupContext::AUTHORIZATIONS)) {
            $canDelete = $this->authorizationChecker->isGranted(ContributionActionInterface::DELETE, $workflowProfile);
            $facade->addRight('can_delete', $canDelete);
        }

        foreach ($workflowProfile->getTransitions() as $transition) {
            $facade->addTransition($this->getTransformer('workflow_transition')->transform($transition));
        }

        return $facade;
    }
757730
public function getWorkflow()
	{
		return $this->hasWorkflowStatus() ? $this->getWorkflowSource()->getWorkflow($this->getWorkflowStatus()->getWorkflowId()) : null;
	}
318096
public function onPrepareDataHandler(WorkflowDispatchEventInterface $e)
    {
        $metadata = $e->getMetadata();

        $type = $metadata->getPrepareDataMethod();
        $handler = $metadata->getPrepareDataHandler();

        $prepareDataResult = null;

        if ('method' === $type) {
            $mvcEvent = $e->getMvcEvent();
            $controller = $mvcEvent->getTarget();
            if (!$controller instanceof AbstractController) {
                $errMsg = sprintf('Controller not implement %s', AbstractController::class);
                throw new Exception\PrepareDataException($errMsg);
            }
            $callback = [$controller, $handler];
            if (!is_callable($callback)) {
                $errMsg = sprintf('Invalid handler"%s"', $handler);
                throw new Exception\PrepareDataException($errMsg);
            }
            $prepareDataResult = call_user_func($callback, $e);
            if (null === $prepareDataResult) {
                $prepareDataResult = [];
            }
        } else {
            $errMsg = sprintf('Preparing data for Workflow will fail. Unknown handler type %s.', $type);
            throw new Exception\PrepareDataException($errMsg);
        }

        if (!is_array($prepareDataResult) && !$prepareDataResult instanceof Traversable) {
            $errMsg = 'Data preparation The results should be an array or Traversable';
            throw new Exception\PrepareDataException($errMsg);
        }


        return $prepareDataResult;
    }
890727
public function transform($workflowTransition, array $params = array())
    {
        if (!$workflowTransition instanceof WorkflowTransitionInterface) {
            throw new TransformerParameterTypeException();
        }

        $facade = $this->newFacade();
        $facade->statusFrom = $this->getContext()->transform('status', $workflowTransition->getStatusFrom());
        $facade->statusTo = $this->getContext()->transform('status', $workflowTransition->getStatusTo());

        return $facade;
    }
331634
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var Dispatcher $dispatcher */
        $dispatcher = $serviceLocator->get(Dispatcher::class);

        $options = [
            'dispatcher' => $dispatcher
        ];

        return new WorkflowDispatchListener($options);
    }
694906
protected function getMetadata() {
		if ($this->metadataManager === null) {
			throw new Exceptions\MetadataError('Metadata manager was not set');
		}
		
		return $this->metadataManager->getMetadata($this);
	}
786499
public function ExportMetaData()
    {
        $def = $this->getDefinition();
        return new ArrayData(array(
            'ExportHost' => preg_replace("#http(s)?://#", '', Director::protocolAndHost()),
            'ExportDate' => date('d/m/Y H-i-s'),
            'ExportUser' => $this->member->FirstName.' '.$this->member->Surname,
            'ExportVersionFramework' => $this->ssVersion(),
            'ExportWorkflowDefName' => $this->processTitle($def->Title),
            'ExportRemindDays' => $def->RemindDays,
            'ExportSort' => $def->Sort
        ));
    }
1129902
public function getMetadataReaderManager()
    {
        if ($this->metadataReaderManager) {
            return $this->metadataReaderManager;
        }

        try {
            $sl = $this->getServiceLocator();
            /** @var ModuleOptions $moduleOptions */
            $moduleOptions = $sl->get(ModuleOptions::class);

            $className = $moduleOptions->getMetadataReaderManagerClassName();

            $r = new \ReflectionClass($className);
            $instance = $r->newInstance();

            if (!$instance instanceof MetadataReaderManagerInterface) {
                $errMsg = sprintf('Metadata reader manager not implement %s', MetadataReaderManagerInterface::class);
                throw new Exception\ErrorInitModuleException($errMsg);
            }
            $this->metadataReaderManager = $instance;
        } catch (\Exception $e) {
            throw new Exception\ErrorInitModuleException($e->getMessage(), $e->getCode(), $e);
        }

        return $this->metadataReaderManager;
    }
928057
public function eventFactory()
    {
        if (null !== $this->eventPrototype) {
            return clone $this->eventPrototype;
        }

        try {
            /** @var ModuleOptions $moduleOptions */
            $moduleOptions = $this->get(ModuleOptions::class);

            $moduleOptionsEventClassName = $moduleOptions->getModuleOptionsEventClassName();
            $r = new ReflectionClass($moduleOptionsEventClassName);

            $eventPrototype = $r->newInstance();
            if (!$eventPrototype instanceof EventInterface) {
                $errMsg = sprintf(
                    'Event of type %s is invalid; must implement %s',
                    (is_object($eventPrototype) ? get_class($eventPrototype) : gettype($eventPrototype)),
                    ModuleOptionsEventInterface::class
                );
                throw new Exception\RuntimeException($errMsg);
            }
            $this->eventPrototype = $eventPrototype;
        } catch (\Exception $e) {
            throw new Exception\InvalidEventException($e->getMessage(), $e->getCode(), $e);
        }

        return clone $this->eventPrototype;
    }
1234949
protected function metadataLoader()
    {
        if ($this->metadataLoader === null) {
            throw new RuntimeException(sprintf(
                'Metadata Loader is not defined for "%s"',
                get_class($this)
            ));
        }

        return $this->metadataLoader;
    }
16340
public function getMetadataReader()
    {
        if ($this->metadataReader === null) {
            $this->setMetadataReader($this->getDefaultMetadataReader());
        }

        return $this->metadataReader;
    }
160063
public function getTabRequestMeta() {
    if ($this->context === 'new') {
      return $this->entityMeta->getNewFormRequestMeta();
    } elseif ($this->context === 'grid') {
      return $this->entityMeta->getGridRequestMeta();
    } elseif ($this->context === self::CONTEXT_SEARCHPANEL) {
      return $this->entityMeta->getSearchPanelRequestMeta();
    } elseif ($this->context === self::CONTEXT_DEFAULT || $this->context === self::CONTEXT_ASSOC_LIST) {
      return $this->entityMeta->getDefaultRequestMeta();
    } else {
      throw new \InvalidArgumentException(sprintf("Context '%s' ist unbekannt",$this->context));
    }
  }
316985
public function initDispatcher()
    {
        $this->di->set('dispatcher', function() {
            $dispatcher = new Dispatcher();

            /**
             * @var \Phalcon\Events\Manager $eventsManager
             */
            $eventsManager = $this->di->getShared('eventsManager');
            $eventsManager->attach(
                'dispatch:beforeException',
                (new ExceptionListener())->beforeException()
            );

            $dispatcher->setEventsManager($eventsManager);

            return $dispatcher;
        });
    }
733783
@Override
    public DispatcherType getDispatcherType() {
        try {
            collaborator.preInvoke(componentMetaData);
            return request.getDispatcherType();
        } finally {
            collaborator.postInvoke();
        }
    }