use of org.camunda.bpm.engine.impl.pvm.runtime.InstantiationStack 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);
}
}
use of org.camunda.bpm.engine.impl.pvm.runtime.InstantiationStack 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);
}
use of org.camunda.bpm.engine.impl.pvm.runtime.InstantiationStack 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);
}
}
Aggregations