Make SimplifyingFilterVisitor handle feature id validation
----------------------------------------------------------
Key: GEOT-2182
URL: http://jira.codehaus.org/browse/GEOT-2182
Project: GeoTools
Issue Type: Improvement
Components: core filter
Affects Versions: 2.5.1
Reporter: Gabriel Roldán
Assignee: Gabriel Roldán
Fix For: 2.5.2, 2.6-M0
SimplifyngFilterVisitor is meant to be used as the last step in the filter
splitting process prior to send the supported part of a filter down to the back
store, hence it'll be good for it to check that the feature ids in an Id filter
are valid to be sent. The validity check should be externalized through an
interface to datastores are able of feeding the visitor with a validator
specific for the fid construction strategy used by the datastore for an
specifig feature type.
This need originated from the fact that fid filters containing non matching
fids usually end up in wrong queries and was first laid out at GEOS-2039:
{code}
class SimplifyingFilterVisitor implements FitlerVisitor{
public static interface FIDValidator{
public boolean isValid(String fid);
}
public static final FIDValidator ANY_FID_VALID = new FIDVAlidator(){
public boolean isValid(String fid){ return true; }
};
private FIDValidator fidValidator = ANY_FID_VALID;
public void setFIDValidator(FIDValidator validator){
this.fidValidator = validator == null? ANY_FID_VALID : validator:
}
public Object visit(Id filter, Object extraData){
Set<FeatureId> validFids = new HashSet<FeatureId>();
for(Identifier id : filter.getIdentifiers()){
if( ( id instanceof FeatureId) && validator.isValid(
((FeatureId)id).getID() ){
validFids.add( ((FeatureId)id );
}
}
return validFids.size() ==? Filter.EXCLUDE :
getFactory(extraData).id(validFids);
}
.....
}
{code}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel