if (1 != toViewIdList.getLength()) {
throw new XPathExpressionException("Within <navigation-case>, must have exactly one <to-view-id>");
}
String toViewId = toViewIdList.item(0).getNodeValue().trim();
NavigationCaseBuilder ncb = flowBuilder.navigationCase();
ncb.fromViewId(fromViewId).toViewId(toViewId);
{
NodeList fromOutcomeList = (NodeList)
xpath.evaluate(".//ns1:from-outcome/text()", navCase, XPathConstants.NODESET);
if (null != fromOutcomeList && 1 < fromOutcomeList.getLength()) {
throw new XPathExpressionException("Within <navigation-case>, must have at most one <from-outcome>");
}
if (null != fromOutcomeList && 1 == fromOutcomeList.getLength()) {
String fromOutcome = fromOutcomeList.item(0).getNodeValue().trim();
ncb.fromOutcome(fromOutcome);
}
}
{
NodeList fromActionList = (NodeList)
xpath.evaluate(".//ns1:from-action/text()", navCase, XPathConstants.NODESET);
if (null != fromActionList && 1 < fromActionList.getLength()) {
throw new XPathExpressionException("Within <navigation-case>, must have at most one <from-action>");
}
if (null != fromActionList && 1 == fromActionList.getLength()) {
String fromAction = fromActionList.item(0).getNodeValue().trim();
ncb.fromAction(fromAction);
}
}
{
NodeList ifList = (NodeList)
xpath.evaluate(".//ns1:if/text()", navCase, XPathConstants.NODESET);
if (null != ifList && 1 < ifList.getLength()) {
throw new XPathExpressionException("Within <navigation-case>, must have zero or one <if>");
}
if (null != ifList && 1 == ifList.getLength()) {
String ifStr = ifList.item(0).getNodeValue().trim();
ncb.condition(ifStr);
}
}
{
NodeList redirectList = (NodeList)
xpath.evaluate(".//ns1:redirect", navCase, XPathConstants.NODESET);
if (null != redirectList && 1 < redirectList.getLength()) {
throw new XPathExpressionException("Within <navigation-case>, must have zero or one <redirect>");
}
if (null != redirectList && 1 == redirectList.getLength()) {
NavigationCaseBuilder.RedirectBuilder redirector = ncb.redirect();
Node redirectNode = redirectList.item(0);
String includeViewParams = getAttribute(redirectNode, "include-view-params");
if (null != includeViewParams && "true".equalsIgnoreCase(includeViewParams)) {
redirector.includeViewParams();
}