From: <svn...@os...> - 2012-06-29 13:23:45
|
Author: groldan Date: 2012-06-29 06:23:33 -0700 (Fri, 29 Jun 2012) New Revision: 38849 Modified: trunk/modules/library/main/src/main/java/org/geotools/filter/visitor/CapabilitiesFilterSplitter.java trunk/modules/library/main/src/main/java/org/geotools/filter/visitor/ClientTransactionAccessor.java Log: Make it so that returning Filter.EXCLUDE from ClientTransactionAccessor.getUpdateFilter(String propName) means the filter referencing that property is not encodable to the backend Modified: trunk/modules/library/main/src/main/java/org/geotools/filter/visitor/CapabilitiesFilterSplitter.java =================================================================== --- trunk/modules/library/main/src/main/java/org/geotools/filter/visitor/CapabilitiesFilterSplitter.java 2012-06-29 07:51:52 UTC (rev 38848) +++ trunk/modules/library/main/src/main/java/org/geotools/filter/visitor/CapabilitiesFilterSplitter.java 2012-06-29 13:23:33 UTC (rev 38849) @@ -126,12 +126,21 @@ * say with certainty exactly how the logic for that part of this works, but the test suite does * seem to test it and the tests do pass. * </p> + * <p> + * Since GeoTools 8.0, the {@link ClientTransactionAccessor} interface can also be used to instruct + * the splitter that a filter referencing a given {@link PropertyName} can't be encoded by the + * back-end, by returning {@link Filter#EXCLUDE} in + * {@link ClientTransactionAccessor#getUpdateFilter(String) 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 {@code Filter.EXCLUDE} makes the filter referencing the property name part of the + * post-processing filter instead of the pre-processing filter. * * @author dzwiers * @author commented and ported from gt to ogc filters by saul.farber * @author ported to work upon {@code org.geotools.filter.Capabilities} by Gabriel Roldan - * - * + * + * * @source $URL$ * @since 2.5.3 */ @@ -801,8 +810,13 @@ Filter updateFilter = (Filter) transactionAccessor.getUpdateFilter(expression .getPropertyName()); if (updateFilter != null) { - changedStack.add(updateFilter); - preStack.push(updateFilter); + if(updateFilter == Filter.EXCLUDE){ + // property name not encodable to backend + postStack.push(expression); + }else{ + changedStack.add(updateFilter); + preStack.push(updateFilter); + } } else preStack.push(expression); } else { Modified: trunk/modules/library/main/src/main/java/org/geotools/filter/visitor/ClientTransactionAccessor.java =================================================================== --- trunk/modules/library/main/src/main/java/org/geotools/filter/visitor/ClientTransactionAccessor.java 2012-06-29 07:51:52 UTC (rev 38848) +++ trunk/modules/library/main/src/main/java/org/geotools/filter/visitor/ClientTransactionAccessor.java 2012-06-29 13:23:33 UTC (rev 38849) @@ -43,7 +43,10 @@ * Returns all the filters of updates that affect the attribute in the expression ORed together. * * @param attributePath the xpath identifier of the attribute. - * @return all the filters of updates that affect the attribute in the expression ORed together. + * @return all the filters of updates that affect the attribute in the expression ORed together, + * {@link Filter#EXCLUDE} if the attribute path is not supported/encodable to the backend + * (and hence any filter including it shall only be evaluated at runtime), or {@code null} if no behavior + * change is to be applied. */ Filter getUpdateFilter(String attributePath); |