ok, if there are no objections so far then I'm inclined to commit the
patch to trunk. Raise your concerns now?

On Tue, Jun 26, 2012 at 2:04 PM, Gabriel Roldan <[email protected]> wrote:
> Hi all,
>
> I'm on a situation where a Filter needs to be split into backend's
> supported/unsupported parts, hence using CapabilitiesFilterSplitter.
> The thing is that some attribute name are encodable to the backend's
> query language and some other's don't, and need to be evaluated at
> runtime.
> Now, CapabilitiesFilterSplitter is not designed for extensibility, and
> there's currently no way of determining whether a filter that includes
> a given PropertyName is supported or not, assuming all of them are
> supported.
> Now, in order to accomplish my goal with the least disruption
> possible, I came to a solution that implies extending the
> ClientTransactionAccessor extension point's contract.
>
> ClientTransactionAccessor is used when evaluating a PropertyName
> through the following method:
>
> Filter getUpdateFilter(String attributePath);
>
> Which returns either null (for no change, meaning the filter
> referencing the property path is supported), or am or'ed filter which
> replaces the original filter (currently only used by wfs 1.0 client as
> far as I can see).
> My proposal is to state that returning Filter.EXCLUDE means that
> property name is not supported by the backend, so that
> CapabilitiesFilterSplitter adds the referencing filter to the
> post-processing filter instead of to the pre-processing filter. This
> would be more convenient than opening CapabilitiesFilterSplitter for
> extension (making its state
>
> Please take a look at the patch bellow and tell whether it's ok to commit.
>
> diff --git 
> a/modules/library/main/src/main/java/org/geotools/filter/visitor/CapabilitiesFilterSplitter.java
> b/modules/library/main/src/main/java/org/geotools/filter/visitor/CapabilitiesFilterSplitter.java
> index 5853789..ec43fb5 100644
> --- 
> a/modules/library/main/src/main/java/org/geotools/filter/visitor/CapabilitiesFilterSplitter.java
> +++ 
> b/modules/library/main/src/main/java/org/geotools/filter/visitor/CapabilitiesFilterSplitter.java
> @@ -801,8 +801,13 @@ public class CapabilitiesFilterSplitter
> implements FilterVisitor, ExpressionVisi
>             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 {
> diff --git 
> a/modules/library/main/src/main/java/org/geotools/filter/visitor/ClientTransactionAccessor.java
> b/modules/library/main/src/main/java/org/geotools/filter/visitor/ClientTransactionAccessor.java
> index 11d002c..6b8e01b 100644
> --- 
> a/modules/library/main/src/main/java/org/geotools/filter/visitor/ClientTransactionAccessor.java
> +++ 
> b/modules/library/main/src/main/java/org/geotools/filter/visitor/ClientTransactionAccessor.java
> @@ -43,7 +43,10 @@ public interface ClientTransactionAccessor {
>         * 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);
>
> --
> Gabriel Roldan
> OpenGeo - http://opengeo.org
> Expert service straight from the developers.



-- 
Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to