public void testFidFilter() { FidFilterImpl ff = new FidFilterImpl(); ff.addFid("1"); FidFilterImpl ff2 = new FidFilterImpl("1"); assertNotNull(ff2); assertEquals(ff, ff2); assertTrue(!ff.equals(null)); assertTrue(!ff.equals("a string not even a filter")); ff2.addFid("2"); assertTrue(!ff.equals(ff2)); ff.addFid("2"); assertEquals(ff, ff2); }
/** @see org.opengis.filter.identity.FeatureId#setIDs(Set) */ public void setIDs(Set ids) { fids = new HashSet(); addAllFids(ids); }
/** * Accessor method for fid set as Strings. * * @return the internally stored fids. */ public Set<String> getFidsSet() { return fids(); }
public Id id(Set id) { return new FidFilterImpl(id); }
/** * Constructor with first fid set * * @param initialFid The type of comparison. * @deprecated use {@link #FidFilterImpl(Set)} */ protected FidFilterImpl(String initialFid) { addFid(initialFid); }
/** @see org.opengis.filter.Id#getIDs() */ @SuppressWarnings("unchecked") public Set getIDs() { return getFidsSet(); }
/** * Removes a collection of feature IDs from the filter. * * @param fidsToRemove A collection of feature IDs. */ public void removeAllFids(Collection fidsToRemove) { if (fidsToRemove == null) return; for (Iterator f = fidsToRemove.iterator(); f.hasNext(); ) { String fid = (String) f.next(); removeFid(fid); } }
public CloseableIterator<SimpleFeature> getData( final Geometry jtsBounds, final TemporalConstraintsSet timeBounds, final Filter filter, final Integer limit) { if (filter instanceof FidFilterImpl) { final Set<String> fids = ((FidFilterImpl) filter).getIDs(); final byte[][] ids = new byte[fids.size()][]; int i = 0; for (final String fid : fids) { ids[i++] = StringUtils.stringToBinary(fid); } final Index[] writeIndices = components.getAdapterIndices(); final String queryIndexName = ((writeIndices != null) && (writeIndices.length > 0)) ? writeIndices[0].getName() : null; VectorQueryBuilder bldr = VectorQueryBuilder.newBuilder().addTypeName( components.getAdapter().getTypeName()).indexName(queryIndexName).setAuthorizations( transaction.composeAuthorizations()); if (limit != null) { bldr = bldr.limit(limit); } if (subsetRequested()) { bldr = bldr.subsetFields(components.getAdapter().getTypeName(), getSubset()); } return components.getDataStore().query( bldr.constraints(bldr.constraintsFactory().dataIds(ids)).build()); } return issueQuery(jtsBounds, timeBounds, new BaseIssuer(filter, limit)); }
FidFilterImpl fidFilter = (FidFilterImpl) filter; for (Identifier identifier : fidFilter.getIdentifiers()) { setExpressionParameter(ff.literal(identifier), filterName.getParameter(0));
/** * Creates a Fid Filter with an initial fid. * * @param fid the feature ID to create with. * * @return The new FidFilter. */ public FidFilter createFidFilter(String fid) { return new FidFilterImpl(fid); }
/** * Adds a collection of feature IDs to the filter. * * @param fidsToAdd A collection of feature IDs as strings. */ public void addAllFids(Collection fidsToAdd) { if (fidsToAdd == null) return; for (Iterator i = fidsToAdd.iterator(); i.hasNext(); ) { String fid = (String) i.next(); addFid(fid); } }
/** * @see org.opengis.filter.Id#getIDs() */ public Set getIDs() { return getFidsSet(); }
/** * Removes a collection of feature IDs from the filter. * * @param fidsToRemove * A collection of feature IDs. */ public void removeAllFids(Collection fidsToRemove) { if (fidsToRemove == null) return; for (Iterator f = fidsToRemove.iterator(); f.hasNext();) { String fid = (String) f.next(); removeFid(fid); } }
/** * Creates a new Fid Filter with no initial fids. * * @return The new Fid Filter. */ public FidFilter createFidFilter() { return new FidFilterImpl(); }
/** * Sets the filter attributes. Called when attributes are encountered by the filter filter. Puts * them in a hash map by thier name and value. * * @param atts the attributes to set. */ public void setAttributes(Attributes atts) { LOGGER.finer("got attribute: " + atts.getLocalName(0) + ", " + atts.getValue(0)); LOGGER.finer("current state: " + curState); if (curState.equals("fid")) { LOGGER.finer("is a fid"); ((FidFilterImpl) curFilter).addFid(atts.getValue(0)); LOGGER.finer("added fid"); } else { for (int i = 0; i < atts.getLength(); i++) { this.attributes.put(atts.getLocalName(i), atts.getValue(i)); } } }
/** * Returns all the fids in this filter. * * @return An array of all the fids in this filter. * @deprecated use {@link #getIDs()} */ public final String[] getFids() { return (String[]) fids().toArray(new String[0]); }
/** * @see org.opengis.filter.Id#getIDs() */ public Set getIDs() { return getFidsSet(); }
/** * Removes a collection of feature IDs from the filter. * * @param fidsToRemove * A collection of feature IDs. */ public void removeAllFids(Collection fidsToRemove) { if (fidsToRemove == null) return; for (Iterator f = fidsToRemove.iterator(); f.hasNext();) { String fid = (String) f.next(); removeFid(fid); } }
/** * @see org.opengis.filter.identity.FeatureId#setIDs(Set) */ public void setIDs(Set ids) { fids = new HashSet(); addAllFids(ids); }
/** * Creates a new Fid Filter with no initial fids. * * @return The new Fid Filter. */ public FidFilter createFidFilter() { return new FidFilterImpl(); }