use of com.dexels.navajo.document.navascript.tags.LoopTag in project navajo by Dexels.
the class NS3ToNSXML method parseInnerBody.
private List<NS3Compatible> parseInnerBody(NS3Compatible parent, XMLElement currentXML) throws Exception {
currentXML.setAttribute("PROCESSED", "true");
List<NS3Compatible> bodyElts = new ArrayList<>();
Vector<XMLElement> children = currentXML.getChildren();
for (XMLElement child : children) {
String name = child.getName();
String content = (child.getContent() != null && !"".equals(child.getContent()) ? child.getContent() : null);
if (name.equals("Print")) {
DebugTag pt = parsePrint(parent, child);
bodyElts.add(pt);
}
if (name.equals("Log")) {
LogTag pt = parseLog(parent, child);
bodyElts.add(pt);
}
if (name.equals("Property")) {
NS3Compatible pt = parseProperty(parent, child);
bodyElts.add(pt);
}
if (name.equals("Option")) {
// Find type of option: name, value or selected
NS3Compatible pt = parseProperty(parent, child);
bodyElts.add(pt);
}
if (name.equals("Map")) {
MapTag mt = parseMap(parent, child);
bodyElts.add(mt);
}
if (name.equals("Var")) {
ParamTag pt = parseVar(parent, child);
bodyElts.add(pt);
}
if (name.equals("Break")) {
BreakTag mt = parseBreak(parent, child);
bodyElts.add(mt);
}
if (name.equals("Include")) {
IncludeTag mt = parseInclude(parent, child);
bodyElts.add(mt);
}
if (name.equals("Message")) {
MessageTag pt = parseMessage(parent, child);
bodyElts.add(pt);
}
if (name.equals("Synchronized")) {
SynchronizedTag st = parseSynchronizedBlock(parent, child);
bodyElts.add(st);
}
if (name.equals("ConditionalEmptyMessage")) {
BlockTag pt = parseConditionalBlock(parent, child, true);
bodyElts.add(pt);
}
if (name.equals("TopLevelStatement")) {
bodyElts.addAll(parseInnerBody(parent, child));
}
if (name.equals("MethodOrSetter")) {
MapTag parentMap = findClosestMapTag(parent, "");
FieldTag ft = parseMethodOrSetter(parentMap, child);
bodyElts.add(ft);
}
if (name.equals("Loop")) {
LoopTag mt = parseLoop(parent, child);
bodyElts.add(mt);
}
}
return bodyElts;
}
use of com.dexels.navajo.document.navascript.tags.LoopTag in project navajo by Dexels.
the class NS3ToNSXML method parseXML.
private void parseXML(NS3Compatible parent, XMLElement xe, int level) throws Exception {
if (xe.getAttribute("PROCESSED") != null) {
return;
}
String name = xe.getName();
String content = (xe.getContent() != null && !"".equals(xe.getContent()) ? xe.getContent() : null);
if (name.equals("DebugDefinition")) {
parseHeaderDefinitions(xe);
} else if (name.equals("Validations")) {
ValidationsTag vt = parseValidations(parent, xe);
myNavascript.addValidations(vt);
} else if (name.equals("Var")) {
ParamTag pt = parseVar(parent, xe);
addChildTag(parent, pt);
} else if (name.equals("Message")) {
MessageTag mt = parseMessage(parent, xe);
addChildTag(parent, mt);
} else if (name.equals("ConditionalEmptyMessage")) {
BlockTag mt = parseConditionalBlock(parent, xe, true);
addChildTag(parent, mt);
} else if (name.equals("Loop")) {
LoopTag mt = parseLoop(parent, xe);
addChildTag(parent, mt);
} else if (name.equals("Synchronized")) {
SynchronizedTag st = parseSynchronizedBlock(parent, xe);
addChildTag(parent, st);
} else if (name.equals("Map")) {
MapTag mt = parseMap(parent, xe);
addChildTag(parent, mt);
} else if (name.equals("Break")) {
BreakTag mt = parseBreak(parent, xe);
addChildTag(parent, mt);
} else if (name.equals("Include")) {
IncludeTag it = parseInclude(parent, xe);
addChildTag(parent, it);
} else if (name.equals("Define")) {
DefineTag dt = parseDefine(parent, xe);
addDefine(dt);
} else if (name.equals("Print")) {
DebugTag dt = parsePrint(parent, xe);
addChildTag(parent, dt);
} else if (name.equals("Log")) {
LogTag dt = parseLog(parent, xe);
addChildTag(parent, dt);
} else if (name.equals("Finally")) {
FinallyTag ft = parseFinally(parent, xe);
addChildTag(parent, ft);
} else if (name.equals("Methods")) {
MethodsTag mt = parseMethods(parent, xe);
addChildTag(parent, mt);
} else {
Vector<XMLElement> children = xe.getChildren();
for (XMLElement x : children) {
if (x.getAttribute("PROCESSED") == null) {
parseXML(parent, x, level + 1);
}
}
}
}
use of com.dexels.navajo.document.navascript.tags.LoopTag in project navajo by Dexels.
the class NS3ToNSXML method parseLoop.
private LoopTag parseLoop(NS3Compatible parent, XMLElement currentXML) throws Exception {
// Define arraymessage adapter
LoopTag mt = new LoopTag(myNavascript);
// mt.setName("arraymessage");
mt.addParent(parent);
// Define map for mapped array message of array field
MapTag ref = new MapTag(myNavascript);
ref.setOldStyleMap(true);
mt.addMap(ref);
Vector<XMLElement> children = currentXML.getChildren();
boolean hasFilter = false;
for (XMLElement child : children) {
String name = child.getName();
String content = (child.getContent() != null && !"".equals(child.getContent()) ? child.getContent() : null);
if (name.equals("Conditional")) {
ConditionFragment currentFragment = new ConditionFragment();
consumeContent(currentFragment, child);
mt.setCondition(currentFragment.consumedFragment());
}
if (name.equals("MsgIdentifier")) {
ref.setRefAttribute("[" + content + "]");
}
if (name.equals("MappableIdentifier")) {
String fieldRef = parseMappableIdentifier(child);
ref.setRefAttribute(fieldRef);
}
if (name.equals("TOKEN") && content.equals("filter")) {
hasFilter = true;
}
if (hasFilter && name.equals("Expression")) {
ExpressionFragment ef = new ExpressionFragment();
consumeContent(ef, child);
ref.setFilter(ef.consumedFragment());
}
if (name.equals("InnerBody") || name.equals("InnerBodySelection")) {
List<NS3Compatible> innerBodyElements = parseInnerBody(ref, child);
for (NS3Compatible ib : innerBodyElements) {
addChildTag(ref, ib);
}
}
}
return mt;
}
Aggregations