private Envelope getBoundsLocal ( Filter filter ) throws LayerException { try { Session session = getSessionFactory ( ) . getCurrentSession ( ) ; Criteria criteria = session . createCriteria ( getFeatureInfo ( ) . getDataSourceName ( ) ) ; CriteriaVisitor visitor = new CriteriaVisitor ( ( HibernateFeatureModel ) getFeatureModel ( ) , dateFormat ) ; Criterion c = ( Criterion ) filter . accept ( visitor , criteria ) ; if ( c != null ) { criteria . add ( c ) ; } criteria . setResultTransformer ( Criteria . DISTINCT_ROOT_ENTITY ) ; List < ? > features = criteria . list ( ) ; Envelope bounds = new Envelope ( ) ; for ( Object f : features ) { Envelope geomBounds = getFeatureModel ( ) . getGeometry ( f ) . getEnvelopeInternal ( ) ; if ( ! geomBounds . isNull ( ) ) { bounds . expandToInclude ( geomBounds ) ; } } return bounds ; } catch ( HibernateException he ) { throw new HibernateLayerException ( he , ExceptionCode . HIBERNATE_LOAD_FILTER_FAIL , getFeatureInfo ( ) . getDataSourceName ( ) , filter . toString ( ) ) ; } }
Bounds are calculated locally can use any filter but slower than native .