See previous post for details of patch. Attached is gt-2.2.x compatible patch.

--saul
Index: plugin/arcsde/datastore/src/org/geotools/filter/SQLEncoderSDE.java
===================================================================
--- plugin/arcsde/datastore/src/org/geotools/filter/SQLEncoderSDE.java	(revision 22555)
+++ plugin/arcsde/datastore/src/org/geotools/filter/SQLEncoderSDE.java	(working copy)
@@ -101,6 +101,7 @@
         capabilities.addType(FilterCapabilities.FID);
         capabilities.addType(FilterCapabilities.NONE);
         capabilities.addType(FilterCapabilities.ALL);
+        capabilities.addType(FilterCapabilities.LIKE);
 
         return capabilities;
     }
Index: plugin/arcsde/datastore/src/org/geotools/data/arcsde/ArcSDEDataStore.java
===================================================================
--- plugin/arcsde/datastore/src/org/geotools/data/arcsde/ArcSDEDataStore.java	(revision 22555)
+++ plugin/arcsde/datastore/src/org/geotools/data/arcsde/ArcSDEDataStore.java	(working copy)
@@ -839,8 +839,20 @@
      */
     protected Envelope getBounds(Query query) throws IOException {
         LOGGER.info("getBounds");
-
-        Envelope ev = ArcSDEQuery.calculateQueryExtent(this, query);
+        
+        Envelope ev;
+        if (query.getFilter() == null || query.getFilter().equals(Filter.NONE)) {
+        	LOGGER.fine("getting bounds of entire layer.  Using optimized SDE call.");
+        	// we're really asking for a bounds of the WHOLE layer,
+        	// let's just ask SDE metadata for that, rather than doing an expensive query
+        	SeLayer thisLayer = this.connectionPool.getSdeLayer(query.getTypeName());
+        	SeExtent extent = thisLayer.getExtent();
+        	ev = new Envelope(extent.getMinX(), extent.getMaxX(),
+                    extent.getMinY(), extent.getMaxY());
+        } else {
+        	ev = ArcSDEQuery.calculateQueryExtent(this, query);
+        }
+        
         LOGGER.info("bounds: " + ev);
 
         return ev;
Index: plugin/arcsde/datastore/src/org/geotools/data/arcsde/ArcSDEQuery.java
===================================================================
--- plugin/arcsde/datastore/src/org/geotools/data/arcsde/ArcSDEQuery.java	(revision 22555)
+++ plugin/arcsde/datastore/src/org/geotools/data/arcsde/ArcSDEQuery.java	(working copy)
@@ -240,7 +240,7 @@
         }
         
         if (!hasFIDColumn) {
-        	LOGGER.warning("No FID attribute was contained in your query.  Appending the discovered one to the list of columns to be fetched.");
+        	LOGGER.info("No FID attribute was contained in your query.  Appending the discovered one to the list of columns to be fetched.");
         	for (int i = 0; i < schema.getAttributeCount(); i++) {
         		AttributeType type = schema.getAttributeType(i);
             	if (type instanceof ArcSDEAttributeType) {
@@ -248,7 +248,7 @@
             			String[] newQCols = new String[queryColumns.length + 1];
             			System.arraycopy(queryColumns, 0, newQCols, 0, queryColumns.length);
             			newQCols[queryColumns.length] = type.getName();
-            			LOGGER.warning("Appendend " + newQCols[queryColumns.length] + " to column list.");
+            			LOGGER.fine("Appendend " + newQCols[queryColumns.length] + " to column list.");
                     	queryColumns = newQCols;
             			break;
             		}
@@ -340,8 +340,8 @@
         if (LOGGER.isLoggable(Level.FINE)) {
             LOGGER.fine("constructing new sql query with connection: "
                 + connection + ", propnames: "
-                + java.util.Arrays.asList(propertyNames) + " sqlConstruct: "
-                + this.filters.getSeSqlConstruct());
+                + java.util.Arrays.asList(propertyNames) + " sqlConstruct where clause: '"
+                + this.filters.getSeSqlConstruct().getWhere());
         }
 
         SeQuery query = connection.createQuery(propertyNames,
@@ -929,6 +929,9 @@
             unpacker.unPackAND(this.sourceFilter);
 
             this.sqlFilter = unpacker.getSupported();
+            
+            if (LOGGER.isLoggable(Level.FINE) && sqlFilter != null)
+            	LOGGER.fine("SQL portion of SDE Query: '" + sqlFilter + "'");
 
             Filter remainingFilter = unpacker.getUnSupported();
 
@@ -936,7 +939,12 @@
             unpacker.unPackAND(remainingFilter);
 
             this.geometryFilter = unpacker.getSupported();
+            if (LOGGER.isLoggable(Level.FINE) && geometryFilter != null)
+            	LOGGER.fine("Spatial-Filter portion of SDE Query: '" + geometryFilter + "'");
+            
             this.unsupportedFilter = unpacker.getUnSupported();
+            if (LOGGER.isLoggable(Level.FINE) && unsupportedFilter != null)
+            	LOGGER.fine("Unsupported (and therefore ignored) portion of SDE Query: '" + unsupportedFilter + "'");
         }
 
         /**
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to