@Test public void testCalculateQueryExtent() throws Exception { { SimpleFeatureCollection features; features = dstore.getFeatureSource(typeName).getFeatures(); SimpleFeatureIterator reader = features.features(); SimpleFeatureType featureType = features.getSchema(); GeometryDescriptor defaultGeometry = featureType.getGeometryDescriptor(); ReferencedEnvelope real = new ReferencedEnvelope( defaultGeometry.getCoordinateReferenceSystem()); try { while (reader.hasNext()) { real.include(reader.next().getBounds()); } } finally { reader.close(); } ArcSDEQuery queryAll = getQueryAll(); Envelope actual; try { actual = queryAll.calculateQueryExtent(); } finally { queryAll.close(); } Envelope expected = new Envelope(real); assertNotNull(actual); assertEquals(expected, actual); } { FeatureReader<SimpleFeatureType, SimpleFeature> featureReader; featureReader = dstore.getFeatureReader(filteringQuery, Transaction.AUTO_COMMIT); ReferencedEnvelope real = new ReferencedEnvelope(); try { while (featureReader.hasNext()) { real.include(featureReader.next().getBounds()); } } finally { featureReader.close(); } ArcSDEQuery queryFiltered = createFilteringQuery(); Envelope actual; try { actual = queryFiltered.calculateQueryExtent(); } finally { queryFiltered.close(); } assertNotNull(actual); Envelope expected = new Envelope(real); assertEquals(expected, actual); } }
public static Envelope calculateQueryExtent(final ISession session, final FeatureTypeInfo typeInfo, final Query query, final ArcSdeVersionHandler versioningHandler) throws IOException { final SimpleFeatureType fullSchema = typeInfo.getFeatureType(); final GeometryDescriptor geometryDescriptor = fullSchema.getGeometryDescriptor(); if (geometryDescriptor == null) { return null; } final String defaultGeomAttName = geometryDescriptor.getLocalName(); final Query realQuery = new Query(query); realQuery.setPropertyNames(new String[] { defaultGeomAttName }); final ArcSDEQuery boundsQuery; if (typeInfo.isInProcessView()) { final SeQueryInfo definitionQuery = typeInfo.getSdeDefinitionQuery(); final PlainSelect viewSelectStatement = typeInfo.getDefinitionQuery(); boundsQuery = createInprocessViewQuery(session, fullSchema, realQuery, definitionQuery, viewSelectStatement); } else { final FIDReader fidStrategy = typeInfo.getFidStrategy(); boundsQuery = createQuery(session, fullSchema, realQuery, fidStrategy, versioningHandler); } Envelope queryExtent = null; try { Filter unsupportedFilter = boundsQuery.getFilters().getUnsupportedFilter(); if (unsupportedFilter == Filter.INCLUDE) { queryExtent = boundsQuery.calculateQueryExtent(); } } finally { boundsQuery.close(); } return queryExtent; }
ArcSDEQuery { public static Envelope calculateQueryExtent(final ISession session, final FeatureTypeInfo typeInfo, final Query query, final ArcSdeVersionHandler versioningHandler) throws IOException { final SimpleFeatureType fullSchema = typeInfo.getFeatureType(); final GeometryDescriptor geometryDescriptor = fullSchema.getGeometryDescriptor(); if (geometryDescriptor == null) { return null; } final String defaultGeomAttName = geometryDescriptor.getLocalName(); final Query realQuery = new Query(query); realQuery.setPropertyNames(new String[] { defaultGeomAttName }); final ArcSDEQuery boundsQuery; if (typeInfo.isInProcessView()) { final SeQueryInfo definitionQuery = typeInfo.getSdeDefinitionQuery(); final PlainSelect viewSelectStatement = typeInfo.getDefinitionQuery(); boundsQuery = createInprocessViewQuery(session, fullSchema, realQuery, definitionQuery, viewSelectStatement); } else { final FIDReader fidStrategy = typeInfo.getFidStrategy(); boundsQuery = createQuery(session, fullSchema, realQuery, fidStrategy, versioningHandler); } Envelope queryExtent = null; try { Filter unsupportedFilter = boundsQuery.getFilters().getUnsupportedFilter(); if (unsupportedFilter == Filter.INCLUDE) { queryExtent = boundsQuery.calculateQueryExtent(); } } finally { boundsQuery.close(); } return queryExtent; } }
ArcSDEQuery { public static Envelope calculateQueryExtent(final ISession session, final FeatureTypeInfo typeInfo, final Query query, final ArcSdeVersionHandler versioningHandler) throws IOException { final SimpleFeatureType fullSchema = typeInfo.getFeatureType(); final GeometryDescriptor geometryDescriptor = fullSchema.getGeometryDescriptor(); if (geometryDescriptor == null) { return null; } final String defaultGeomAttName = geometryDescriptor.getLocalName(); final Query realQuery = new Query(query); realQuery.setPropertyNames(new String[] { defaultGeomAttName }); final ArcSDEQuery boundsQuery; if (typeInfo.isInProcessView()) { final SeQueryInfo definitionQuery = typeInfo.getSdeDefinitionQuery(); final PlainSelect viewSelectStatement = typeInfo.getDefinitionQuery(); boundsQuery = createInprocessViewQuery(session, fullSchema, realQuery, definitionQuery, viewSelectStatement); } else { final FIDReader fidStrategy = typeInfo.getFidStrategy(); boundsQuery = createQuery(session, fullSchema, realQuery, fidStrategy, versioningHandler); } Envelope queryExtent = null; try { Filter unsupportedFilter = boundsQuery.getFilters().getUnsupportedFilter(); if (unsupportedFilter == Filter.INCLUDE) { queryExtent = boundsQuery.calculateQueryExtent(); } } finally { boundsQuery.close(); } return queryExtent; } private  ArcSDEQuery(final ISession session, final SimpleFeatureType schema,
            final FilterSet filterSet, final String sortByClause, final FIDReader fidReader,
            ArcSdeVersionHandler versioningHandler); }
