Ejemplo n.º 1
0
 /**
  * Constructs a ConditionalProcess element from the supplied conditionElement (<if>) while
  * building Process objects out of each of the element's <process> children.
  */
 public ConditionalProcessGroup(TemplateCore template, Element conditionElement, int id) {
   this.id = "Condition " + id; // $NON-NLS-1$
   conditionString = conditionElement.getAttribute(ProcessHelper.CONDITION);
   if (conditionString != null) {
     if (conditionString.trim().equals("")) { // $NON-NLS-1$
       conditionString = null;
     } else {
       int op = conditionString.indexOf(ProcessHelper.EQUALS);
       if (op != -1) {
         this.operator = Operator.EQUALS;
         lValue = conditionString.substring(0, op);
         rValue = conditionString.substring(op + ProcessHelper.EQUALS.length());
       } else {
         op = conditionString.indexOf(ProcessHelper.NOT_EQUALS);
         if (op != -1) {
           this.operator = Operator.NOT_EQUALS;
           lValue = conditionString.substring(0, op);
           rValue = conditionString.substring(op + ProcessHelper.NOT_EQUALS.length());
         } // else an unsupported operation where this condition is ignored.
       }
       collectMacros(lValue);
       collectMacros(rValue);
     }
   }
   createProcessObjects(
       template,
       TemplateEngine.getChildrenOfElementByTag(conditionElement, TemplateDescriptor.PROCESS));
 }
Ejemplo n.º 2
0
 /**
  * Constructs a ConditionalProcess element from the supplied process elements while building
  * Process objects out of each of the supplied process elements (<process>). The condition
  * in this case is evaluated to true.
  *
  * <p>This Constructor is expected to be used to evaluate all those process elements that are
  * children of the template root element.
  */
 public ConditionalProcessGroup(TemplateCore template, Element[] processElements) {
   id = "No Condition"; // $NON-NLS-1$
   createProcessObjects(template, Arrays.asList(processElements));
 }