if (log.isDebugEnabled()) {
log.debug("Leaving activity '{}'", execution.getActivity().getId());
}
PvmTransition outgoingSeqFlow = null;
String defaultSequenceFlow = (String) execution.getActivity().getProperty("default");
Iterator<PvmTransition> transitionIterator = execution.getActivity().getOutgoingTransitions().iterator();
while (outgoingSeqFlow == null && transitionIterator.hasNext()) {
PvmTransition seqFlow = transitionIterator.next();
Condition condition = (Condition) seqFlow.getProperty(BpmnParse.PROPERTYNAME_CONDITION);
if ( (condition == null && (defaultSequenceFlow == null || !defaultSequenceFlow.equals(seqFlow.getId())) )
|| (condition != null && condition.evaluate(execution)) ) {
if (log.isDebugEnabled()) {
log.debug("Sequence flow '{}'selected as outgoing sequence flow.", seqFlow.getId());
}
outgoingSeqFlow = seqFlow;
}
}
if (outgoingSeqFlow != null) {
execution.take(outgoingSeqFlow);
} else {
if (defaultSequenceFlow != null) {
PvmTransition defaultTransition = execution.getActivity().findOutgoingTransition(defaultSequenceFlow);
if (defaultTransition != null) {
execution.take(defaultTransition);
} else {
throw new ActivitiException("Default sequence flow '" + defaultSequenceFlow + "' not found");
}