public void visit(FidFilter filter) { fids.addAll(Arrays.asList(filter.getFids())); }
/** * @see org.geotools.xml.schema.Type#getValue(org.geotools.xml.schema.Element, * org.geotools.xml.schema.ElementValue[], * org.xml.sax.Attributes, java.util.Map) */ public Object getValue(Element element, ElementValue[] value, Attributes attrs, Map hints) throws SAXException, SAXNotSupportedException { if ((element == null) || (value == null) || (element.getType() == null)) { throw new SAXException("Invalid parameters : null found"); } if (value.length < 1) { throw new SAXException("Invalid children: too few"); } if (!getName().equals(element.getType().getName())) { throw new SAXException("Invalid type name for element provided"); } Set fidSet = new HashSet(); for (int i = 0; i < value.length; i++) fidSet.addAll(Arrays.asList( ((FidFilter) value[i].getValue()).getFids())); FidFilter r = FilterFactoryFinder.createFilterFactory().createFidFilter(); r.addAllFids(fidSet); return r; }
/** * 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) { Set ids = filter.getIDs(); if (ids.isEmpty()) { throw new IllegalArgumentException(
/** * @see org.geotools.xml.schema.Type#getValue(org.geotools.xml.schema.Element, * org.geotools.xml.schema.ElementValue[], * org.xml.sax.Attributes, java.util.Map) */ public Object getValue(Element element, ElementValue[] value, Attributes attrs, Map hints) throws SAXException, SAXNotSupportedException { if ((element == null) || (value == null) || (element.getType() == null)) { throw new SAXException("Invalid parameters : null found"); } if (value.length < 1) { throw new SAXException("Invalid children: too few"); } if (!getName().equals(element.getType().getName())) { throw new SAXException("Invalid type name for element provided"); } Set fidSet = new HashSet(); for (int i = 0; i < value.length; i++) fidSet.addAll(Arrays.asList( ((FidFilter) value[i].getValue()).getFids())); FidFilter r = FilterFactoryFinder.createFilterFactory().createFidFilter(); r.addAllFids(fidSet); return r; }
/** * 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)); } } }
protected void queryFidFilter() { FidFilter fidFilter = (FidFilter) filter; if (fidIndex == -1) { fidIndex = 0; } while( fidIndex < fidFilter.getFids().length && next == null ) { String fid = fidFilter.getFids()[fidIndex]; if( encounteredFids.contains(fid) ){ fidIndex++; continue; } next = (Feature) diff.modified2.get(fid); if( next==null ){ next = (Feature) diff.added.get(fid); } fidIndex++; } }
public void visit(org.geotools.filter.FidFilter filter) { String[] fids = filter.getFids(); for (int i = 0; i < fids.length; i++) { AttributesImpl atts = new AttributesImpl(); atts.addAttribute("", "fid", "fid", "", fids[i]); element("FeatureId",null,atts); } }
String[] fids = filter.getFids(); LOGGER.finer("Exporting FID=" + Arrays.asList(fids));
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; }
String[] fids = filter.getFids(); LOGGER.finer("Exporting FID=" + Arrays.asList(fids));
/** * @see org.geotools.xml.schema.Type#getValue(org.geotools.xml.schema.Element, * org.geotools.xml.schema.ElementValue[], * org.xml.sax.Attributes, java.util.Map) */ public Object getValue(Element element, ElementValue[] value, Attributes attrs1, Map hints) throws SAXException, SAXNotSupportedException { if ((element == null) || (value == null) || (element.getType() == null)) { throw new SAXException("Invalid parameters : null found"); } if (value.length < 1) { throw new SAXException("Invalid children: too few"); } if (!getName().equals(element.getType().getName())) { throw new SAXException("Invalid type name for element provided"); } List fidList = new ArrayList(); for (int i = 0; i < value.length; i++) fidList.addAll(Arrays.asList( ((FidFilter) value[i].getValue()).getFids())); return fidList; }
String[] fids = filter.getFids(); LOGGER.finer("Exporting FID=" + Arrays.asList(fids));
private void handleDeleteAction(List<Action> actions, int i, InsertAction action, DeleteAction deleteAction) { // if inserted action has been deleted then remove action if (deleteAction.getFilter().evaluate(action.getFeature())) { actions.remove(i); // if filter is a fid filter of size 1 then it only contains the // inserted feature which // no longer exists since it has been deleted. so remove that action // as well. if (deleteAction.getFilter() instanceof FidFilter && ((FidFilter) deleteAction.getFilter()).getFids().length == 1) { actions.remove(i); } } else { swap(actions, i); } }
private int handleUpdateAction(List<Action> actions, int i, InsertAction action, UpdateAction updateAction) { // if update action applies to feature then update feature if (updateAction.getFilter().evaluate(action.getFeature())) { updateAction.update(action.getFeature()); // if filter is a fid filter and there is only 1 fid then filter // uniquely identifies // only the // one features so remove it. if (updateAction.getFilter() instanceof FidFilter && ((FidFilter) updateAction.getFilter()).getFids().length == 1) { actions.remove(i + 1); return i; } } swap(actions, i); return i + 1; }
if (filter instanceof FidFilter && fixURL!=null ) { FidFilter fidFilter = (FidFilter) filter; goodRecs = queryFidIndex(fidFilter.getFids()); } else { if (filter != null) {