@param WorkflowFunctionInterface $workflowFunction

@return bool
505625
public function hasElementWithWorkflowFunction(WorkflowFunctionInterface $workflowFunction)
    {
        $qa = $this->createAggregationQuery();
        $qa->match(array(
            'authorizations.workflowFunctions.$id' => new \MongoId($workflowFunction->getId())
        ));
        $workflowRight = $this->singleHydrateAggregateQuery($qa);

        return $workflowRight instanceof WorkflowRightInterface;
    }
497420
public Workflow getWorkflow(String workflowId, boolean includeTasks) {
        Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "workflow id cannot be blank");
        Workflow workflow = getForEntity("workflow/{workflowId}", new Object[]{"includeTasks", includeTasks}, Workflow.class, workflowId);
        populateWorkflowOutput(workflow);
        return workflow;
    }
875381
public function deleteModelStates($workflowIdentifier, $processName = null)
    {
        $qb = $this->_em->createQueryBuilder()
            ->delete($this->_entityName, 'ms')
            ->andWhere('ms.workflowIdentifier = :workflow_identifier')
            ->setParameter('workflow_identifier', $workflowIdentifier);

        if (null !== $processName) {
            $qb->andWhere('ms.processName = :process')
                ->setParameter('process', $processName);
        }

        return $qb->getQuery()->getResult();
    }
967115
public Workflow getWorkflow(String workflowId, boolean includeTasks) {
        Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "workflow id cannot be blank");
        WorkflowPb.Workflow workflow = stub.getWorkflowStatus(
                WorkflowServicePb.GetWorkflowStatusRequest.newBuilder()
                        .setWorkflowId(workflowId)
                        .setIncludeTasks(includeTasks)
                        .build()
        );
        return protoMapper.fromProto(workflow);
    }
1066214
private function assertWorkflowHasRole(Workflow $workflow, $roleId)
    {
        if (!$workflow->hasRole($roleId)) {
            throw new \LogicException(sprintf('The workflow "%s" does not have the role "%s".', $workflow->getId(), $roleId));
        }
    }
781697
public function execute(InputInterface $input, OutputInterface $output)
    {
        $bundleName = $input->getArgument('bundle');
        $name = $input->getArgument('name');
        $fileType = $input->getOption('format');

        if ($bundleName == $this->thisBundle) {
            throw new \InvalidArgumentException("It is not allowed to create workflows in bundle '$bundleName'");
        }

        if (!in_array($fileType, $this->availableWorkflowFormats)) {
            throw new \InvalidArgumentException('Unsupported workflow file format ' . $fileType);
        }

        $workflowDirectory = $this->getWorkflowDirectory($bundleName);

        if (!is_dir($workflowDirectory)) {
            $output->writeln(sprintf(
                "Workflows directory <info>%s</info> does not exist. I will create it now....",
                $workflowDirectory
            ));

            if (mkdir($workflowDirectory, self::DIR_CREATE_PERMISSIONS, true)) {
                $output->writeln(sprintf(
                    "Workflows directory <info>%s</info> has been created",
                    $workflowDirectory
                ));
            } else {
                throw new FileException(sprintf(
                    "Failed to create workflows directory %s.",
                    $workflowDirectory
                ));
            }
        }

        $date = date('YmdHis');

        if ($name == '') {
            $name = 'placeholder';
        }
        $fileName = $date . '_' . $name . '.' . $fileType;

        $path = $workflowDirectory . '/' . $fileName;

        $warning = $this->generateWorkflowFile($path, $fileType);

        $output->writeln(sprintf("Generated new workflow file: <info>%s</info>", $path));

        if ($warning != '') {
            $output->writeln("<comment>$warning</comment>");
        }
    }
