if (logger.isDebugEnabled ()) {
logger.debug ("Initializing transition manager for " + process);
}
myProcess = process;
for (Iterator i = process.stepsLocal().iterator (); i.hasNext(); ) {
ExtActivityLocal a = (ExtActivityLocal)i.next();
String key = a.key();
transByTo.put (key, new ArrayList ());
transByFrom.put (key, new ArrayList ());
}
for (Iterator i = process.transitionsLocal().iterator ();
i.hasNext(); ) {
ExtTransitionLocal t = (ExtTransitionLocal)i.next();
Collection fts = (Collection)transByFrom.get(t.from().key());
if (fts == null) {
// this may happen in the case of block activites with
// exception triggered transitions, because there are
// no real activities instantiated
fts = new ArrayList ();
transByFrom.put (t.from().key(), fts);
}
fts.add (t);
((Collection)transByTo.get(t.to().key())).add (t);
}
for (Iterator i = transByFrom.keySet().iterator(); i.hasNext();) {
String key = (String)i.next();
Collections.sort ((List)transByFrom.get(key), transComp);
}
for (Iterator i = transByTo.keySet().iterator(); i.hasNext();) {
String key = (String)i.next();
Collections.sort ((List)transByTo.get(key), transComp);
}
for (Iterator i = process.stepsLocal().iterator (); i.hasNext(); ) {
ExtActivityLocal a = (ExtActivityLocal)i.next();
State as = a.typedState();
String ak = a.key();
if (as.isSameOrSubState(NotRunningState.NOT_STARTED)) {
if (as.isSameOrSubState (NotStartedState.STARTABLE)) {
startableActs.put (ak, a);
} else if (as.isSameOrSubState (NotStartedState.UNKNOWN)
&& (((Collection)transByTo.get(ak)).size () == 0)) {
a.setStartable (null, false);
if (logger.isDebugEnabled()) {
logger.debug (a + " set to startable");
}
startableActs.put (ak, a);
}