Class QueryUtil

java.lang.Object
com.webmethods.caf.jcr.faces.util.QueryUtil

public class QueryUtil extends Object
Helper utilities to assist in the construction of a JCR query string
  • Constructor Details

    • QueryUtil

      public QueryUtil()
  • Method Details

    • encodeForLikeClause

      public static String encodeForLikeClause(String rawValue, QueryUtil.QuoteChar wrappingQuoteCharacter)
      Encodes the special characters of a term to provide a valid like clause
      Parameters:
      rawValue - the value to encode
      wrappingQuoteCharacter - the character wrapping the term in the final query string
      Returns:
      encoded value safe to use in a query like clause
    • encodeAttributeValue

      public static String encodeAttributeValue(String rawValue, QueryUtil.QuoteChar wrappingQuoteCharacter)
      Encodes the special characters of a term to provide a valid attribute value match
      Parameters:
      rawValue - the value to encode
      wrappingQuoteCharacter - the character wrapping the term in the final query string
      Returns:
      encoded value safe to use in a query attribute value match
    • escapeIllegalXpathSearchChars

      public static String escapeIllegalXpathSearchChars(String s)
      Escapes illegal XPath search characters at the end of a string.

      Example:
      A search string like 'test?' will run into a ParseException documented in http://issues.apache.org/jira/browse/JCR-1248

      Parameters:
      s - the string to encode
      Returns:
      the escaped string