/** * Returns the feature collection for the features which match the specified filter. * * <p>This method calls through to {@link #getFeatures(Query)}. */ public final ContentFeatureCollection getFeatures(Filter filter) throws IOException { return getFeatures(new Query(getSchema().getTypeName(), filter)); }
@Override public WFSDataStore getDataStore() { return (WFSDataStore) super.getDataStore(); }
@Override protected boolean handleVisitor(Query query, FeatureVisitor visitor) throws IOException { return super.handleVisitor(query, visitor); } }
/** * Returns a reader for features specified by a particular filter. * * <p>This method calls through to {@link #getReader(Query)}. */ public final FeatureReader<SimpleFeatureType, SimpleFeature> getReader(Filter filter) throws IOException { return getReader(new Query(getSchema().getTypeName(), filter)); }
public void testGetFeaturesWithInvalidFilter() throws Exception { FilterFactory ff = CommonFactoryFinder.getFilterFactory(null); PropertyIsEqualTo f = ff.equals(ff.property("invalidAttribute"), ff.literal(5)); // make sure a complaint related to the invalid filter is thrown here try (SimpleFeatureIterator fi = featureSource.getFeatures(f).features()) { fail("This query should have failed, it contains an invalid filter"); } catch (Exception e) { java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", e); // fine } }
/** Unlocks features specified by a filter. */ public final void unLockFeatures(Filter filter) throws IOException { filter = resolvePropertyNames(filter); String typeName = getSchema().getTypeName(); FeatureReader<SimpleFeatureType, SimpleFeature> reader = getReader(filter); try { while (reader.hasNext()) { SimpleFeature feature = reader.next(); // // Use native locking? // if (canLock()) { doUnlockInternal(typeName, feature); } else { getDataStore() .getLockingManager() .unLockFeatureID(typeName, feature.getID(), transaction, lock); } } } finally { reader.close(); } }
Logger logger = getDataStore().getLogger(); String typeName = getSchema().getTypeName(); FeatureReader<SimpleFeatureType, SimpleFeature> reader = getReader(filter); try { int locked = 0; if (canLock()) { doLockInternal(typeName, feature); } else { getDataStore() .getLockingManager() .lockFeatureID(typeName, feature.getID(), transaction, lock);
this.query = query; this.featureType = featureSource.getSchema(); tb.userData( ContentDataStore.JOINED_FEATURE_TYPE, featureSource.getDataStore().getSchema(typeName)); } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to retrieve the joined feature type");
public void testBetweenNegation() throws Exception { Not filter = ff.not( ff.between( ff.property(aname(B)), ff.property(aname(A)), ff.property(aname(C)))); ContentFeatureSource fs = dataStore.getFeatureSource(tname(ABC)); Query q = new Query(tname(ABC), filter); int count = fs.getCount(q); assertEquals(1, count); SimpleFeature f = DataUtilities.first(fs.getFeatures(q)); assertEquals("n_n_n", f.getAttribute(aname(NAME))); }
if (handleVisitor(query, visitor)) { FeatureReader<SimpleFeatureType, SimpleFeature> reader = getReader(query); try { float size = progress instanceof NullProgressListener ? 0.0f : (float) getCount(query); float position = 0; progress.started();
public ReferencedEnvelope getBounds() { try { return ContentFeatureSource.this.getBounds(); } catch (IOException e) { return null; } }
public void accepts( org.opengis.feature.FeatureVisitor visitor, org.opengis.util.ProgressListener progress) throws IOException { featureSource.accepts(query, visitor, progress); }
/** * Returns the same name than the feature type (ie, {@code getSchema().getName()} to honor the * simple feature land common practice of calling the same both the Features produces and their * types * * @since 2.5 * @see FeatureSource#getName() */ public Name getName() { return getSchema().getName(); }
public long getCount(Query query) throws IOException { return getFeatureSource().getCount(query); }
private void flushState(ContentDataStore contentDataStore, String nativeName) throws IOException { ContentFeatureSource featureSource; featureSource = contentDataStore.getFeatureSource(nativeName); featureSource.getState().flush(); }
public void testBboxFilterDefault() throws Exception { FilterFactory ff = CommonFactoryFinder.getFilterFactory(null); // should match only "r2" BBOX bbox = ff.bbox("", 2, 3, 4, 5, "EPSG:4326"); FeatureCollection features = dataStore.getFeatureSource(tname("road")).getFeatures(bbox); checkSingleResult(features, "r2"); }
if ( handleVisitor(query,visitor) ) { FeatureReader<SimpleFeatureType, SimpleFeature> reader = getReader(query); try{ float size = progress instanceof NullProgressListener ? 0.0f : (float) getCount( query ); float position = 0; progress.started();
/** * Returns the bounds of the entire feature source. * * <p>This method delegates to {@link #getBounds(Query)}: * * <pre> * <code>return getBounds(Query.ALL)</code>. * </pre> */ public final ReferencedEnvelope getBounds() throws IOException { // return all(entry.getState(transaction)).getBounds(); return getBounds(Query.ALL); }
public void computeAggregateFunction(Query query, FeatureCalc function) throws IOException { final Lock lock = rwLock.readLock(); try { lock.lock(); checkStore(); SimpleFeatureSource fs = slicesIndexStore.getFeatureSource(query.getTypeName()); if (fs instanceof ContentFeatureSource) ((ContentFeatureSource) fs).accepts(query, function, null); else { final SimpleFeatureCollection collection = fs.getFeatures(query); collection.accepts(function, null); } } finally { lock.unlock(); } }