Package org.geotools.data.simple

Examples of org.geotools.data.simple.SimpleFeatureStore.modifyFeatures()


        names.add(store.getSchema().getDescriptor(name).getName());
        values.add(attrMap.get(name).getValue());
      }

      try {
        store.modifyFeatures(names.toArray(new Name[names.size()]), values.toArray(), filter);
        store.modifyFeatures(store.getSchema().getGeometryDescriptor().getName(), getFeatureModel()
            .getGeometry(feature), filter);
        log.debug("Updated feature {} in {}", featureId, getFeatureSourceName());
      } catch (IOException ioe) {
        featureModelUsable = false;
View Full Code Here


        values.add(attrMap.get(name).getValue());
      }

      try {
        store.modifyFeatures(names.toArray(new Name[names.size()]), values.toArray(), filter);
        store.modifyFeatures(store.getSchema().getGeometryDescriptor().getName(), getFeatureModel()
            .getGeometry(feature), filter);
        log.debug("Updated feature {} in {}", featureId, getFeatureSourceName());
      } catch (IOException ioe) {
        featureModelUsable = false;
        throw new LayerException(ioe, ExceptionCode.LAYER_MODEL_IO_EXCEPTION);
View Full Code Here

        try {
            if (geoResource.canResolve(SimpleFeatureStore.class)) {
                final Filter filter = CommonFactoryFinder.getFilterFactory2().id(fid);
                final SimpleFeatureStore featureStore = geoResource.resolve(
                        SimpleFeatureStore.class, monitor);
                featureStore.modifyFeatures(attributeName, obj, filter);
                return true;
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
View Full Code Here

            final Transaction transaction = new DefaultTransaction("testModifyFeaturesTransaction");
            store.setTransaction(transaction);

            try {
                final AttributeDescriptor propDescriptor = schema.getDescriptor("INT32_COL");
                store.modifyFeatures(propDescriptor.getName(), Integer.valueOf(-1000),
                        oldValueFilter);
                transaction.commit();
            } catch (Exception e) {
                transaction.rollback();
            } finally {
View Full Code Here

        store.setTransaction(transaction);
        final FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
        Filter fid1Filter = ff.id(Collections.singleton(ff.featureId(fid1)));
        Filter fid2Filter = ff.id(Collections.singleton(ff.featureId(fid2)));
        try {
            store.modifyFeatures(defaultGeometry.getName(), modif2, fid2Filter);
            store.modifyFeatures(defaultGeometry.getName(), modif1, fid1Filter);
            transaction.commit();
        } catch (Exception e) {
            transaction.rollback();
            throw e;
View Full Code Here

        final FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
        Filter fid1Filter = ff.id(Collections.singleton(ff.featureId(fid1)));
        Filter fid2Filter = ff.id(Collections.singleton(ff.featureId(fid2)));
        try {
            store.modifyFeatures(defaultGeometry.getName(), modif2, fid2Filter);
            store.modifyFeatures(defaultGeometry.getName(), modif1, fid1Filter);
            transaction.commit();
        } catch (Exception e) {
            transaction.rollback();
            throw e;
        } finally {
View Full Code Here

        //get a property of type String to update its value by the given filter
        final AttributeDescriptor attribute = schema.getDescriptor("f");
       
        assertEquals(2, count(ds, typeName, fidFilter));

        store.modifyFeatures(attribute, "modified", fidFilter);
        Filter modifiedFilter = ff.equals(ff.property("f"), ff.literal("modified"));
        assertEquals(2, count(ds, typeName, modifiedFilter));
       
        final int initialCount = store.getCount(Query.ALL);
        store.removeFeatures(fidFilter);
View Full Code Here

    // Feature Store Testing
    //
    public void testGetFeatureStoreModifyFeatures1() throws IOException {
        SimpleFeatureStore road = (SimpleFeatureStore) data.getFeatureSource("ROAD");
        AttributeDescriptor name = roadType.getDescriptor("NAME");
        road.modifyFeatures(name, "changed", rd1Filter);

        SimpleFeatureCollection results = road.getFeatures(rd1Filter);
        assertEquals("changed", results.features().next().getAttribute("NAME"));
    }
View Full Code Here

    }

    public void testGetFeatureStoreModifyFeatures2() throws IOException {
        SimpleFeatureStore road = (SimpleFeatureStore) data.getFeatureSource("ROAD");
        AttributeDescriptor name = roadType.getDescriptor("NAME");
        road.modifyFeatures(new AttributeDescriptor[] { name, },
            new Object[] { "changed", }, rd1Filter);

        SimpleFeatureCollection results = road.getFeatures(rd1Filter);
        assertEquals("changed", results.features().next().getAttribute("NAME"));
    }
View Full Code Here

     */
    @Test
    public void testUpdate() throws FileNotFoundException, IOException {
        DataStore csv = this.getDataStore();
        SimpleFeatureStore rows = (SimpleFeatureStore) csv.getFeatureSource( TYPE_NAME );
        rows.modifyFeatures(NUMBER_COL, 333, this.newTestFilter());
       
        // re-open
        csv = this.getDataStore();
        rows = (SimpleFeatureStore) csv.getFeatureSource( TYPE_NAME );
        SimpleFeatureCollection features = rows.getFeatures();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.