return;
}
for (int i_switch = 0; i_switch < switches.getLength(); i_switch++) {
Node switchNode = switches.item(i_switch);
String switchId = getIdAttribute(switchNode);
SwitchBuilder switchBuilder = flowBuilder.switchNode(switchId);
NodeList cases = (NodeList) xpath.evaluate(".//ns1:case",
switchNode, XPathConstants.NODESET);
if (null != cases) {
for (int i_case = 0; i_case < cases.getLength(); i_case++) {
Node caseNode = cases.item(i_case);
NodeList ifList = (NodeList)
xpath.evaluate(".//ns1:if/text()", caseNode, XPathConstants.NODESET);
if (1 < ifList.getLength()) {
throw new XPathExpressionException("Within <case> only one <if> child is allowed");
}
String ifStr = ifList.item(0).getNodeValue().trim();
NodeList fromOutcomeList = (NodeList)
xpath.evaluate(".//ns1:from-outcome/text()", caseNode, XPathConstants.NODESET);
if (1 < fromOutcomeList.getLength()) {
throw new XPathExpressionException("Within <case> only one <from-outcome> child is allowed");
}
String fromOutcomeStr = fromOutcomeList.item(0).getNodeValue().trim();
switchBuilder.switchCase().condition(ifStr).fromOutcome(fromOutcomeStr);
}
}
NodeList defaultOutcomeList = (NodeList)
xpath.evaluate(".//ns1:default-outcome/text()", switchNode, XPathConstants.NODESET);
if (null != defaultOutcomeList && 1 < defaultOutcomeList.getLength()) {
throw new XPathExpressionException("Within <switch> only one <default-outcome> child is allowed");
}
if (null != defaultOutcomeList) {
Node defaultOutcomeNode = defaultOutcomeList.item(0);
if (null != defaultOutcomeNode) {
String defaultOutcomeStr = defaultOutcomeNode.getNodeValue().trim();
switchBuilder.defaultOutcome(defaultOutcomeStr);
}
}
}