Package com.day.cq.search
Class PredicateConverter
java.lang.Object
com.day.cq.search.PredicateConverter
PredicateConverter provides mappings from the
predicate/predicate group data structure to others, such as a simple
key/value string map (eg. a request parameter map).
- Since:
- 5.2
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateMap(PredicateGroup root) Converts a predicate tree into a parameter map, the inverse transformation ofcreatePredicates(Map).static PredicateGroupcreatePredicates(Map predicateParameterMap) Converts a map with predicates and their parameters into a predicate tree.static PredicateGroupcreatePredicatesFromGQL(String statement) Parse and converts GQL statement to QueryBuilder PredicateGroup.static StringtoURL(PredicateGroup group) Returns an URL query part containing the given group.
-
Field Details
-
GROUP_PARAMETER_PREFIX
Prefix to separate predicate group parameters from child predicates (to be exact: from parameters of child predicates). This also means that there cannot be a predicate type named like this (ie."p"). Examples to show the difference:p.limit = true(group parameter)type = nt:file(child predicate)path.exact = true(child predicate parameter)group.type = nt:file(child predicate group w/ predicate)group.p.or = true(group parameter of child group)
- See Also:
-
IGNORE_PARAMETER_PREFIX
All parameters starting with "_" will be ignored. Typical examples are "_charset_" or "_dc".- See Also:
-
-
Constructor Details
-
PredicateConverter
public PredicateConverter()
-
-
Method Details
-
createPredicates
Converts a map with predicates and their parameters into a predicate tree. Accepts a map with strings as keys and either simple strings as values or string arrays as values. In the array case, the first value will be chosen.Note that all parameters starting with a "_" (see
IGNORE_PARAMETER_PREFIX) will be ignored. Typical examples are "_charset_" or "_dc". -
createMap
Converts a predicate tree into a parameter map, the inverse transformation ofcreatePredicates(Map). -
toURL
Returns an URL query part containing the given group. This is the same mapping as used increateMap(PredicateGroup)andcreatePredicates(Map). For example, the returned value could be:type=cq:Pageinvalid input: '&path'=/content. Note that this won't be a complete URL, just a list of parameters for an URL query part. The keys and values will be properly escaped for use in an URL. -
createPredicatesFromGQL
Parse and converts GQL statement to QueryBuilder PredicateGroup.- Parameters:
statement- the statement to be processed for extracting conditions.- Returns:
- PredicateGroup containing all conditions formed from statement
- Throws:
RepositoryException
-