ArcSDEQuery { public static Envelope calculateQueryExtent(final ISession session, final FeatureTypeInfo typeInfo, final Query query, final ArcSdeVersionHandler versioningHandler) throws IOException { final SimpleFeatureType fullSchema = typeInfo.getFeatureType(); final GeometryDescriptor geometryDescriptor = fullSchema.getGeometryDescriptor(); if (geometryDescriptor == null) { return null; } final String defaultGeomAttName = geometryDescriptor.getLocalName(); final Query realQuery = new Query(query); realQuery.setPropertyNames(new String[] { defaultGeomAttName }); final ArcSDEQuery boundsQuery; if (typeInfo.isInProcessView()) { final SeQueryInfo definitionQuery = typeInfo.getSdeDefinitionQuery(); final PlainSelect viewSelectStatement = typeInfo.getDefinitionQuery(); boundsQuery = createInprocessViewQuery(session, fullSchema, realQuery, definitionQuery, viewSelectStatement); } else { final FIDReader fidStrategy = typeInfo.getFidStrategy(); boundsQuery = createQuery(session, fullSchema, realQuery, fidStrategy, versioningHandler); } Envelope queryExtent = null; try { Filter unsupportedFilter = boundsQuery.getFilters().getUnsupportedFilter(); if (unsupportedFilter == Filter.INCLUDE) { queryExtent = boundsQuery.calculateQueryExtent(); } } finally { boundsQuery.close(); } return queryExtent; } private  ArcSDEQuery(final ISession session, final SimpleFeatureType schema,
            final FilterSet filterSet, final String sortByClause, final FIDReader fidReader,
            ArcSdeVersionHandler versioningHandler); static ArcSDEQuery createQuery(final ISession session,
            final SimpleFeatureType fullSchema, final Query query, final FIDReader fidReader,
            final ArcSdeVersionHandler versioningHandler); static ArcSDEQuery createInprocessViewQuery(final ISession session,
            final SimpleFeatureType fullSchema, final Query query,
            final SeQueryInfo definitionQuery, final PlainSelect viewSelectStatement); static SimpleFeatureType getQuerySchema(final String[] queryProperties,
            Filter unsupportedFilter, final SimpleFeatureType fullSchema); FIDReader getFidReader(); SimpleFeatureType getSchema(); ArcSDEQuery.FilterSet getFilters(); static int calculateResultCount(final ISession session, final FeatureTypeInfo typeInfo,
            final Query query, final ArcSdeVersionHandler versioningHandler); static Envelope calculateQueryExtent(final ISession session,
            final FeatureTypeInfo typeInfo, final Query query,
            final ArcSdeVersionHandler versioningHandler); int calculateResultCount(); Envelope calculateQueryExtent(); void close(); void execute(); SdeRow fetch(); void setSpatialConstraints(SeFilter[] filters); @Override String toString(); }
