Class QueryUtil
java.lang.Object
com.webmethods.caf.jcr.faces.util.QueryUtil
Helper utilities to assist in the construction of a JCR query string
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum to specify which quote style to use -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
encodeAttributeValue
(String rawValue, QueryUtil.QuoteChar wrappingQuoteCharacter) Encodes the special characters of a term to provide a valid attribute value matchstatic String
encodeForLikeClause
(String rawValue, QueryUtil.QuoteChar wrappingQuoteCharacter) Encodes the special characters of a term to provide a valid like clausestatic String
Escapes illegal XPath search characters at the end of a 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 encodewrappingQuoteCharacter
- 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 encodewrappingQuoteCharacter
- the character wrapping the term in the final query string- Returns:
- encoded value safe to use in a query attribute value match
-
escapeIllegalXpathSearchChars
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
-