public void removeFeatures(Filter filter) throws IOException { // this we can optimize, it's a matter of mass updating the last // revisions (and before that, we have to compute the modified envelope) Filter versionedFilter = (Filter) store.buildVersionedFilter(schema.getTypeName(), filter, new RevisionInfo()); // deal with the transaction, are we playing with auto commit or long running? Transaction t = getTransaction(); boolean autoCommit = false; if (Transaction.AUTO_COMMIT.equals(t)) { t = new DefaultTransaction(); autoCommit = true; } VersionedJdbcTransactionState state = store.wrapped.getVersionedJdbcTransactionState(t); // we need to mark the modified bounds and store their wgs84 version into the transaction ReferencedEnvelope bounds = locking.getBounds(new DefaultQuery(schema.getTypeName(), versionedFilter)); if (bounds != null) { if (bounds.getCoordinateReferenceSystem() == null) { bounds = new ReferencedEnvelope(bounds, getSchema().getCoordinateReferenceSystem()); } try { ReferencedEnvelope wgsBounds = null; if (bounds.getCoordinateReferenceSystem() != null) wgsBounds = bounds.transform(DefaultGeographicCRS.WGS84, true); else wgsBounds = bounds; state.expandDirtyBounds(wgsBounds); state.setTypeNameDirty(schema.getTypeName()); } catch (Exception e) { throw new DataSourceException( "Problems computing and storing the " + "bounds affected by this feature removal", e); } } // now we can run the update locking.modifyFeatures( locking.getSchema().getDescriptor("expired"), new Long(state.getRevision()), versionedFilter); // if it's auto commit, don't forget to actually commit if (autoCommit) { t.commit(); t.close(); } store.listenerManager.fireFeaturesRemoved(schema.getTypeName(), t, bounds, false); }
public int getCount(Query query) throws IOException { DefaultQuery versionedQuery = store.buildVersionedQuery(getTypedQuery(query)); return locking.getCount(versionedQuery); }
public void setTransaction(Transaction transaction) { locking.setTransaction(transaction); }
public ReferencedEnvelope getBounds(Query query) throws IOException { DefaultQuery versionedQuery = store.buildVersionedQuery(getTypedQuery(query)); return locking.getBounds(versionedQuery); }
public Transaction getTransaction() { return locking.getTransaction(); }