Class CapabilitiesFilterSplitter
- All Implemented Interfaces:
ExpressionVisitor,FilterVisitor
IMPLEMENTATION NOTE: This class is implemented as a stack processor. If you're curious how it works, compare it with the old SQLUnpacker class, which did the same thing using recursion in a more straightforward way.
Here's a non-implementors best-guess at the algorithm: Starting at the top of the filter, split each filter into its constituent parts. If the given FilterCapabilities support the given operator, then keep checking downwards.
The key is in knowing whether or not something "down the tree" from you wound up being supported or not. This is where the stacks come in. Right before handing off to accept() the sub- filters, we count how many things are currently on the "can be proccessed by the underlying datastore" stack (the preStack) and we count how many things are currently on the "need to be post- processed" stack.
After the accept() call returns, we look again at the preStack.size() and postStack.size(). If the postStack has grown, that means that there was stuff down in the accept()-ed filter that wasn't supportable. Usually this means that our filter isn't supportable, but not always.
In some cases a sub-filter being unsupported isn't necessarily bad, as we can 'unpack' OR statements into AND statements (DeMorgans rule/modus poens) and still see if we can handle the other side of the OR. Same with NOT and certain kinds of AND statements.
In addition this class supports the case where we're doing an split in the middle of a client-side transaction.
I.e. imagine doing a Since GeoTools 8.0, the ClientTransactionAccessor interface can also be used
to instruct the splitter that a filter referencing a given PropertyName can't be encoded by the back-end, by
returning Filter.EXCLUDE in
getUpdateFilter(String). This
is so because there may be the case where some attribute names are encodable to the back-end's query language, while
others may not be, or may not be part of the stored data model. In such case, returning Filter.EXCLUDE makes
the filter referencing the property name part of the post-processing filter instead of the pre-processing filter.
- Since:
- 2.5.3
- Author:
- dzwiers, commented and ported from gt to ogc filters by saul.farber, ported to work upon
org.geotools.filter.Capabilitiesby Gabriel Roldan
-
Constructor Summary
ConstructorsConstructorDescriptionCapabilitiesFilterSplitter(Capabilities fcs, FeatureType parent, ClientTransactionAccessor transactionAccessor) Create a new instance. -
Method Summary
Modifier and TypeMethodDescriptionGets the filter that cannot be sent to the server and must be post-processed on the client by geotools.Gets the filter that can be sent to the server for pre-processing.voidvisit(ExcludeFilter filter) visit(ExcludeFilter filter, Object notUsed) VisitFilter.EXCLUDE(often used during data structure transformations).visit(NilExpression nilExpression, Object notUsed) Used to visit a Expression.NIL, also called fornullwhere an expression is expected.visit(PropertyName expression, Object notUsed) voidvisit(IncludeFilter filter) visit(IncludeFilter filter, Object notUsed) VisitFilter.INCLUDE(often used during data structure transformations).visit(NativeFilter filter, Object extraData) visit(PropertyIsBetween filter, Object extradata) visit(PropertyIsEqualTo filter, Object notUsed) visit(PropertyIsGreaterThanOrEqualTo filter, Object notUsed) visit(PropertyIsGreaterThan filter, Object notUsed) visit(PropertyIsLessThanOrEqualTo filter, Object notUsed) visit(PropertyIsLessThan filter, Object notUsed) visit(PropertyIsLike filter, Object notUsed) visit(PropertyIsNil filter, Object extraData) visit(PropertyIsNotEqualTo filter, Object notUsed) visit(PropertyIsNull filter, Object notUsed) visit(Intersects filter, Object notUsed) visit(AnyInteracts anyInteracts, Object extraData) protected Objectvisit(BinaryTemporalOperator filter, Object data) visit(OverlappedBy overlappedBy, Object extraData) visitNullFilter(Object notUsed) Used to account for anullfilter value.
-
Constructor Details
-
CapabilitiesFilterSplitter
public CapabilitiesFilterSplitter(Capabilities fcs, FeatureType parent, ClientTransactionAccessor transactionAccessor) Create a new instance.- Parameters:
fcs- The FilterCapabilties that describes what Filters/Expressions the server can process.parent- The FeatureType that this filter involves. Why is this needed?transactionAccessor- If the transaction is handled on the client and not the server then different filters must be sent to the server. This class provides a generic way of obtaining the information from the transaction.
-
-
Method Details
-
getFilterPost
Gets the filter that cannot be sent to the server and must be post-processed on the client by geotools.- Returns:
- the filter that cannot be sent to the server and must be post-processed on the client by geotools.
-
getFilterPre
Gets the filter that can be sent to the server for pre-processing.- Returns:
- the filter that can be sent to the server for pre-processing.
-
visit
- Parameters:
filter- theFilterto visit- See Also:
-
visit
- Parameters:
filter- theFilterto visit- See Also:
-
visit
- Specified by:
visitin interfaceFilterVisitor- Parameters:
filter- theFilterto visit- See Also:
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visitNullFilter
Description copied from interface:FilterVisitorUsed to account for anullfilter value.This is particularly used during data structure transofrmations, however the use of
nullis not recommended. Please make use of Filter.NONE and Filter.ALL as placeholder objects that communicate intent.- Specified by:
visitNullFilterin interfaceFilterVisitor- Parameters:
notUsed- Value object provided to visitor- Returns:
- subclass defined
-
visit
Description copied from interface:FilterVisitorVisitFilter.INCLUDE(often used during data structure transformations).- Specified by:
visitin interfaceFilterVisitor- Parameters:
filter-Filter.INCLUDE.notUsed- Value object provided to visitor- Returns:
- subclass supplied
-
visit
Description copied from interface:FilterVisitorVisitFilter.EXCLUDE(often used during data structure transformations).- Specified by:
visitin interfaceFilterVisitor- Parameters:
filter-Filter.EXCLUDE.notUsed- Value object provided to visitor- Returns:
- subclass supplied
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceExpressionVisitor
-
visit
- Specified by:
visitin interfaceExpressionVisitor
-
visit
- Specified by:
visitin interfaceExpressionVisitor
-
visit
- Specified by:
visitin interfaceExpressionVisitor
-
visit
- Specified by:
visitin interfaceExpressionVisitor
-
visit
- Specified by:
visitin interfaceExpressionVisitor
-
visit
- Specified by:
visitin interfaceExpressionVisitor- See Also:
-
org.geotools.filter.FilterVisitor#visit(org.geotools.filter.FunctionExpression)
-
visit
Description copied from interface:ExpressionVisitorUsed to visit a Expression.NIL, also called fornullwhere an expression is expected.This is particularly useful when doing data transformations, as an example when using a StyleSymbolizer Expression.NIL can be used to represent the default stroke color.
- Specified by:
visitin interfaceExpressionVisitor- Returns:
- implementation specific
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
- Specified by:
visitin interfaceFilterVisitor
-
visit
-
visit
- Specified by:
visitin interfaceFilterVisitor
-