Java Code Examples for org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity#isSuspended()

The following examples show how to use org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity#isSuspended() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultCorrelationHandler.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected List<CorrelationHandlerResult> correlateStartMessageByEventSubscription(CommandContext commandContext, String messageName, CorrelationSet correlationSet) {
  List<CorrelationHandlerResult> results = new ArrayList<CorrelationHandlerResult>();
  DeploymentCache deploymentCache = commandContext.getProcessEngineConfiguration().getDeploymentCache();

  List<EventSubscriptionEntity> messageEventSubscriptions = findMessageStartEventSubscriptions(commandContext, messageName, correlationSet);
  for (EventSubscriptionEntity messageEventSubscription : messageEventSubscriptions) {

    if (messageEventSubscription.getConfiguration() != null) {
      String processDefinitionId = messageEventSubscription.getConfiguration();
      ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
      // only an active process definition will be returned
      if (processDefinition != null && !processDefinition.isSuspended()) {
        CorrelationHandlerResult result = CorrelationHandlerResult.matchedProcessDefinition(processDefinition, messageEventSubscription.getActivityId());
        results.add(result);

      } else {
        LOG.couldNotFindProcessDefinitionForEventSubscription(messageEventSubscription, processDefinitionId);
      }
    }
  }
  return results;
}
 
Example 2
Source File: DefaultConditionHandler.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected List<ConditionHandlerResult> evaluateConditionStartByEventSubscription(CommandContext commandContext, ConditionSet conditionSet) {
  List<EventSubscriptionEntity> subscriptions = findConditionalStartEventSubscriptions(commandContext, conditionSet);
  if (subscriptions.isEmpty()) {
    throw LOG.exceptionWhenEvaluatingConditionalStartEvent();
  }
  List<ConditionHandlerResult> results = new ArrayList<ConditionHandlerResult>();
  for (EventSubscriptionEntity subscription : subscriptions) {

    ProcessDefinitionEntity processDefinition = subscription.getProcessDefinition();
    if (!processDefinition.isSuspended()) {

      ActivityImpl activity = subscription.getActivity();

      if (evaluateCondition(conditionSet, activity)) {
        results.add(new ConditionHandlerResult(processDefinition, activity));
      }

    }
  }

  return results;
}
 
Example 3
Source File: DefaultConditionHandler.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected List<ConditionHandlerResult> evaluateConditionStartByProcessDefinitionId(CommandContext commandContext, ConditionSet conditionSet,
    String processDefinitionId) {
  DeploymentCache deploymentCache = commandContext.getProcessEngineConfiguration().getDeploymentCache();
  ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);

  List<ConditionHandlerResult> results = new ArrayList<ConditionHandlerResult>();

  if (processDefinition != null && !processDefinition.isSuspended()) {
    List<ActivityImpl> activities = findConditionalStartEventActivities(processDefinition);
    if (activities.isEmpty()) {
      throw LOG.exceptionWhenEvaluatingConditionalStartEventByProcessDefinition(processDefinitionId);
    }
    for (ActivityImpl activity : activities) {
      if (evaluateCondition(conditionSet, activity)) {
        results.add(new ConditionHandlerResult(processDefinition, activity));
      }
    }
  }
  return results;
}
 
Example 4
Source File: SignalEventHandler.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected void handleStartEvent(EventSubscriptionEntity eventSubscription, Map<String, Object> payload, String businessKey, CommandContext commandContext) {
  String processDefinitionId = eventSubscription.getConfiguration();
  ensureNotNull("Configuration of signal start event subscription '" + eventSubscription.getId() + "' contains no process definition id.",
      processDefinitionId);

  DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
  ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
  if (processDefinition == null || processDefinition.isSuspended()) {
    // ignore event subscription
    LOG.debugIgnoringEventSubscription(eventSubscription, processDefinitionId);
  } else {
    ActivityImpl signalStartEvent = processDefinition.findActivity(eventSubscription.getActivityId());
    PvmProcessInstance processInstance = processDefinition.createProcessInstance(businessKey, signalStartEvent);
    processInstance.start(payload);
  }
}
 
Example 5
Source File: SignalEventReceivedCmd.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected Map<String, ProcessDefinitionEntity> getProcessDefinitionsOfSubscriptions(List<EventSubscriptionEntity> startSignalEventSubscriptions) {
  DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();

  Map<String, ProcessDefinitionEntity> processDefinitions = new HashMap<String, ProcessDefinitionEntity>();

  for (EventSubscriptionEntity eventSubscription : startSignalEventSubscriptions) {

    String processDefinitionId = eventSubscription.getConfiguration();
    ensureNotNull("Configuration of signal start event subscription '" + eventSubscription.getId() + "' contains no process definition id.",
        processDefinitionId);

    ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
    if (processDefinition != null && !processDefinition.isSuspended()) {
      processDefinitions.put(eventSubscription.getId(), processDefinition);
    }
  }

  return processDefinitions;
}
 
Example 6
Source File: DefaultCorrelationHandler.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected CorrelationHandlerResult correlateStartMessageByProcessDefinitionId(CommandContext commandContext, String messageName, String processDefinitionId) {
  DeploymentCache deploymentCache = commandContext.getProcessEngineConfiguration().getDeploymentCache();
  ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
  // only an active process definition will be returned
  if (processDefinition != null && !processDefinition.isSuspended()) {

    String startActivityId = findStartActivityIdByMessage(processDefinition, messageName);
    if (startActivityId != null) {
      return CorrelationHandlerResult.matchedProcessDefinition(processDefinition, startActivityId);
    }
  }
  return null;
}