log.warn("feature has no geometry: " + feature.getIdentifier()); continue;
public FeatureId getIdentifier() { return feature.getIdentifier(); }
public FeatureId getIdentifier() { return delegate.getIdentifier(); }
public FeatureId getIdentifier() { return delegate.getIdentifier(); }
static SimpleFeature retype(SimpleFeature source, SimpleFeatureBuilder builder) throws IllegalAttributeException { SimpleFeatureType target = builder.getFeatureType(); for (int i = 0; i < target.getAttributeCount(); i++) { AttributeDescriptor attributeType = target.getDescriptor(i); Object value = null; if (source.getFeatureType().getDescriptor(attributeType.getName()) != null) { value = source.getAttribute(attributeType.getName()); } builder.add(value); } FeatureId id = reTypeId(source.getIdentifier(), source.getFeatureType(), target); SimpleFeature retyped = builder.buildFeature(id.getID()); retyped.getUserData().putAll(source.getUserData()); return retyped; }
log.warn("feature has no geometry: " + feature.getIdentifier()); continue;
public int lastIndexOf(SimpleFeature feature) { return index.lastIndexOf(feature.getIdentifier()); }
public int indexOf(SimpleFeature feature) { return index.indexOf(feature.getIdentifier()); }
public void visitItem(Object item) { SimpleFeature feature = null; try { feature = (SimpleFeature) item; visitor.visit(feature); } catch (Throwable t) { progress.exceptionOccurred(t); String fid = feature == null ? "feature" : feature.getIdentifier().toString(); problem[0] = new IOException("Problem visiting " + fid + ":" + t, t); } finally { progress.progress(count / size); } } });
public int toIndex(SimpleFeature feature) { return Integer.parseInt(feature.getIdentifier().getID().split("\\.", 2)[1]); }
private void applySingleUpdate( QName remoteTypeName, SimpleFeature feature, TransactionRequest transactionRequest) throws IOException { // so bad, this is going to update a lot of unnecessary properties. We'd need to make // DiffContentFeatureWriter's live and current attributes protected and extend write so that // it records the truly modified attributes instead Collection<Property> properties = feature.getProperties(); List<QName> propertyNames = new ArrayList<QName>(); List<Object> newValues = new ArrayList<Object>(); for (Property p : properties) { QName attName = new QName(remoteTypeName.getNamespaceURI(), p.getName().getLocalPart()); Object attValue = p.getValue(); propertyNames.add(attName); newValues.add(attValue); } Filter updateFilter = dataStore.getFilterFactory().id(Collections.singleton(feature.getIdentifier())); Update update = transactionRequest.createUpdate( remoteTypeName, propertyNames, newValues, updateFilter); transactionRequest.add(update); }
cur.getUserData().get(ContentFeatureStore.ORIGINAL_FEATURE_KEY); if (orig != null) { ((FeatureIdImpl) orig.getIdentifier()).setID(fid); orig.getUserData().putAll(cur.getUserData()); orig.getUserData().remove(ContentFeatureStore.ORIGINAL_FEATURE_KEY);
Boolean.TRUE.equals(feature.getUserData().get(Hints.USE_PROVIDED_FID)); if (getQueryCapabilities().isUseProvidedFIDSupported() && useExisting) { ((FeatureIdImpl) toWrite.getIdentifier()).setID(feature.getID()); feature.getUserData().remove(ORIGINAL_FEATURE_KEY); return toWrite.getIdentifier();
public void check(int index, SimpleFeature feature) { assertEquals( tname(features.getSchema().getName().getLocalPart()) + "." + index, feature.getIdentifier().getID()); } });
/** @see FeatureStore#addFeatures(SimpleFeatureCollection) */ public List<FeatureId> addFeatures( final FeatureCollection<SimpleFeatureType, SimpleFeature> collection) throws IOException { // System.err.println(">>addFeatures called at " + // Thread.currentThread().getName()); final String typeName = typeInfo.getFeatureTypeName(); final FeatureWriter<SimpleFeatureType, SimpleFeature> writer; writer = dataStore.getFeatureWriterAppend(typeName, transaction); final FeatureIterator<SimpleFeature> iterator = collection.features(); List<FeatureId> featureIds = new LinkedList<FeatureId>(); try { SimpleFeature toAdd; SimpleFeature newFeature; while (iterator.hasNext()) { toAdd = iterator.next(); newFeature = writer.next(); newFeature.setAttributes(toAdd.getAttributes()); writer.write(); featureIds.add(newFeature.getIdentifier()); } } finally { iterator.close(); writer.close(); } return featureIds; }
@Test public void testIndexesSources() throws Exception { try (Stream<SimpleFeature> fstream = FeatureStreams.toFeatureStream( mappedSource.getMapping().getIndexSource().getFeatures())) { assertTrue(fstream.anyMatch(f -> f.getIdentifier().getID().equals("st.1"))); } }
/** * Remaps a SimpleFeature, using the given mappings (oldname -> mappedname). The builder uses * the mapped schema. * * @param source * @param attributeMappings * @param builder * @return */ static SimpleFeature remap( SimpleFeature source, Map<String, String> attributeMappings, SimpleFeatureBuilder builder) { SimpleFeatureType target = builder.getFeatureType(); for (int i = 0; i < target.getAttributeCount(); i++) { AttributeDescriptor attributeType = target.getDescriptor(i); Object value = null; String mappedName = attributeMappings.get(attributeType.getLocalName()); if (source.getFeatureType().getDescriptor(mappedName) != null) { value = source.getAttribute(mappedName); } builder.add(value); } return builder.buildFeature(source.getIdentifier().getID()); }
Filter fidFilter0 = ff.id(feature0.getIdentifier()); Filter fidFilter1 = ff.id(feature1.getIdentifier());
Filter fidFilter = ff.id(feature.getIdentifier());
assertEquals(feature2.getID(), feature2.getIdentifier().getID());