Package com.day.cq.search.eval
Class AbstractPredicateEvaluator
- java.lang.Object
 - 
- com.day.cq.search.eval.AbstractPredicateEvaluator
 
 
- 
- All Implemented Interfaces:
 PredicateEvaluator
- Direct Known Subclasses:
 AssetRenditionFilterPredicateEvaluator,CollectionPredicateEvaluator,FulltextPredicateEvaluator,JcrPropertyPredicateEvaluator,NodenamePredicateEvaluator,PathPredicateEvaluator,PermissionPredicateEvaluator,PredicateGroupEvaluator,RangePropertyPredicateEvaluator,SimilarityPredicateEvaluator,SubAssetFilterPredicateEvaluator,TypePredicateEvaluator
public abstract class AbstractPredicateEvaluator extends java.lang.Object implements PredicateEvaluator
AbstractPredicateEvaluatoris a base implementation for predicate evaluators. Predicate evaluator implementations are encouraged to extend from this abstract base class to minimize migration efforts when new changes are added to thePredicateEvaluatorAPI.This implementation basically does "nothing":
- returns no xpath expression
 - does not filter
 - (implementations have to implement at least one of the two above)
 - provides no order by properties or order comparator
 - provides no facet extractor
 - automatically covers newer interface methods by implementing them using the old methods
 
- Since:
 - 5.2
 
 
- 
- 
Constructor Summary
Constructors Constructor Description AbstractPredicateEvaluator() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleancanFilter(Predicate predicate, EvaluationContext context)Returns the same as the deprecatedisFiltering(Predicate, EvaluationContext)method (ie.booleancanXpath(Predicate predicate, EvaluationContext context)Returns the inverted boolean value of the deprecatedisFiltering(Predicate, EvaluationContext)method (ie.FacetExtractorgetFacetExtractor(Predicate predicate, EvaluationContext context)Default implementation that always returnsnull, ie.java.util.Comparator<javax.jcr.query.Row>getOrderByComparator(Predicate predicate, EvaluationContext context)Default implementation that always returnsnull.java.lang.String[]getOrderByProperties(Predicate predicate, EvaluationContext context)Default implementation that always returnsnull.java.lang.StringgetXPathExpression(Predicate predicate, EvaluationContext context)Default implementation that always returnsnull, ie.booleanincludes(Predicate predicate, javax.jcr.query.Row row, EvaluationContext context)Default implementation that always returnstrue, ie.booleanisFiltering(Predicate predicate, EvaluationContext context)Deprecated. 
 - 
 
- 
- 
Method Detail
- 
getXPathExpression
public java.lang.String getXPathExpression(Predicate predicate, EvaluationContext context)
Default implementation that always returnsnull, ie. adds nothing to the XPath query. Subclasses can choose whether they want to implement this method or use theincludes(Predicate, Row, EvaluationContext)method for advanced filtering (or both).- Specified by:
 getXPathExpressionin interfacePredicateEvaluator- Parameters:
 predicate- predicate (for this evaluator type) which is evaluatedcontext- helper class which provides access to various elements of the query evaluation- Returns:
 - string containing an XPath predicateEvaluator expression
 
 
- 
getOrderByProperties
public java.lang.String[] getOrderByProperties(Predicate predicate, EvaluationContext context)
Default implementation that always returnsnull.- Specified by:
 getOrderByPropertiesin interfacePredicateEvaluator- Parameters:
 predicate- predicate (for this evaluator type) which is evaluatedcontext- helper class which provides access to various elements of the query evaluation- Returns:
 - one or multiple relative paths to JCR properties or
         
null 
 
- 
canXpath
public boolean canXpath(Predicate predicate, EvaluationContext context)
Returns the inverted boolean value of the deprecatedisFiltering(Predicate, EvaluationContext)method (ie. if not overridden,true).- Specified by:
 canXpathin interfacePredicateEvaluator- Parameters:
 predicate- predicate (for this evaluator type) which is evaluatedcontext- helper class which provides access to various elements of the query evaluation- Returns:
 trueif this evaluator can express itself via xpath, ie.PredicateEvaluator.getXPathExpression(Predicate, EvaluationContext)
 
- 
canFilter
public boolean canFilter(Predicate predicate, EvaluationContext context)
Returns the same as the deprecatedisFiltering(Predicate, EvaluationContext)method (ie. if not overridden,false).- Specified by:
 canFilterin interfacePredicateEvaluator- Parameters:
 predicate- predicate (for this evaluator type) which is evaluatedcontext- helper class which provides access to various elements of the query evaluation- Returns:
 trueif this evaluator can be express itself via filtering, ie.PredicateEvaluator.includes(Predicate, Row, EvaluationContext)
 
- 
isFiltering
@Deprecated public boolean isFiltering(Predicate predicate, EvaluationContext context)
Deprecated.Default implementation that always returnsfalse, because theincludes(Predicate, Row, EvaluationContext)also always returnstruein this implementation and hence does no filtering at all.- Specified by:
 isFilteringin interfacePredicateEvaluator- Parameters:
 predicate- predicate (for this evaluator type) which is evaluatedcontext- helper class which provides access to various elements of the query evaluation- Returns:
 trueif this evaluator is filtering the result set for the given predicate
 
- 
includes
public boolean includes(Predicate predicate, javax.jcr.query.Row row, EvaluationContext context)
Default implementation that always returnstrue, ie. it does not "touch" the result set at all.- Specified by:
 includesin interfacePredicateEvaluator- Parameters:
 predicate- predicate (for this evaluator type) which is evaluatedrow- current row of the result set returned through the xpath querycontext- helper class which provides access to various elements of the query evaluation- Returns:
 trueif this row should be part of the final result set,falseif it should be dropped
 
- 
getOrderByComparator
public java.util.Comparator<javax.jcr.query.Row> getOrderByComparator(Predicate predicate, EvaluationContext context)
Default implementation that always returnsnull.- Specified by:
 getOrderByComparatorin interfacePredicateEvaluator- Parameters:
 predicate- predicate (for this evaluator type) which is evaluatedcontext- helper class which provides access to various elements of the query evaluation- Returns:
 - a custom comparator for the given predicate or 
null 
 
- 
getFacetExtractor
public FacetExtractor getFacetExtractor(Predicate predicate, EvaluationContext context)
Default implementation that always returnsnull, ie. no facets will be extracted for the predicate.- Specified by:
 getFacetExtractorin interfacePredicateEvaluator- Parameters:
 predicate- predicate (for this evaluator type) which is evaluatedcontext- helper class which provides access to various elements of the query evaluation- Returns:
 - a 
FacetExtractorthat is used to create aFacetornullif no extractor shall be provided 
 
 - 
 
 -