@Test public void testSetFeaturesAutoCommit() throws Exception { testData.insertTestData(); final SimpleFeatureCollection featuresToSet = testData.createTestFeatures(Point.class, 5); final DataStore ds = testData.getDataStore(); final String typeName = testData.getTempTableName(); final SimpleFeatureStore store; store = (SimpleFeatureStore) ds.getFeatureSource(typeName); final int initialCount = store.getCount(Query.ALL); assertTrue(initialCount > 0); assertTrue(initialCount != 5); store.setFeatures(DataUtilities.reader(featuresToSet)); final int newCount = store.getCount(Query.ALL); assertEquals(5, newCount); }
public void setFeatures(final FeatureReader<SimpleFeatureType, SimpleFeature> reader) throws IOException { final SimpleFeatureType readerType = reader.getFeatureType(); if (!getSchema().equals(readerType)) { throw new IllegalArgumentException("Type mismatch: " + readerType); } final String typeName = typeInfo.getFeatureTypeName(); final ISession session = getSession(); try { truncate(typeName, session); } finally { session.dispose(); } final FeatureWriter<SimpleFeatureType, SimpleFeature> writer; writer = dataStore.getFeatureWriterAppend(typeName, transaction); try { while (reader.hasNext()) { SimpleFeature feature = reader.next(); SimpleFeature newFeature = writer.next(); newFeature.setAttributes(feature.getAttributes()); writer.write(); } } finally { writer.close(); } }
ArcSdeFeatureStore extends ArcSdeFeatureSource implements SimpleFeatureStore { public void setFeatures(final FeatureReader<SimpleFeatureType, SimpleFeature> reader) throws IOException { final SimpleFeatureType readerType = reader.getFeatureType(); if (!getSchema().equals(readerType)) { throw new IllegalArgumentException("Type mismatch: " + readerType); } final String typeName = typeInfo.getFeatureTypeName(); final ISession session = getSession(); try { truncate(typeName, session); } finally { session.dispose(); } final FeatureWriter<SimpleFeatureType, SimpleFeature> writer; writer = dataStore.getFeatureWriterAppend(typeName, transaction); try { while (reader.hasNext()) { SimpleFeature feature = reader.next(); SimpleFeature newFeature = writer.next(); newFeature.setAttributes(feature.getAttributes()); writer.write(); } } finally { writer.close(); } } }
ArcSdeFeatureStore extends ArcSdeFeatureSource implements SimpleFeatureStore { public void setFeatures(final FeatureReader<SimpleFeatureType, SimpleFeature> reader) throws IOException { final SimpleFeatureType readerType = reader.getFeatureType(); if (!getSchema().equals(readerType)) { throw new IllegalArgumentException("Type mismatch: " + readerType); } final String typeName = typeInfo.getFeatureTypeName(); final ISession session = getSession(); try { truncate(typeName, session); } finally { session.dispose(); } final FeatureWriter<SimpleFeatureType, SimpleFeature> writer; writer = dataStore.getFeatureWriterAppend(typeName, transaction); try { while (reader.hasNext()) { SimpleFeature feature = reader.next(); SimpleFeature newFeature = writer.next(); newFeature.setAttributes(feature.getAttributes()); writer.write(); } } finally { writer.close(); } } ArcSdeFeatureStore(final FeatureTypeInfo typeInfo, final ArcSDEDataStore arcSDEDataStore); }
ArcSdeFeatureStore extends ArcSdeFeatureSource implements SimpleFeatureStore { public void setFeatures(final FeatureReader<SimpleFeatureType, SimpleFeature> reader) throws IOException { final SimpleFeatureType readerType = reader.getFeatureType(); if (!getSchema().equals(readerType)) { throw new IllegalArgumentException("Type mismatch: " + readerType); } final String typeName = typeInfo.getFeatureTypeName(); final ISession session = getSession(); try { truncate(typeName, session); } finally { session.dispose(); } final FeatureWriter<SimpleFeatureType, SimpleFeature> writer; writer = dataStore.getFeatureWriterAppend(typeName, transaction); try { while (reader.hasNext()) { SimpleFeature feature = reader.next(); SimpleFeature newFeature = writer.next(); newFeature.setAttributes(feature.getAttributes()); writer.write(); } } finally { writer.close(); } } ArcSdeFeatureStore(final FeatureTypeInfo typeInfo, final ArcSDEDataStore arcSDEDataStore); synchronized Transaction getTransaction(); synchronized void setTransaction(final Transaction transaction); List<FeatureId> addFeatures(
            final FeatureCollection<SimpleFeatureType, SimpleFeature> collection); final void modifyFeatures(AttributeDescriptor[] type, Object[] value, Filter filter); void modifyFeatures(final Name[] attributes, final Object[] values, final Filter filter); void modifyFeatures(String name, Object attributeValue, Filter filter); void modifyFeatures(String[] names, Object[] values, Filter filter); final void modifyFeatures(final AttributeDescriptor type, final Object value,
            final Filter filter); final void modifyFeatures(final Name name, final Object value, final Filter filter); void removeFeatures(final Filter filter); void setFeatures(final FeatureReader<SimpleFeatureType, SimpleFeature> reader); }
ArcSdeFeatureStore extends ArcSdeFeatureSource implements SimpleFeatureStore { public void setFeatures(final FeatureReader<SimpleFeatureType, SimpleFeature> reader) throws IOException { final SimpleFeatureType readerType = reader.getFeatureType(); if (!getSchema().equals(readerType)) { throw new IllegalArgumentException("Type mismatch: " + readerType); } final String typeName = typeInfo.getFeatureTypeName(); final ISession session = getSession(); try { truncate(typeName, session); } finally { session.dispose(); } final FeatureWriter<SimpleFeatureType, SimpleFeature> writer; writer = dataStore.getFeatureWriterAppend(typeName, transaction); try { while (reader.hasNext()) { SimpleFeature feature = reader.next(); SimpleFeature newFeature = writer.next(); newFeature.setAttributes(feature.getAttributes()); writer.write(); } } finally { writer.close(); } } ArcSdeFeatureStore(final FeatureTypeInfo typeInfo, final ArcSDEDataStore arcSDEDataStore); synchronized Transaction getTransaction(); synchronized void setTransaction(final Transaction transaction); List<FeatureId> addFeatures(
            final FeatureCollection<SimpleFeatureType, SimpleFeature> collection); final void modifyFeatures(AttributeDescriptor[] type, Object[] value, Filter filter); void modifyFeatures(final Name[] attributes, final Object[] values, final Filter filter); void modifyFeatures(String name, Object attributeValue, Filter filter); void modifyFeatures(String[] names, Object[] values, Filter filter); final void modifyFeatures(final AttributeDescriptor type, final Object value,
            final Filter filter); final void modifyFeatures(final Name name, final Object value, final Filter filter); void removeFeatures(final Filter filter); void setFeatures(final FeatureReader<SimpleFeatureType, SimpleFeature> reader);  }