// 2) Adopt the children and datamodel
if (externalSCXML == null) {
return;
}
State s = (State) digester.peek();
if (fragment == null) {
// All targets pulled in since its not a src fragment
Initial ini = new Initial();
Transition t = new Transition();
t.setNext(externalSCXML.getInitialstate());
ini.setTransition(t);
s.setInitial(ini);
Map children = externalSCXML.getChildren();
Iterator childIter = children.values().iterator();
while (childIter.hasNext()) {
s.addChild((TransitionTarget) childIter.next());
}
s.setDatamodel(externalSCXML.getDatamodel());
} else {
// Need to pull in descendent targets
Object source = externalSCXML.getTargets().get(fragment);
if (source == null) {
org.apache.commons.logging.Log log = LogFactory.
getLog(SCXMLDigester.class);
log.error("Unknown fragment in <state src=\"" + path +
"\">");
return;
}
if (source instanceof State) {
State include = (State) source;
s.setOnEntry(include.getOnEntry());
s.setOnExit(include.getOnExit());
s.setDatamodel(include.getDatamodel());
List histories = include.getHistory();
for (int i = 0; i < histories.size(); i++) {
History h = (History) histories.get(i);
s.addHistory(h);
parent.addTarget(h);
}
Iterator childIter = include.getChildren().values().iterator();
while (childIter.hasNext()) {
TransitionTarget tt = (TransitionTarget) childIter.next();
s.addChild(tt);
parent.addTarget(tt);
addTargets(parent, tt);
}
s.setInvoke(include.getInvoke());
s.setFinal(include.isFinal());
if (include.getInitial() != null) {
s.setInitial(include.getInitial());
}
Iterator transIter = include.getTransitionsList().iterator();
while (transIter.hasNext()) {
s.addTransition((Transition) transIter.next());
}
} else {
org.apache.commons.logging.Log log = LogFactory.