Search in sources :

Example 11 with ActivityBehavior

use of org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior in project camunda-bpm-platform by camunda.

the class BpmnParse method parseBoundaryCancelEventDefinition.

protected ActivityBehavior parseBoundaryCancelEventDefinition(Element cancelEventDefinition, ActivityImpl activity) {
    activity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.BOUNDARY_CANCEL);
    LegacyBehavior.parseCancelBoundaryEvent(activity);
    ActivityImpl transaction = (ActivityImpl) activity.getEventScope();
    if (transaction.getActivityBehavior() != null && transaction.getActivityBehavior() instanceof MultiInstanceActivityBehavior) {
        transaction = transaction.getActivities().get(0);
    }
    if (!"transaction".equals(transaction.getProperty(BpmnProperties.TYPE.getName()))) {
        addError("boundary event with cancelEventDefinition only supported on transaction subprocesses", cancelEventDefinition);
    }
    // ensure there is only one cancel boundary event
    for (ActivityImpl sibling : activity.getFlowScope().getActivities()) {
        if ("cancelBoundaryCatch".equals(sibling.getProperty(BpmnProperties.TYPE.getName())) && sibling != activity && sibling.getEventScope() == transaction) {
            addError("multiple boundary events with cancelEventDefinition not supported on same transaction subprocess", cancelEventDefinition);
        }
    }
    // find all cancel end events
    for (ActivityImpl childActivity : transaction.getActivities()) {
        ActivityBehavior activityBehavior = childActivity.getActivityBehavior();
        if (activityBehavior != null && activityBehavior instanceof CancelEndEventActivityBehavior) {
            ((CancelEndEventActivityBehavior) activityBehavior).setCancelBoundaryEvent(activity);
        }
    }
    return new CancelBoundaryEventActivityBehavior();
}
Also used : ActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior)

Example 12 with ActivityBehavior

use of org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior in project camunda-bpm-platform by camunda.

the class LegacyBehavior method eventSubprocessConcurrentChildExecutionEnded.

public static boolean eventSubprocessConcurrentChildExecutionEnded(ActivityExecution scopeExecution, ActivityExecution endedExecution) {
    boolean performLegacyBehavior = isLegacyBehaviorRequired(endedExecution);
    if (performLegacyBehavior) {
        LOG.endConcurrentExecutionInEventSubprocess();
        // notify the grandparent flow scope in a similar way PvmAtomicOperationAcitivtyEnd does
        ScopeImpl flowScope = endedExecution.getActivity().getFlowScope();
        if (flowScope != null) {
            flowScope = flowScope.getFlowScope();
            if (flowScope != null) {
                if (flowScope == endedExecution.getActivity().getProcessDefinition()) {
                    endedExecution.remove();
                    scopeExecution.tryPruneLastConcurrentChild();
                    scopeExecution.forceUpdate();
                } else {
                    PvmActivity flowScopeActivity = (PvmActivity) flowScope;
                    ActivityBehavior activityBehavior = flowScopeActivity.getActivityBehavior();
                    if (activityBehavior instanceof CompositeActivityBehavior) {
                        ((CompositeActivityBehavior) activityBehavior).concurrentChildExecutionEnded(scopeExecution, endedExecution);
                    }
                }
            }
        }
    }
    return performLegacyBehavior;
}
Also used : CompositeActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.CompositeActivityBehavior) 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) ScopeImpl(org.camunda.bpm.engine.impl.pvm.process.ScopeImpl) PvmActivity(org.camunda.bpm.engine.impl.pvm.PvmActivity)

Example 13 with ActivityBehavior

use of org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior in project camunda-bpm-platform by camunda.

the class LegacyBehavior method wasNoScope72.

protected static boolean wasNoScope72(ActivityImpl activity) {
    ActivityBehavior activityBehavior = activity.getActivityBehavior();
    ActivityBehavior parentActivityBehavior = (ActivityBehavior) (activity.getFlowScope() != null ? activity.getFlowScope().getActivityBehavior() : null);
    return (activityBehavior instanceof EventSubProcessActivityBehavior) || (activityBehavior instanceof SubProcessActivityBehavior && parentActivityBehavior instanceof SequentialMultiInstanceActivityBehavior) || (activityBehavior instanceof ReceiveTaskActivityBehavior && parentActivityBehavior instanceof MultiInstanceActivityBehavior);
}
Also used : SequentialMultiInstanceActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.SequentialMultiInstanceActivityBehavior) 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) EventSubProcessActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.EventSubProcessActivityBehavior) SubProcessActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.SubProcessActivityBehavior) EventSubProcessActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.EventSubProcessActivityBehavior) MultiInstanceActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior) SequentialMultiInstanceActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.SequentialMultiInstanceActivityBehavior)

Example 14 with ActivityBehavior

use of org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior 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)

Aggregations

ActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior)14 CompositeActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.CompositeActivityBehavior)4 ActivityImpl (org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)4 CancelBoundaryEventActivityBehavior (org.camunda.bpm.engine.impl.bpmn.behavior.CancelBoundaryEventActivityBehavior)3 CancelEndEventActivityBehavior (org.camunda.bpm.engine.impl.bpmn.behavior.CancelEndEventActivityBehavior)3 CompensationEventActivityBehavior (org.camunda.bpm.engine.impl.bpmn.behavior.CompensationEventActivityBehavior)3 EventSubProcessActivityBehavior (org.camunda.bpm.engine.impl.bpmn.behavior.EventSubProcessActivityBehavior)3 MultiInstanceActivityBehavior (org.camunda.bpm.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior)3 ReceiveTaskActivityBehavior (org.camunda.bpm.engine.impl.bpmn.behavior.ReceiveTaskActivityBehavior)3 SequentialMultiInstanceActivityBehavior (org.camunda.bpm.engine.impl.bpmn.behavior.SequentialMultiInstanceActivityBehavior)3 SubProcessActivityBehavior (org.camunda.bpm.engine.impl.bpmn.behavior.SubProcessActivityBehavior)3 PvmActivity (org.camunda.bpm.engine.impl.pvm.PvmActivity)3 SignallableActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.SignallableActivityBehavior)3 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)2 ScopeImpl (org.camunda.bpm.engine.impl.pvm.process.ScopeImpl)2 Element (org.camunda.bpm.engine.impl.util.xml.Element)2 Callable (java.util.concurrent.Callable)1 JavaDelegate (org.camunda.bpm.engine.delegate.JavaDelegate)1 ConditionalEventBehavior (org.camunda.bpm.engine.impl.bpmn.behavior.ConditionalEventBehavior)1 FlowNodeActivityBehavior (org.camunda.bpm.engine.impl.bpmn.behavior.FlowNodeActivityBehavior)1