Search in sources :

Example 91 with ActivityImpl

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

the class EventBasedGatewayActivityBehavior method execute.

@Override
public void execute(ActivityExecution execution) throws Exception {
    // If conditional events exist after the event based gateway they should be evaluated.
    // If a condition is satisfied the event based gateway should be left,
    // otherwise the event based gateway is a wait state
    ActivityImpl eventBasedGateway = (ActivityImpl) execution.getActivity();
    for (ActivityImpl act : eventBasedGateway.getEventActivities()) {
        ActivityBehavior activityBehavior = act.getActivityBehavior();
        if (activityBehavior instanceof ConditionalEventBehavior) {
            ConditionalEventBehavior conditionalEventBehavior = (ConditionalEventBehavior) activityBehavior;
            ConditionalEventDefinition conditionalEventDefinition = conditionalEventBehavior.getConditionalEventDefinition();
            if (conditionalEventDefinition.tryEvaluate(execution)) {
                ((ExecutionEntity) execution).executeEventHandlerActivity(conditionalEventDefinition.getConditionalActivity());
                return;
            }
        }
    }
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) ActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior) ConditionalEventDefinition(org.camunda.bpm.engine.impl.bpmn.parser.ConditionalEventDefinition)

Example 92 with ActivityImpl

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

the class EventSubProcessStartConditionalEventActivityBehavior method leaveOnSatisfiedCondition.

@Override
public void leaveOnSatisfiedCondition(final EventSubscriptionEntity eventSubscription, final VariableEvent variableEvent) {
    PvmExecutionImpl execution = eventSubscription.getExecution();
    if (execution != null && !execution.isEnded() && execution.isScope() && conditionalEvent.tryEvaluate(variableEvent, execution)) {
        ActivityImpl activity = eventSubscription.getActivity();
        activity = (ActivityImpl) activity.getFlowScope();
        execution.executeEventHandlerActivity(activity);
    }
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) PvmExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl)

Example 93 with ActivityImpl

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

the class EventSubscriptionDeclaration method createSubscriptionForExecution.

/**
 * Creates and inserts a subscription entity depending on the message type of this declaration.
 */
public EventSubscriptionEntity createSubscriptionForExecution(ExecutionEntity execution) {
    EventSubscriptionEntity eventSubscriptionEntity = new EventSubscriptionEntity(execution, eventType);
    String eventName = resolveExpressionOfEventName(execution);
    eventSubscriptionEntity.setEventName(eventName);
    if (activityId != null) {
        ActivityImpl activity = execution.getProcessDefinition().findActivity(activityId);
        eventSubscriptionEntity.setActivity(activity);
    }
    eventSubscriptionEntity.insert();
    LegacyBehavior.removeLegacySubscriptionOnParent(execution, eventSubscriptionEntity);
    return eventSubscriptionEntity;
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) EventSubscriptionEntity(org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity)

Example 94 with ActivityImpl

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

the class DefaultFailedJobParseListener method parseActivity.

protected void parseActivity(Element element, ActivityImpl activity) {
    if (isMultiInstance(activity)) {
        // in case of multi-instance, the extension elements is set according to the async attributes
        // the extension for multi-instance body is set on the element of the activity
        ActivityImpl miBody = activity.getParentFlowScopeActivity();
        if (isAsync(miBody)) {
            setFailedJobRetryTimeCycleValue(element, miBody);
        }
        // the extension for inner activity is set on the multiInstanceLoopCharacteristics element
        if (isAsync(activity)) {
            Element multiInstanceLoopCharacteristics = element.element(MULTI_INSTANCE_LOOP_CHARACTERISTICS);
            setFailedJobRetryTimeCycleValue(multiInstanceLoopCharacteristics, activity);
        }
    } else if (isAsync(activity)) {
        setFailedJobRetryTimeCycleValue(element, activity);
    }
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) Element(org.camunda.bpm.engine.impl.util.xml.Element)

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