super.eventNotificationsCompleted(execution);
ActivityImpl activity = execution.getActivity();
ProcessDefinitionImpl processDefinition = execution.getProcessDefinition();
ProcessInstanceStartContext processInstanceStartContext = execution.getProcessInstanceStartContext();
if (processInstanceStartContext==null) {
// The ProcessInstanceStartContext is set on the process instance / parent execution - grab it from there:
PvmExecutionImpl executionToUse = execution;
while (processInstanceStartContext==null) {
executionToUse = execution.getParent();
processInstanceStartContext = executionToUse.getProcessInstanceStartContext();
}
}
if (activity== processInstanceStartContext.getInitial()) {
processInstanceStartContext.initialStarted(execution);
execution.disposeProcessInstanceStartContext();
execution.performOperation(ACTIVITY_EXECUTE);
} else {
List<ActivityImpl> initialActivityStack = processDefinition.getInitialActivityStack(processInstanceStartContext.getInitial());
int index = initialActivityStack.indexOf(activity);
// starting the next one
activity = initialActivityStack.get(index+1);
// and search for the correct execution to set the Activity to