org.geotools.filter
Class SQLUnpacker

java.lang.Object
  extended byorg.geotools.filter.SQLUnpacker

public class SQLUnpacker
extends java.lang.Object

Determines which parts of a Filter can be turned into valid SQL statements. Given a filter it constructs two filters, one of the supported parts of the filter passed in, one of the unsupported. If one of the constructed filters is null (ie the whole filter is supported or unsupported), it is the clients responsibility to deal with that. The SQLUnpacker should be tightly coordinated with the SQLEncoder. The SQLEncoder passes its Capabilities (ie which filters it can encode and which it can't) to the Unpacker, and the Unpacker returns a supported filter, which should be passed to the Encoder as the Encoder Capabilities claimed to fully support everything in the supported filter. The unsupported filter should be used after the SQL statement is executed, testing each feature in the result set with the contains method.

This Unpacker can likely be easily used with any Encoder that has a FilterCapabilities of the actions it can perform. May want to rename it FilterUnpacker, as it is likely generic enough, but for now this name should be fine, to emphasize that the SQLEncoder needs to be closely linked to it to work properly.

Author:
Chris Holmes, TOPP

Constructor Summary
SQLUnpacker(FilterCapabilities capabilities)
          Constructor with FilterCapabilities from the Encoder used in conjunction with this Unpacker.
 
Method Summary
 Filter getSupported()
          After an unPack has been called, returns the resulting Filter of the supported parts of the unPacked filter.
 Filter getUnSupported()
          After an unPack has been called, returns the resulting Filter of the unsupported parts of the unPacked filter.
 void unPackAND(Filter filter)
          Performs the unpacking of a filter, for the cases when ANDs can be split and ORs can not.
 void unPackOR(Filter filter)
          Performs the unpacking of a filter, for the cases when ORs can be split and ANDs can not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLUnpacker

public SQLUnpacker(FilterCapabilities capabilities)
Constructor with FilterCapabilities from the Encoder used in conjunction with this Unpacker.

Parameters:
capabilities - what FilterTypes should be supported.
Method Detail

unPackAND

public void unPackAND(Filter filter)
Performs the unpacking of a filter, for the cases when ANDs can be split and ORs can not. To get the results of the unpacking getUnsupported and getSupported must be called before another unpacking is done.

Parameters:
filter - to be unpacked, split on ANDs

unPackOR

public void unPackOR(Filter filter)
Performs the unpacking of a filter, for the cases when ORs can be split and ANDs can not. To get the results of the unpacking getUnsupported and getSupported must be called before another unpacking is done.

Parameters:
filter - to be unpacked, split on ANDs

getUnSupported

public Filter getUnSupported()
After an unPack has been called, returns the resulting Filter of the unsupported parts of the unPacked filter. If the unPacked filter is fully supported this returns a null, it is the client's responsibility to deal with it. If there are multiple unsupported subfilters they are ANDed together.

Returns:
A filter of the unsupported parts of the unPacked filter.

getSupported

public Filter getSupported()
After an unPack has been called, returns the resulting Filter of the supported parts of the unPacked filter. If the unPacked filter is not supported at all this returns a null, it is the client's responsibility to deal with it. If there are multiple supported subfilters they are ANDed together.

Returns:
A filter of the supported parts of the unPacked filter.


Copyright © 1996-2003 GeoTools. All Rights Reserved.