1096171
static function runFromKey($workflow_key) {
        $workflow_job_config = [];
        $start_time = microtime(true);
        /**
         * First doing a simple setup... does this work?
         * Nothing get saved at this point errors here is most likely to be
         * a runtime problem. Like locking errorous jobs or that a job is already running.
         */
        try {
            $workflow_config = self::getWorkflowConfig($workflow_key);
            $workflow_job_key = self::createWorkflowJobKey();
            $workflow_job_config = self::createJobConfig($workflow_config);
            $start_state = self::getWorkflowState($workflow_key);
            $workflow_job_config = self::startJob($workflow_job_key, $workflow_job_config, $start_state);
        } catch (\Exception $exception) {
            syslog(LOG_ERR, $exception->getMessage());
            $workflow_job_config["status"] = self::STATUS_ERROR;
            $workflow_job_config["message"] = "Got this error: " . $exception->getMessage();
            $workflow_job_config["runtime"] = microtime(true) - $start_time;
            return $workflow_job_config;
        }
        /**
         * Continues with a working setup and trying to do the config run.
         */
        try {
            ob_start();
            $end_state = self::runFromConfig($workflow_config, $start_state);
            $workflow_job_config["message"] = ob_get_clean();
            $workflow_job_config["runtime"] = microtime(true) - $start_time;
            if ($end_state) {
                return self::endJob($workflow_job_key, $workflow_job_config, $end_state);
            } else {
                return self::failJob($workflow_job_key, $workflow_job_config, "Job didn't emit an endstate.");
            }
        } catch (\Exception $exception) {
            $workflow_job_config["runtime"] = microtime(true) - $start_time;
            return self::failJob($workflow_job_key, $workflow_job_config, $exception->getMessage());
        }
    }
1170650
protected function loadWorkflow(WorkflowConfig $c, $validate = true)
    {
        $validate = (boolean)$validate;
        try {
            $c->descriptor = WorkflowLoader::load($c->url, $validate);
        } catch (\Exception $e) {
            $errMsg = "Некорректный дескрипторв workflow: {$c->url}";
            throw new FactoryException($errMsg, $e->getCode(), $e);
        }
    }
879855
public function validate()
    {
        $conditions = $this->getConditions();
        ValidationHelper::validate($conditions);

        $result = $this->getResult();
        if (null === $result) {
            $errMsg = 'Join должен иметь реузультат';
            throw new InvalidWorkflowDescriptorException($errMsg);
        }

        $result->validate();
    }
632637
protected function triggerWorkflowEvent($eventName, $origin = null, $context = [])
    {
        $this->getEventsHandler()->trigger($eventName, $origin, $context, new WorkflowEvent($this));
    }
299379
def valid_workflow(self):
        
        for ix, handler in enumerate(self.handlers[:-1]):
            next_input_type = self.handlers[ix + 1].input_type

            if (handler.output_type is not None and
                    next_input_type is not None):
                if handler.output_type != next_input_type:
                    return False

        return True
1323992
public function loadDefinition($workflowId, $source)
	{
		$wfClassname = $this->getClassname($workflowId);
		$defProvider = null;
		try {
			$defProvider = Yii::createObject(['class' => $wfClassname]);
		} catch ( \ReflectionException $e) {
			throw new WorkflowException('failed to load workflow definition : '.$e->getMessage());
		}
		if( ! $defProvider instanceof IWorkflowDefinitionProvider ) {
			throw new WorkflowException('Invalid workflow provider : class '.$wfClassname
				.' doesn\'t implement \raoul2000\workflow\source\file\IWorkflowDefinitionProvider');
		}

		return $this->parse($workflowId, $defProvider->getDefinition(), $source);
	}
