Search in sources :

Example 36 with PvmActivity

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

the class AbstractBpmnActivityBehavior method createCompensateEventSubscription.

protected void createCompensateEventSubscription(ActivityExecution execution, ActivityImpl compensationHandler) {
    // the compensate event subscription is created at subprocess or miBody of the the current activity
    PvmActivity currentActivity = execution.getActivity();
    ActivityExecution scopeExecution = execution.findExecutionForFlowScope(currentActivity.getFlowScope());
    EventSubscriptionEntity.createAndInsert((ExecutionEntity) scopeExecution, EventType.COMPENSATE, compensationHandler);
}
Also used : ActivityExecution(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution) PvmActivity(org.camunda.bpm.engine.impl.pvm.PvmActivity)

Example 37 with PvmActivity

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

the class PvmAtomicOperationActivityInstanceEnd method eventNotificationsStarted.

@Override
protected PvmExecutionImpl eventNotificationsStarted(PvmExecutionImpl execution) {
    execution.incrementSequenceCounter();
    // hack around execution tree structure not being in sync with activity instance concept:
    // if we end a scope activity, take remembered activity instance from parent and set on
    // execution before calling END listeners.
    PvmExecutionImpl parent = execution.getParent();
    PvmActivity activity = execution.getActivity();
    if (parent != null && execution.isScope() && activity != null && activity.isScope() && (activity.getActivityBehavior() instanceof CompositeActivityBehavior || (CompensationBehavior.isCompensationThrowing(execution)) && !LegacyBehavior.isCompensationThrowing(execution))) {
        LOG.debugLeavesActivityInstance(execution, execution.getActivityInstanceId());
        // use remembered activity instance id from parent
        execution.setActivityInstanceId(parent.getActivityInstanceId());
        // make parent go one scope up.
        parent.leaveActivityInstance();
    }
    return execution;
}
Also used : PvmExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl) CompositeActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.CompositeActivityBehavior) PvmActivity(org.camunda.bpm.engine.impl.pvm.PvmActivity)

Example 38 with PvmActivity

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

the class PvmAtomicOperationActivityStartInterruptEventScope method getInterruptingActivity.

protected PvmActivity getInterruptingActivity(PvmExecutionImpl execution) {
    PvmActivity nextActivity = execution.getNextActivity();
    execution.setNextActivity(null);
    return nextActivity;
}
Also used : PvmActivity(org.camunda.bpm.engine.impl.pvm.PvmActivity)

Example 39 with PvmActivity

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

the class PvmAtomicOperationInterruptScope method execute.

public void execute(PvmExecutionImpl execution) {
    PvmActivity interruptingActivity = getInterruptingActivity(execution);
    PvmExecutionImpl scopeExecution = !execution.isScope() ? execution.getParent() : execution;
    if (scopeExecution != execution) {
        // remove the current execution before interrupting and continuing executing the interrupted activity
        // reason:
        // * interrupting should not attempt to fire end events for this execution
        // * the interruptingActivity is executed with the scope execution
        execution.remove();
    }
    scopeExecution.interrupt("Interrupting activity " + interruptingActivity + " executed.");
    scopeExecution.setActivity(interruptingActivity);
    scopeExecution.setActive(true);
    scopeExecution.setTransition(execution.getTransition());
    scopeInterrupted(scopeExecution);
}
Also used : PvmExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl) PvmActivity(org.camunda.bpm.engine.impl.pvm.PvmActivity)

Aggregations

PvmActivity (org.camunda.bpm.engine.impl.pvm.PvmActivity)39 PvmExecutionImpl (org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl)13 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)9 PvmTransition (org.camunda.bpm.engine.impl.pvm.PvmTransition)7 ActivityExecution (org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution)6 ScopeImpl (org.camunda.bpm.engine.impl.pvm.process.ScopeImpl)6 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)4 TransitionImpl (org.camunda.bpm.engine.impl.pvm.process.TransitionImpl)4 ReferenceWalker (org.camunda.bpm.engine.impl.tree.ReferenceWalker)4 ArrayList (java.util.ArrayList)3 PvmScope (org.camunda.bpm.engine.impl.pvm.PvmScope)3 ActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior)3 CompositeActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.CompositeActivityBehavior)3 List (java.util.List)2 ActivityImpl (org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)2 ProcessDefinitionImpl (org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl)2 ExecutionStartContext (org.camunda.bpm.engine.impl.pvm.runtime.ExecutionStartContext)2 ActivityExecutionHierarchyWalker (org.camunda.bpm.engine.impl.tree.ActivityExecutionHierarchyWalker)2 ActivityExecutionMappingCollector (org.camunda.bpm.engine.impl.tree.ActivityExecutionMappingCollector)2 ActivityExecutionTuple (org.camunda.bpm.engine.impl.tree.ActivityExecutionTuple)2