ArcSDEQuery { public static Envelope calculateQueryExtent(final ISession session, final FeatureTypeInfo typeInfo, final Query query, final ArcSdeVersionHandler versioningHandler) throws IOException { final SimpleFeatureType fullSchema = typeInfo.getFeatureType(); final GeometryDescriptor geometryDescriptor = fullSchema.getGeometryDescriptor(); if (geometryDescriptor == null) { return null; } final String defaultGeomAttName = geometryDescriptor.getLocalName(); final Query realQuery = new Query(query); realQuery.setPropertyNames(new String[] { defaultGeomAttName }); final ArcSDEQuery boundsQuery; if (typeInfo.isInProcessView()) { final SeQueryInfo definitionQuery = typeInfo.getSdeDefinitionQuery(); final PlainSelect viewSelectStatement = typeInfo.getDefinitionQuery(); boundsQuery = createInprocessViewQuery(session, fullSchema, realQuery, definitionQuery, viewSelectStatement); } else { final FIDReader fidStrategy = typeInfo.getFidStrategy(); boundsQuery = createQuery(session, fullSchema, realQuery, fidStrategy, versioningHandler); } Envelope queryExtent = null; try { Filter unsupportedFilter = boundsQuery.getFilters().getUnsupportedFilter(); if (unsupportedFilter == Filter.INCLUDE) { queryExtent = boundsQuery.calculateQueryExtent(); } } finally { boundsQuery.close(); } return queryExtent; } private  ArcSDEQuery(final ISession session, final SimpleFeatureType schema,
            final FilterSet filterSet, final String sortByClause, final FIDReader fidReader,
            ArcSdeVersionHandler versioningHandler); static ArcSDEQuery createQuery(final ISession session,
            final SimpleFeatureType fullSchema, final Query query, final FIDReader fidReader,
            final ArcSdeVersionHandler versioningHandler); static ArcSDEQuery createInprocessViewQuery(final ISession session,
            final SimpleFeatureType fullSchema, final Query query,
            final SeQueryInfo definitionQuery, final PlainSelect viewSelectStatement); static SimpleFeatureType getQuerySchema(final String[] queryProperties,
            Filter unsupportedFilter, final SimpleFeatureType fullSchema); FIDReader getFidReader(); SimpleFeatureType getSchema(); ArcSDEQuery.FilterSet getFilters(); static int calculateResultCount(final ISession session, final FeatureTypeInfo typeInfo,
            final Query query, final ArcSdeVersionHandler versioningHandler); static Envelope calculateQueryExtent(final ISession session,
            final FeatureTypeInfo typeInfo, final Query query,
            final ArcSdeVersionHandler versioningHandler); int calculateResultCount(); Envelope calculateQueryExtent(); void close(); void execute(); SdeRow fetch(); void setSpatialConstraints(SeFilter[] filters); @Override String toString();  }