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
AbstractPredicateEvaluator is 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 the PredicateEvaluator API.
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 -
Method Summary
Modifier and TypeMethodDescriptionbooleancanFilter(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.getFacetExtractor(Predicate predicate, EvaluationContext context) Default implementation that always returnsnull, ie.getOrderByComparator(Predicate predicate, EvaluationContext context) Default implementation that always returnsnull.String[]getOrderByProperties(Predicate predicate, EvaluationContext context) Default implementation that always returnsnull.getXPathExpression(Predicate predicate, EvaluationContext context) Default implementation that always returnsnull, ie.booleanincludes(Predicate predicate, Row row, EvaluationContext context) Default implementation that always returnstrue, ie.booleanisFiltering(Predicate predicate, EvaluationContext context) Deprecated.
-
Constructor Details
-
AbstractPredicateEvaluator
public AbstractPredicateEvaluator()
-
-
Method Details
-
getXPathExpression
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
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
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
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.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
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
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
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
-