@Override
 public String put(K key, String value) {
   value = TemplateEngineHelper.externalizeTemplateString(template.getTemplateInfo(), value);
   String v = super.put(key, value);
   template.setDirty();
   return v;
 }
 @Override
 public void putAll(Map<? extends K, ? extends String> map) {
   for (K key : map.keySet()) {
     String value = map.get(key);
     value = TemplateEngineHelper.externalizeTemplateString(template.getTemplateInfo(), value);
     super.put(key, value);
   }
   template.setDirty();
 }
Beispiel #3
0
 /** @return boolean, true if Macros For Condition Evaluation Expandable. */
 private boolean areMacrosForConditionEvaluationExpandable() {
   if (macros != null) {
     Map<String, String> valueStore = template.getValueStore();
     for (String value : macros) {
       if (valueStore.get(value) == null) {
         return false;
       }
     }
   }
   return true;
 }
Beispiel #4
0
 /**
  * Return the Unexpandable Macro Message
  *
  * @return
  */
 private String getUnexpandableMacroMessage() {
   if (macros != null) {
     Map<String, String> valueStore = template.getValueStore();
     for (String value : macros) {
       if (valueStore.get(value) == null) {
         return Messages.getString("ConditionalProcessGroup.unexpandableMacro")
             + value; //$NON-NLS-1$
       }
     }
   }
   return null;
 }
Beispiel #5
0
 /** Initialises the template descriptor and Root Elements. */
 private void initialize() {
   TemplateDescriptor desc = template.getTemplateDescriptor();
   Element root = desc.getRootElement();
   conditionalProcessGroupList = new ArrayList<ConditionalProcessGroup>();
   List<Element> nodeList = TemplateEngine.getChildrenOfElementByTag(root, TemplateDescriptor.IF);
   for (int j = 0, l = nodeList.size(); j < l; j++) {
     conditionalProcessGroupList.add(
         new ConditionalProcessGroup(template, nodeList.get(j), j + 1));
   }
   // Collect all free-hanging processes in one ConditionalProcessGroup object with condition true.
   nodeList = TemplateEngine.getChildrenOfElementByTag(root, TemplateDescriptor.PROCESS);
   conditionalProcessGroupList.add(
       new ConditionalProcessGroup(template, nodeList.toArray(new Element[nodeList.size()])));
 }
Beispiel #6
0
 /** @return boolean, true if Condition Value is True. */
 public boolean isConditionValueTrue() {
   if (conditionString == null) {
     return true;
   }
   if (!areMacrosForConditionEvaluationExpandable()) {
     return false;
   }
   Map<String, String> valueStore = template.getValueStore();
   String processedLValue = ProcessHelper.getValueAfterExpandingMacros(lValue, macros, valueStore);
   String processedRValue = ProcessHelper.getValueAfterExpandingMacros(rValue, macros, valueStore);
   if (operator.equals(Operator.EQUALS)) {
     return processedLValue.equals(processedRValue);
   } else if (operator.equals(Operator.NOT_EQUALS)) {
     return !processedLValue.equals(processedRValue);
   } else {
     return false;
   }
 }
 @Override
 public int compare(TemplateCore t1, TemplateCore t2) {
   return String.CASE_INSENSITIVE_ORDER.compare(t1.getTemplateId(), t2.getTemplateId());
 }
 @Override
 public String remove(Object key) {
   String v = super.remove(key);
   template.setDirty();
   return v;
 }