Search in sources :

Example 36 with PvmExecutionImpl

use of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl 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 37 with PvmExecutionImpl

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

the class PvmAtomicOperationDeleteCascade method execute.

public void execute(PvmExecutionImpl execution) {
    PvmExecutionImpl nextLeaf;
    do {
        nextLeaf = findNextLeaf(execution);
        // propagate skipCustomListeners property
        PvmExecutionImpl deleteRoot = getDeleteRoot(execution);
        if (deleteRoot != null) {
            nextLeaf.setSkipCustomListeners(deleteRoot.isSkipCustomListeners());
            nextLeaf.setSkipIoMappings(deleteRoot.isSkipIoMappings());
        }
        PvmExecutionImpl subProcessInstance = nextLeaf.getSubProcessInstance();
        if (subProcessInstance != null) {
            if (deleteRoot.isSkipSubprocesses()) {
                subProcessInstance.setSuperExecution(null);
            } else {
                subProcessInstance.deleteCascade(execution.getDeleteReason(), nextLeaf.isSkipCustomListeners(), nextLeaf.isSkipIoMappings());
            }
        }
        nextLeaf.performOperation(DELETE_CASCADE_FIRE_ACTIVITY_END);
    } while (!nextLeaf.isDeleteRoot());
}
Also used : PvmExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl)

Example 38 with PvmExecutionImpl

use of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl 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

PvmExecutionImpl (org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl)38 PvmActivity (org.camunda.bpm.engine.impl.pvm.PvmActivity)13 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)7 ActivityImpl (org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)7 ArrayList (java.util.ArrayList)6 ScopeImpl (org.camunda.bpm.engine.impl.pvm.process.ScopeImpl)6 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)4 Map (java.util.Map)3 PvmTransition (org.camunda.bpm.engine.impl.pvm.PvmTransition)3 ActivityExecution (org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution)3 SubProcessActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.SubProcessActivityBehavior)3 HashMap (java.util.HashMap)2 TransferVariablesActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.TransferVariablesActivityBehavior)2 ActivityInstanceImpl (org.camunda.bpm.engine.impl.persistence.entity.ActivityInstanceImpl)2 EventSubscriptionEntity (org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity)2 ProcessDefinitionBuilder (org.camunda.bpm.engine.impl.pvm.ProcessDefinitionBuilder)2 PvmProcessDefinition (org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition)2 PvmProcessInstance (org.camunda.bpm.engine.impl.pvm.PvmProcessInstance)2 PvmScope (org.camunda.bpm.engine.impl.pvm.PvmScope)2 CompositeActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.CompositeActivityBehavior)2