Search in sources :

Example 1 with ExecutionStartContext

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

the class PvmAtomicOperationActivityInitStackNotifyListenerReturn method eventNotificationsCompleted.

protected void eventNotificationsCompleted(PvmExecutionImpl execution) {
    super.eventNotificationsCompleted(execution);
    ExecutionStartContext startContext = execution.getExecutionStartContext();
    InstantiationStack instantiationStack = startContext.getInstantiationStack();
    // if the stack has been instantiated
    if (instantiationStack.getActivities().isEmpty()) {
        // done
        return;
    } else {
        // else instantiate the activity stack further
        execution.setActivity(null);
        execution.performOperation(ACTIVITY_INIT_STACK_AND_RETURN);
    }
}
Also used : InstantiationStack(org.camunda.bpm.engine.impl.pvm.runtime.InstantiationStack) ExecutionStartContext(org.camunda.bpm.engine.impl.pvm.runtime.ExecutionStartContext)

Example 2 with ExecutionStartContext

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

the class PvmAtomicOperationActivityStart method eventNotificationsCompleted.

@Override
protected void eventNotificationsCompleted(PvmExecutionImpl execution) {
    super.eventNotificationsCompleted(execution);
    ExecutionStartContext executionStartContext = execution.getExecutionStartContext();
    if (executionStartContext != null) {
        executionStartContext.executionStarted(execution);
        execution.disposeExecutionStartContext();
    }
    execution.dispatchDelayedEventsAndPerformOperation(ACTIVITY_EXECUTE);
}
Also used : ExecutionStartContext(org.camunda.bpm.engine.impl.pvm.runtime.ExecutionStartContext)

Example 3 with ExecutionStartContext

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

the class PvmAtomicOperationActivityInitStack method execute.

public void execute(PvmExecutionImpl execution) {
    ExecutionStartContext executionStartContext = execution.getExecutionStartContext();
    InstantiationStack instantiationStack = executionStartContext.getInstantiationStack();
    List<PvmActivity> activityStack = instantiationStack.getActivities();
    PvmActivity currentActivity = activityStack.remove(0);
    PvmExecutionImpl propagatingExecution = execution;
    if (currentActivity.isScope()) {
        propagatingExecution = execution.createExecution();
        execution.setActive(false);
        propagatingExecution.setActivity(currentActivity);
        propagatingExecution.initialize();
    } else {
        propagatingExecution.setActivity(currentActivity);
    }
    // notify listeners for the instantiated activity
    propagatingExecution.performOperation(operationOnScopeInitialization);
}
Also used : InstantiationStack(org.camunda.bpm.engine.impl.pvm.runtime.InstantiationStack) PvmExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl) ExecutionStartContext(org.camunda.bpm.engine.impl.pvm.runtime.ExecutionStartContext) PvmActivity(org.camunda.bpm.engine.impl.pvm.PvmActivity)

Example 4 with ExecutionStartContext

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

the class PvmAtomicOperationActivityInitStackNotifyListenerStart method eventNotificationsCompleted.

protected void eventNotificationsCompleted(PvmExecutionImpl execution) {
    super.eventNotificationsCompleted(execution);
    execution.activityInstanceStarted();
    ExecutionStartContext startContext = execution.getExecutionStartContext();
    InstantiationStack instantiationStack = startContext.getInstantiationStack();
    PvmExecutionImpl propagatingExecution = execution;
    ActivityImpl activity = execution.getActivity();
    if (activity.getActivityBehavior() instanceof ModificationObserverBehavior) {
        ModificationObserverBehavior behavior = (ModificationObserverBehavior) activity.getActivityBehavior();
        List<ActivityExecution> concurrentExecutions = behavior.initializeScope(propagatingExecution, 1);
        propagatingExecution = (PvmExecutionImpl) concurrentExecutions.get(0);
    }
    // if the stack has been instantiated
    if (instantiationStack.getActivities().isEmpty() && instantiationStack.getTargetActivity() != null) {
        // as if we are entering the target activity instance id via a transition
        propagatingExecution.setActivityInstanceId(null);
        // execute the target activity with this execution
        startContext.applyVariables(propagatingExecution);
        propagatingExecution.setActivity(instantiationStack.getTargetActivity());
        propagatingExecution.performOperation(ACTIVITY_START_CREATE_SCOPE);
    } else if (instantiationStack.getActivities().isEmpty() && instantiationStack.getTargetTransition() != null) {
        // as if we are entering the target activity instance id via a transition
        propagatingExecution.setActivityInstanceId(null);
        // execute the target transition with this execution
        PvmTransition transition = instantiationStack.getTargetTransition();
        startContext.applyVariables(propagatingExecution);
        propagatingExecution.setActivity(transition.getSource());
        propagatingExecution.setTransition((TransitionImpl) transition);
        propagatingExecution.performOperation(TRANSITION_START_NOTIFY_LISTENER_TAKE);
    } else {
        // else instantiate the activity stack further
        propagatingExecution.setActivity(null);
        propagatingExecution.performOperation(ACTIVITY_INIT_STACK);
    }
}
Also used : TransitionImpl(org.camunda.bpm.engine.impl.pvm.process.TransitionImpl) ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) InstantiationStack(org.camunda.bpm.engine.impl.pvm.runtime.InstantiationStack) PvmExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl) ActivityExecution(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution) ExecutionStartContext(org.camunda.bpm.engine.impl.pvm.runtime.ExecutionStartContext) ModificationObserverBehavior(org.camunda.bpm.engine.impl.pvm.delegate.ModificationObserverBehavior) PvmTransition(org.camunda.bpm.engine.impl.pvm.PvmTransition)

Example 5 with ExecutionStartContext

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

the class PvmAtomicOperationTransitionNotifyListenerStart method eventNotificationsCompleted.

protected void eventNotificationsCompleted(PvmExecutionImpl execution) {
    super.eventNotificationsCompleted(execution);
    TransitionImpl transition = execution.getTransition();
    PvmActivity destination;
    if (transition == null) {
        // this is null after async cont. -> transition is not stored in execution
        destination = execution.getActivity();
    } else {
        destination = transition.getDestination();
    }
    execution.setTransition(null);
    execution.setActivity(destination);
    ExecutionStartContext executionStartContext = execution.getExecutionStartContext();
    if (executionStartContext != null) {
        executionStartContext.executionStarted(execution);
        execution.disposeExecutionStartContext();
    }
    execution.dispatchDelayedEventsAndPerformOperation(ACTIVITY_EXECUTE);
}
Also used : TransitionImpl(org.camunda.bpm.engine.impl.pvm.process.TransitionImpl) ExecutionStartContext(org.camunda.bpm.engine.impl.pvm.runtime.ExecutionStartContext) PvmActivity(org.camunda.bpm.engine.impl.pvm.PvmActivity)

Aggregations

ExecutionStartContext (org.camunda.bpm.engine.impl.pvm.runtime.ExecutionStartContext)6 InstantiationStack (org.camunda.bpm.engine.impl.pvm.runtime.InstantiationStack)3 PvmActivity (org.camunda.bpm.engine.impl.pvm.PvmActivity)2 TransitionImpl (org.camunda.bpm.engine.impl.pvm.process.TransitionImpl)2 PvmExecutionImpl (org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl)2 CaseExecutionEntity (org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity)1 PvmTransition (org.camunda.bpm.engine.impl.pvm.PvmTransition)1 ActivityExecution (org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution)1 ModificationObserverBehavior (org.camunda.bpm.engine.impl.pvm.delegate.ModificationObserverBehavior)1 ActivityImpl (org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)1