@Test public void testInsertNonNillableAttributeCheck() throws Exception { testData.truncateTempTable(); final String typeName = testData.getTempTableName(); final int featureCount = 1; SimpleFeature feature; feature = testData.createTestFeatures(LineString.class, featureCount).features().next(); final DataStore ds = testData.getDataStore(); SimpleFeatureStore store = (SimpleFeatureStore) ds.getFeatureSource(typeName); SimpleFeatureType ftype = store.getSchema(); assertFalse(ftype.getDescriptor("INT32_COL").isNillable()); feature.setAttribute("INT32_COL", null); SimpleFeatureCollection collection = DataUtilities.collection(feature); try { store.addFeatures(collection); fail("Expected IAE"); } catch (IllegalArgumentException e) { assertTrue(true); } }
public List<FeatureId> addFeatures( final FeatureCollection<SimpleFeatureType, SimpleFeature> collection) throws IOException { 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; }
ArcSdeFeatureStore extends ArcSdeFeatureSource implements SimpleFeatureStore { public List<FeatureId> addFeatures( final FeatureCollection<SimpleFeatureType, SimpleFeature> collection) throws IOException { 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; } }
ArcSdeFeatureStore extends ArcSdeFeatureSource implements SimpleFeatureStore { public List<FeatureId> addFeatures( final FeatureCollection<SimpleFeatureType, SimpleFeature> collection) throws IOException { 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; } ArcSdeFeatureStore(final FeatureTypeInfo typeInfo, final ArcSDEDataStore arcSDEDataStore); }
ArcSdeFeatureStore extends ArcSdeFeatureSource implements SimpleFeatureStore { public List<FeatureId> addFeatures( final FeatureCollection<SimpleFeatureType, SimpleFeature> collection) throws IOException { 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; } 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 List<FeatureId> addFeatures( final FeatureCollection<SimpleFeatureType, SimpleFeature> collection) throws IOException { 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; } 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);  }