Class SimplifyingFilterVisitor

  • All Implemented Interfaces:
    ExpressionVisitor, FilterVisitor

    public class SimplifyingFilterVisitor
    extends DuplicatingFilterVisitor
    Takes a filter and returns a simplified, equivalent one. At the moment the filter:
    • simplifies out Filter.INCLUDE and Filter.EXCLUDE in logical expressions
    • removes double logic negations
    • deal with FID filter validation removing invalid fids
    • optimize out all non volatile functions that do not happen to use attributes, replacing them with literals

    FID filter validation is meant to wipe out non valid feature ids from Id filters. This is so in order to avoid sending feature ids down to DataStores that are not valid as per the specific FeatureType fid structure. Since this is structure is usually DataStore specific, some times being a strategy based on how the feature type primary key is generated, fid validation is abstracted out to the SimplifyingFilterVisitor.FIDValidator interface so when a DataStore is about to send a query down to the backend it van provide this visitor with a validator specific for the feature type fid structure being queried.

    By default all feature ids are valid. DataStores that want non valid fids to be wiped out should set a SimplifyingFilterVisitor.FIDValidator through the setFIDValidator(FIDValidator) method.

    Since:
    2.5.x
    Author:
    Andrea Aime - OpenGeo, Gabriel Roldan (OpenGeo)