672725
function WorkflowProcessStepsController($scope, $state, wfmService, $timeout, $stateParams) {
  var self = this;
  var workorderId = $stateParams.workorderId;

  function updateWorkflowState(workorder) {
    //If the workflow is complete, then we can switch to the summary view.
    if (wfmService.isCompleted(workorder)) {
      return $state.go('app.workflowProcess.complete', {
        workorderId: workorder.id
      });
    }

    if (!wfmService.isOnStep(workorder)) {
      return $state.go('app.workflowProcess.begin', {
        workorderId: workorder.id
      });
    }

    $timeout(function() {
      self.workorder = workorder;
      self.workflow = workorder.workflow;
      self.result = workorder.results;
      self.stepIndex = wfmService.getCurrentStepIdx(workorder);
      self.stepCurrent = wfmService.getCurrentStep(workorder);
    });
  }

  self.back = function() {
    wfmService.previousStep(workorderId)
      .then(updateWorkflowState)
      .catch(console.error);
  };

  self.triggerCompleteStep = function(submission) {
    wfmService.completeStep(workorderId, submission)
      .then(updateWorkflowState)
      .catch(console.error);
  };

  self.triggerBackStep = function() {
    self.back();
  };

  wfmService.readWorkOrder(workorderId).then(updateWorkflowState);
}
263522
public function deleteAction($workflowProfileId)
    {
        $workflowProfile = $this->get('open_orchestra_model.repository.workflow_profile')->find($workflowProfileId);
        $this->denyAccessUnlessGranted(ContributionActionInterface::DELETE, $workflowProfile);

        if ($workflowProfile instanceof WorkflowProfileInterface) {
            $objectManager = $this->get('object_manager');
            $objectManager->remove($workflowProfile);
            $objectManager->flush();
            $this->dispatchEvent(WorkflowProfileEvents::WORKFLOW_PROFILE_DELETE, new WorkflowProfileEvent($workflowProfile));
        }

        return array();
    }
155197
public function setIsWorkflowInEffect()
    {
        // if there is a workflow applied, we can't set the publishing date directly, only the 'desired' publishing date
        $effective = $this->getWorkflowService()->getDefinitionFor($this->owner);
        $this->isWorkflowInEffect = $effective ? true : false;
    }
1248033
protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (!$this->workflowRegistry instanceof Registry) {
            throw new Exception('Can not generate path: No workflows were defined');
        }

        $this->setAnonymousToken();

        $model = $input->getArgument('model');
        $generatorName = $input->getOption('generator');
        $metaData = $input->getOption('meta-data');
        $generator = $this->generatorManager->getGenerator($generatorName);
        $subject = $this->subjectManager->createSubject($model);
        $subject->setTestingModel(true);
        $subject->setUp();
        $workflow = $this->workflowRegistry->get($subject, $model);

        $path = new Path();
        $path->add(null, null, [$workflow->getDefinition()->getInitialPlace()]);

        try {
            foreach ($generator->getAvailableTransitions($workflow, $subject, $metaData) as $transitionName) {
                try {
                    if (!$generator->applyTransition($workflow, $subject, $transitionName)) {
                        throw new Exception(sprintf("Generator '%s' generated transition '%s' that can not be applied", $generatorName, $transitionName));
                    }
                } finally {
                    $data = $subject->getStoredData();
                    $places = array_keys(array_filter($workflow->getMarking($subject)->getPlaces()));
                    $path->add($transitionName, $data, $places);
                }
            }
        } finally {
            $subject->tearDown();
        }

        $output->writeln(json_encode(Path::serialize($path)));
    }
98746
protected function generateForm(Request $request, WorkflowRightInterface $workflowRight, $url, $workflowRightEvents)
    {
        $form = $this->createForm('oo_workflow_right', $workflowRight, array('action' => $url));
        $form->handleRequest($request);
        if ($this->handleForm(
            $form,
            $this->get('translator')->trans('open_orchestra_workflow_function_admin.form.workflow_right.success'),
            $workflowRight)) {
            $this->dispatchEvent($workflowRightEvents, new WorkflowRightEvent($workflowRight));
        }

        $title = 'open_orchestra_workflow_function_admin.right.title';
        $title = $this->get('translator')->trans($title);

        return $this->renderAdminForm($form, array('title' => $title));
    }