public SplitResult process(RouteContext context, RouteHelper helper) throws Exception {
   DocumentContent docContent = context.getDocumentContent();
   Document xmlDocument = docContent.getDocument();
   NodeList branchNumberElements = xmlDocument.getElementsByTagName(BRANCH_NUMBER_ELEMENT);
   if (branchNumberElements != null && branchNumberElements.getLength() != 0) {
     Element branchNumberElement = (Element) branchNumberElements.item(0);
     String branchNumber = branchNumberElement.getTextContent();
     if (branchNumber != null && !branchNumber.trim().equals("")) {
       List<String> branchNames = new ArrayList<String>();
       branchNames.add("Branch" + branchNumber);
       return new SplitResult(branchNames);
     }
   }
   // if they didn't submit xml that helps us identify the branch number, just take all branches
   return super.process(context, helper);
 }
Exemplo n.º 2
0
 private static Element getRootElement(DocumentContent docContent) {
   Element rootElement = null;
   try {
     rootElement = XmlHelper.buildJDocument(docContent.getDocument()).getRootElement();
   } catch (Exception e) {
     throw new WorkflowServiceErrorException("Invalid XML submitted", new ArrayList<Object>());
   }
   return rootElement;
 }