Search in sources :

Example 21 with ActivityImpl

use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.

the class GatewayMappingValidator method validateParentScopeMigrates.

protected void validateParentScopeMigrates(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report) {
    ActivityImpl sourceActivity = instruction.getSourceActivity();
    ScopeImpl flowScope = sourceActivity.getFlowScope();
    if (flowScope != flowScope.getProcessDefinition()) {
        if (instructions.getInstructionsBySourceScope(flowScope).isEmpty()) {
            report.addFailure("The gateway's flow scope '" + flowScope.getId() + "' must be mapped");
        }
    }
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) ScopeImpl(org.camunda.bpm.engine.impl.pvm.process.ScopeImpl)

Example 22 with ActivityImpl

use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.

the class LegacyBehavior method removeLegacySubscriptionOnParent.

/**
 * <p>Required for migrating active sequential MI receive tasks. These activities were formerly not scope,
 * but are now. This has the following implications:
 *
 * <p>Before migration:
 * <ul><li> the event subscription is attached to the miBody scope execution</ul>
 *
 * <p>After migration:
 * <ul><li> a new subscription is created for every instance
 * <li> the new subscription is attached to a dedicated scope execution as a child of the miBody scope
 *   execution</ul>
 *
 * <p>Thus, this method removes the subscription on the miBody scope
 */
public static void removeLegacySubscriptionOnParent(ExecutionEntity execution, EventSubscriptionEntity eventSubscription) {
    ActivityImpl activity = execution.getActivity();
    if (activity == null) {
        return;
    }
    ActivityBehavior behavior = activity.getActivityBehavior();
    ActivityBehavior parentBehavior = (ActivityBehavior) (activity.getFlowScope() != null ? activity.getFlowScope().getActivityBehavior() : null);
    if (behavior instanceof ReceiveTaskActivityBehavior && parentBehavior instanceof MultiInstanceActivityBehavior) {
        List<EventSubscriptionEntity> parentSubscriptions = execution.getParent().getEventSubscriptions();
        for (EventSubscriptionEntity subscription : parentSubscriptions) {
            // distinguish a boundary event on the mi body with the same message name from the receive task subscription
            if (areEqualEventSubscriptions(subscription, eventSubscription)) {
                subscription.delete();
            }
        }
    }
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) ReceiveTaskActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.ReceiveTaskActivityBehavior) CancelBoundaryEventActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.CancelBoundaryEventActivityBehavior) SubProcessActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.SubProcessActivityBehavior) MultiInstanceActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior) ReceiveTaskActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.ReceiveTaskActivityBehavior) CompensationEventActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.CompensationEventActivityBehavior) EventSubProcessActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.EventSubProcessActivityBehavior) CompositeActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.CompositeActivityBehavior) SequentialMultiInstanceActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.SequentialMultiInstanceActivityBehavior) ActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior) CancelEndEventActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.CancelEndEventActivityBehavior) EventSubscriptionEntity(org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity) MultiInstanceActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior) SequentialMultiInstanceActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.SequentialMultiInstanceActivityBehavior)

Example 23 with ActivityImpl

use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.

the class PvmAtomicOperationActivityLeave method execute.

public void execute(PvmExecutionImpl execution) {
    execution.activityInstanceDone();
    ActivityBehavior activityBehavior = getActivityBehavior(execution);
    if (activityBehavior instanceof FlowNodeActivityBehavior) {
        FlowNodeActivityBehavior behavior = (FlowNodeActivityBehavior) activityBehavior;
        ActivityImpl activity = execution.getActivity();
        String activityInstanceId = execution.getActivityInstanceId();
        if (activityInstanceId != null) {
            LOG.debugLeavesActivityInstance(execution, activityInstanceId);
        }
        try {
            behavior.doLeave(execution);
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new PvmException("couldn't leave activity <" + activity.getProperty("type") + " id=\"" + activity.getId() + "\" ...>: " + e.getMessage(), e);
        }
    } else {
        throw new PvmException("Behavior of current activity is not an instance of " + FlowNodeActivityBehavior.class.getSimpleName() + ". Execution " + execution);
    }
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) FlowNodeActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.FlowNodeActivityBehavior) ActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior) ActivityBehaviorUtil.getActivityBehavior(org.camunda.bpm.engine.impl.util.ActivityBehaviorUtil.getActivityBehavior) FlowNodeActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.FlowNodeActivityBehavior) PvmException(org.camunda.bpm.engine.impl.pvm.PvmException) PvmException(org.camunda.bpm.engine.impl.pvm.PvmException)

Example 24 with ActivityImpl

use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.

the class DefaultConditionHandler method evaluateConditionStartByEventSubscription.

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;
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) ArrayList(java.util.ArrayList) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity) EventSubscriptionEntity(org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity)

Example 25 with ActivityImpl

use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.

the class TimerStartEventSubprocessJobHandler method execute.

public void execute(TimerJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) {
    String activityId = configuration.getTimerElementKey();
    ActivityImpl eventSubprocessActivity = execution.getProcessDefinition().findActivity(activityId);
    if (eventSubprocessActivity != null) {
        execution.executeEventHandlerActivity(eventSubprocessActivity);
    } else {
        throw new ProcessEngineException("Error while triggering event subprocess using timer start event: cannot find activity with id '" + configuration + "'.");
    }
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Aggregations

ActivityImpl (org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)94 Deployment (org.camunda.bpm.engine.test.Deployment)29 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)12 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)12 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)10 ScopeImpl (org.camunda.bpm.engine.impl.pvm.process.ScopeImpl)10 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)8 TransitionImpl (org.camunda.bpm.engine.impl.pvm.process.TransitionImpl)8 EventSubscriptionEntity (org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity)7 PvmExecutionImpl (org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl)7 MigrationInstruction (org.camunda.bpm.engine.migration.MigrationInstruction)5 ActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior)4 ArrayList (java.util.ArrayList)3 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)3 PvmTransition (org.camunda.bpm.engine.impl.pvm.PvmTransition)3 ConditionalEventBehavior (org.camunda.bpm.engine.impl.bpmn.behavior.ConditionalEventBehavior)2 MultiInstanceActivityBehavior (org.camunda.bpm.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior)2 SequentialMultiInstanceActivityBehavior (org.camunda.bpm.engine.impl.bpmn.behavior.SequentialMultiInstanceActivityBehavior)2 CoreModelElement (org.camunda.bpm.engine.impl.core.model.CoreModelElement)2 AsyncContinuationConfiguration (org.camunda.bpm.engine.impl.jobexecutor.AsyncContinuationJobHandler.AsyncContinuationConfiguration)2