com.day.cq.search
Class PredicateConverter

java.lang.Object
  extended by com.day.cq.search.PredicateConverter

public abstract class PredicateConverter
extends Object

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
static String GROUP_PARAMETER_PREFIX
          Prefix to separate predicate group parameters from child predicates (to be exact: from parameters of child predicates).
 
Constructor Summary
PredicateConverter()
           
 
Method Summary
static Map<String,String> createMap(PredicateGroup root)
          Converts a predicate tree into a parameter map, the inverse transformation of createPredicates(Map).
static PredicateGroup createPredicates(Map predicateParameterMap)
          Converts a map with predicates and their parameters into a predicate tree.
static String toURL(PredicateGroup group)
          Returns an URL query part containing the given group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GROUP_PARAMETER_PREFIX

public static final String 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:

See Also:
Constant Field Values
Constructor Detail

PredicateConverter

public PredicateConverter()
Method Detail

createPredicates

public static PredicateGroup createPredicates(Map predicateParameterMap)
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.


createMap

public static Map<String,String> createMap(PredicateGroup root)
Converts a predicate tree into a parameter map, the inverse transformation of createPredicates(Map).


toURL

public static String toURL(PredicateGroup group)
Returns an URL query part containing the given group. This is the same mapping as used in createMap(PredicateGroup) and createPredicates(Map). For example, the returned value could be: type=cq:Page&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.



Copyright © 2009 Day Management AG. All Rights Reserved.