[ 
http://jira.codehaus.org/browse/GEOT-2182?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gabriel Roldán reopened GEOT-2182:
----------------------------------


reopening sine a wrong assumption in JDBCFeatureSource that filter == preFilter 
makes the defect still appear for jdbc datastores:
{code}
Index: src/main/java/org/geotools/data/jdbc/JDBCFeatureSource.java              
                                                                                
                                           
===================================================================             
                                                                                
                                           
--- src/main/java/org/geotools/data/jdbc/JDBCFeatureSource.java (revision 
31996)                                                                          
                                                 
+++ src/main/java/org/geotools/data/jdbc/JDBCFeatureSource.java (working copy)  
                                                                                
                                           
@@ -485,6 +485,7 @@                                                             
                                                                                
                                           
         JDBC1DataStore jdbc = getJDBCDataStore();                              
                                                                                
                                           
         SQLBuilder sqlBuilder = jdbc.getSqlBuilder(featureType.getTypeName()); 
                                                                                
                                           
                                                                                
                                                                                
                                           
+        Filter preFilter = (Filter) sqlBuilder.getPreQueryFilter(filter);      
                                                                                
                                           
         Filter postFilter = (Filter) sqlBuilder.getPostQueryFilter(filter);    
                                                                                
                                           
         if (postFilter != null && !Filter.INCLUDE.equals(postFilter)) {        
                                                                                
                                           
             // this would require postprocessing the filter                    
                                                                                
                                           
@@ -502,7 +503,7 @@                                                             
                                                                                
                                           
             //chorner: we should hit an indexed column, * will likely 
tablescan                                                                       
                                                    
             sql.append("SELECT COUNT(*) as cnt");                              
                                                                                
                                           
             sqlBuilder.sqlFrom(sql, typeName);                                 
                                                                                
                                           
-            sqlBuilder.sqlWhere(sql, filter); //safe to assume filter = 
prefilter
+            sqlBuilder.sqlWhere(sql, preFilter);

             LOGGER.finer("SQL: " + sql);
{code}

> 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.3
>
>         Attachments: GEOT-2182_trunk.patch
>
>
> 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

       

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to