String transitionSourceName = (String) asyncExecutionInfo.get(KEY_TRANSITION_SOURCE);
TransitionImpl transition = null;
if (transitionSourceName!=null) {
ProcessDefinitionImpl processDefinition = execution.getProcessDefinition();
ActivityImpl transitionSource = processDefinition.findActivity(transitionSourceName);
Integer transitionIndex = (Integer) asyncExecutionInfo.get(KEY_TRANSITION_SOURCE_INDEX);
transition = (TransitionImpl) transitionSource.getOutgoingTransitions().get(transitionIndex);
execution.setTransition(transition);
}
if (asyncExecutionInfo.containsKey(KEY_EVENT_SOURCE_PROCESS_DEFINITION)){
ProcessDefinitionImpl processDefinition = execution.getProcessDefinition();
execution.setEventSource(processDefinition);
} else if (asyncExecutionInfo.containsKey(KEY_EVENT_SOURCE_ACTIVITY)){
ProcessDefinitionImpl processDefinition = execution.getProcessDefinition();
String activityName = (String) asyncExecutionInfo.get(KEY_EVENT_SOURCE_ACTIVITY);
ActivityImpl activity = processDefinition.findActivity(activityName);
execution.setEventSource(activity);
} else if (asyncExecutionInfo.containsKey(KEY_EVENT_SOURCE_TRANSITION)){
execution.setEventSource(transition);
}