public void write() throws IOException { try { SimpleFeatureType target = getFeatureType(); for (int i = 0; i < target.getAttributeCount(); i++) { AttributeDescriptor at = target.getDescriptor(i); Object value = retyped.getAttribute(i); current.setAttribute(at.getLocalName(), value); } delegate.write(); } catch (IllegalAttributeException e) { throw (IOException) new IOException("Error occurred while retyping feature").initCause(e); } } }
public void setAttribute(Name arg0, Object arg1) { delegate.setAttribute(arg0, arg1); }
public void setAttribute(int index, Object value) throws IndexOutOfBoundsException { delegate.setAttribute(index, value); }
public void setAttribute(Name name, Object value) { delegate.setAttribute(name, value); }
@Override public void setProperties(SimpleFeature feature) { for (String propertyName : getPropertyNames()) { // set the property feature.setAttribute(propertyName, date); } }
private String setFeatureTime(SimpleFeature feature, Date date, CoordinateSystem cs) { String originalTimeAttribute = null; if (date != null) { originalTimeAttribute = getTimeAttribute(cs); String timeAttribute = originalTimeAttribute; if (reader.uniqueTimeAttribute) { timeAttribute = NetCDFUtilities.TIME; } feature.setAttribute(timeAttribute, date); } return originalTimeAttribute; }
@Override public void setProperties(SimpleFeature feature) { if (date != null) { for (String propertyName : getPropertyNames()) { // set the property feature.setAttribute(propertyName, date); } } }
@Override public void setProperties(SimpleFeature feature) { if (date != null) { for (String propertyName : getPropertyNames()) { // set the property feature.setAttribute(propertyName, date); } } }
public void setAttribute(String name, Object value) { name = fixPropertyName(name); delegate.setAttribute(name, value); }
@Override public void setProperties(SimpleFeature feature) { feature.setAttribute(this.getPropertyNames().get(0), this.crsCode); }
public void set(Object object, String xpath, Object value, Class target) throws IllegalAttributeException { xpath = stripPrefixIndex(xpath); if (object instanceof SimpleFeature) { ((SimpleFeature) object).setAttribute(xpath, value); } if (object instanceof SimpleFeatureType) { throw new IllegalAttributeException("feature type is immutable"); } } }
@Override public void setProperties(SimpleFeature feature) { Date date = getDate(); if (date != null) { for (String propertyName : getPropertyNames()) { // set the property feature.setAttribute(propertyName, date); } } }
default void handleStructuredGranule( Object source, GridCoverage2DReader inputReader, SimpleFeature targetFeature, SimpleFeatureType targetFeatureType, SimpleFeature inputFeature, SimpleFeatureType inputFeatureType, MosaicConfigurationBean mosaicConfiguration) { Object geometryAttribute = inputFeature.getAttribute(inputFeatureType.getGeometryDescriptor().getName()); targetFeature.setAttribute( targetFeatureType.getGeometryDescriptor().getName(), geometryAttribute); } }
private void writeToShapefile( SimpleFeature f, FeatureWriter<SimpleFeatureType, SimpleFeature> writer) throws IOException { SimpleFeature fw = writer.next(); // we cannot trust attribute order, shapefile changes the location and name of the geometry for (AttributeDescriptor d : fw.getFeatureType().getAttributeDescriptors()) { fw.setAttribute(d.getLocalName(), f.getAttribute(d.getLocalName())); } fw.setDefaultGeometry(f.getDefaultGeometry()); writer.write(); }
public void testWriteFeatures() throws Exception { try (FeatureWriter fw = dataStore.getFeatureWriterAppend(tname(PERSON), Transaction.AUTO_COMMIT)) { SimpleFeature f = (SimpleFeature) fw.next(); f.setAttribute(aname("name"), "Joe"); f.setAttribute(aname("age"), 27); fw.write(); } FeatureCollection fc = dataStore.getFeatureSource(tname(PERSON)).getFeatures(); assertEquals(3, fc.size()); } }
public void testGetFeatureWriterAppend() throws IOException { try (FeatureWriter<SimpleFeatureType, SimpleFeature> writer = dataStore.getFeatureWriterAppend(tname("ft1"), Transaction.AUTO_COMMIT)) { for (int i = 3; i < 6; i++) { SimpleFeature feature = writer.next(); feature.setAttribute(aname("intProperty"), Integer.valueOf(i)); writer.write(); } } SimpleFeatureCollection features = dataStore.getFeatureSource(tname("ft1")).getFeatures(); assertEquals(6, features.size()); }
public void testNullTest() throws Exception { Function exp = ff.function("geometryType", ff.property("geom")); SimpleFeatureIterator iter = featureCollection.features(); while (iter.hasNext()) { SimpleFeature feature = iter.next(); feature.setAttribute("geom", null); assertNull(exp.evaluate(feature)); } iter.close(); }
public void testNoCommit() throws IOException { try (Transaction tx = new DefaultTransaction(); FeatureWriter<SimpleFeatureType, SimpleFeature> writer = dataStore.getFeatureWriterAppend(tname("ft1"), tx)) { SimpleFeature feature = writer.next(); feature.setAttribute(aname("intProperty"), Integer.valueOf(100)); writer.write(); tx.rollback(); } SimpleFeatureCollection fc = dataStore.getFeatureSource(tname("ft1")).getFeatures(); assertEquals(3, fc.size()); }
public void testModifyFeatures() throws Exception { try (FeatureWriter<SimpleFeatureType, SimpleFeature> w = dataStore.getFeatureWriter(tname("guid"), Transaction.AUTO_COMMIT)) { w.hasNext(); SimpleFeature f = w.next(); f.setAttribute(aname("uuidProperty"), uuid2); assertEquals(uuid2, f.getAttribute(aname("uuidProperty"))); w.write(); } }
public void testGetFeaturesWriterModify() throws IOException { try (FeatureWriter<SimpleFeatureType, SimpleFeature> writer = writer(tname("road"))) { while (writer.hasNext()) { SimpleFeature feature = (SimpleFeature) writer.next(); if (feature.getID().equals(td.roadFeatures[0].getID())) { feature.setAttribute(aname("name"), "changed"); writer.write(); } } } SimpleFeature feature = (SimpleFeature) feature(tname("road"), td.roadFeatures[0].getID()); assertNotNull(feature); assertEquals("changed", feature.getAttribute(aname("name"))); }