/** * 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"); ((FidFilter) 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)); } } }
/** * 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"); ((FidFilter) 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)); } } }
public void visit(FidFilter filter) { FidFilter copy = ff.createFidFilter(); String[] fids = filter.getFids(); for (int i = 0; i < fids.length; i++) { copy.addFid(fids[i]); } pages.push(copy); }
private FidFilter getEncodableFilter(Filter unEncodableFilter) throws IOException, FactoryRegistryException, IllegalAttributeException { // this is very similar to getFidSet - the reason is so that we // don't spend time constructing geometries when we don't need // to, but we probably could get some better code reuse. DefaultQuery query = new DefaultQuery(); query.setPropertyNames(new String[0]); query.setFilter(unEncodableFilter); SimpleFeatureCollection features = getFeatures(unEncodableFilter); FilterFactory ff = FilterFactoryFinder.createFilterFactory(); FidFilter fidFilter = ff.createFidFilter(); SimpleFeatureIterator it = features.features(); try { while( it.hasNext() ) { SimpleFeature feature = (SimpleFeature) it.next(); fidFilter.addFid(feature.getID()); } } finally { features.close( it ); } return fidFilter; }