Collection resets = new ArrayList ();
Collection starts = new ArrayList ();
EvaluationContext ctx = new EvaluationContext (act, exception);
if (act.splitMode().isAND() || exception != null) {
// consider all transitions from this activity
ExtTransitionLocal defaultTrans = null;
boolean gotATrans = false;
for (Iterator i = ((Collection)transByFrom.get(act.key()))
.iterator (); i.hasNext();) {
ExtTransitionLocal trans = (ExtTransitionLocal)i.next();
if ((exception == null && trans.conditionType()
== de.danet.an.workflow.api.Transition.COND_TYPE_OTHERWISE)
|| (exception != null && trans.conditionType()
== de.danet.an.workflow.api
.Transition.COND_TYPE_DEFAULTEXCEPTION)) {
defaultTrans = trans;
continue;
}
if (ctx.transitOK (trans)) {
gotATrans = true;
if (!tryTransit (trans, resets, starts)) {
trans.setPendingToken(true);
}
}
}
if (!gotATrans && defaultTrans != null) {
if (logger.isDebugEnabled ()) {
logger.debug ("Trying default: " + defaultTrans);
}
if (!tryTransit(defaultTrans, resets, starts)) {
defaultTrans.setPendingToken(true);
}
}
} else /* act.splitMode().isXOR() */ {
// consider only first match of all transitions from this activity
String group = null;
for (Iterator i = ((Collection)transByFrom.get(act.key()))
.iterator (); i.hasNext();) {
ExtTransitionLocal trans = (ExtTransitionLocal)i.next();
boolean contTransit = false;
if (group != null) {
if (!trans.group().equals (group)) {
break; // end of group, quit.
}
contTransit = true;
}
if (logger.isDebugEnabled()) {
logger.debug ("Trying transition " + trans);
}
// note that reevalution of transit conditions is not
// necessary within a group, it's the same condition.
if (contTransit || ctx.transitOK (trans)) {
if (logger.isDebugEnabled ()) {
logger.debug ("... transit OK (continued: "
+ contTransit + ")");
}
if (!tryTransit (trans, resets, starts)) {
trans.setPendingToken(true);
}
group = trans.group(); // continue for group
}
}
}
boolean deferChoiceOnSplit = act.deferChoiceOnSplit ();
for (Iterator items = starts.iterator(); items.hasNext();) {