Beispiel #1
0
  /**
   * Stores value of previously defined XML node
   *
   * @param text - value of node
   */
  public void setValue(String text) {
    readyForNewLine = false;
    tagIsEmpty = false;
    finishTag();

    if (lastTagHadAttributes) {
      writer.write(
          LF
              + WikiTableDriver.DELIM
              + WikiTableDriver.QUOTES
              + WikiTableDriver.SET_VALUE
              + WikiTableDriver.QUOTES
              + WikiTableDriver.DELIM);
      quickNodeValue = false;
    } else {
      String startTag =
          StringHelper.replace(
              writer.substring(startPointer),
              WikiTableDriver.START_NODE,
              WikiTableDriver.SET_NODE_VALUE);

      if (this.useLineSeparateBetweenTags) {
        writer.write(LF + WikiTableDriver.DELIM);
      }

      writer.setPointer(startPointer);
      writer.write(startTag);
      quickNodeValue = true;
    }

    writeText(writer, text);
    writer.write(WikiTableDriver.DELIM);
  }
 public void render(StringBuffer buffer, String alias, Map enabledFilters) {
   if (filterNames != null && filterNames.length > 0) {
     for (int i = 0, max = filterNames.length; i < max; i++) {
       if (enabledFilters.containsKey(filterNames[i])) {
         final String condition = filterConditions[i];
         if (StringHelper.isNotEmpty(condition)) {
           buffer
               .append(" and ")
               .append(StringHelper.replace(condition, FilterImpl.MARKER, alias));
         }
       }
     }
   }
 }
 /**
  * The map of defined filters. This is expected to be in format where the filter names are the map
  * keys, and the defined conditions are the values.
  *
  * @param filters The map of defined filters.
  * @param dialect The sql dialect
  * @param functionRegistry The SQL function registry
  */
 public FilterHelper(Map filters, Dialect dialect, SQLFunctionRegistry functionRegistry) {
   int filterCount = filters.size();
   filterNames = new String[filterCount];
   filterConditions = new String[filterCount];
   Iterator iter = filters.entrySet().iterator();
   filterCount = 0;
   while (iter.hasNext()) {
     final Map.Entry entry = (Map.Entry) iter.next();
     filterNames[filterCount] = (String) entry.getKey();
     filterConditions[filterCount] =
         Template.renderWhereStringTemplate(
             (String) entry.getValue(), FilterImpl.MARKER, dialect, functionRegistry);
     filterConditions[filterCount] =
         StringHelper.replace(
             filterConditions[filterCount], ":", ":" + filterNames[filterCount] + ".");
     filterCount++;
   }
 }