Package org.geotools.data.simple

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


    }

    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"));
    }
    public void testGetFeatureStoreRemoveFeatures() throws IOException {
View Full Code Here


    @Test
    public void testUpdateOnSelection() throws Exception {
        SimpleFeatureStore transformed = (SimpleFeatureStore) transformWithSelection();
       
        // modify the feature
        transformed.modifyFeatures("persons", 0, CQL.toFilter("state_name = 'Illinois'"));
       
        // check it has been modified
        assertEquals(1, STATES.getFeatures(new Query(null, CQL.toFilter("persons = 0"))).size());
        SimpleFeatureCollection rfc = transformed.getFeatures(new Query(null, CQL.toFilter("persons = 0")));
        assertEquals(1, rfc.size());
View Full Code Here

    @Test
    public void testUpdateOnRename() throws Exception {
        SimpleFeatureStore transformed = (SimpleFeatureStore) transformWithRename();
       
        // modify the feature
        transformed.modifyFeatures("people", 0, CQL.toFilter("name = 'Illinois'"));
       
        // check it has been modified
        assertEquals(1, STATES.getFeatures(new Query(null, CQL.toFilter("persons = 0"))).size());
        SimpleFeatureCollection rfc = transformed.getFeatures(new Query(null, CQL.toFilter("people = 0")));
        assertEquals(1, rfc.size());
View Full Code Here

    @Test
    public void testUpdateOnTransform() throws Exception {
        SimpleFeatureStore transformed = (SimpleFeatureStore) transformWithPartialTransform();
       
        // modify the feature
        transformed.modifyFeatures("people", 0, CQL.toFilter("name = 'illinois'"));
       
        // check it has been modified
        assertEquals(1, STATES.getFeatures(new Query(null, CQL.toFilter("persons = 0"))).size());
        SimpleFeatureCollection rfc = transformed.getFeatures(new Query(null, CQL.toFilter("people = 0")));
        assertEquals(1, rfc.size());
View Full Code Here

        SimpleFeatureStore store;
        store = (SimpleFeatureStore) rts.getFeatureSource(RENAMED);
        SimpleFeature original = store.getFeatures(fidFilter).features().next();
        String newAddress = ((String) original.getAttribute("ADDRESS")) + " xxx";

        store.modifyFeatures(original.getFeatureType().getDescriptor("ADDRESS"), newAddress,
                fidFilter);
        SimpleFeature modified = store.getFeatures(fidFilter).features().next();
        assertEquals(newAddress, modified.getAttribute("ADDRESS"));
    }
View Full Code Here

            } finally {
                features.close(preprocess);
            }

            try {
                store.modifyFeatures(names, values, filter);
            } catch( Exception e) {
                //JD: this is a bit hacky but some of the wfs cite tests require
                // that the 'InvalidParameterValue' code be set on exceptions in
                // cases where a "bad" value is being suppliedin an update, so
                // we always set to that code
View Full Code Here

            } finally {
                preprocess.close();
            }

            try {
                store.modifyFeatures(names, values, filter);
            } catch( Exception e) {
                //JD: this is a bit hacky but some of the wfs cite tests require
                // that the 'InvalidParameterValue' code be set on exceptions in
                // cases where a "bad" value is being suppliedin an update, so
                // we always set to that code
View Full Code Here

        SimpleFeatureStore store;
        store = (SimpleFeatureStore) rts.getFeatureSource(RENAMED);
        SimpleFeature original = store.getFeatures(fidFilter).features().next();
        String newAddress = ((String) original.getAttribute("ADDRESS")) + " xxx";

        store.modifyFeatures(original.getFeatureType().getDescriptor("ADDRESS"), newAddress,
                fidFilter);
        SimpleFeature modified = store.getFeatures(fidFilter).features().next();
        assertEquals(newAddress, modified.getAttribute("ADDRESS"));
    }
View Full Code Here

        store = (SimpleFeatureStore) rts.getFeatureSource(RENAMED);
        SimpleFeature original = store.getFeatures(fidFilter).features().next();

        // test a non mapped attribute
        String newDescription = ((String) original.getAttribute("description")) + " xxx";
        store.modifyFeatures(original.getFeatureType().getDescriptor("description"), newDescription,
                fidFilter);
        SimpleFeature modified = store.getFeatures(fidFilter).features().next();
        assertEquals(newDescription, modified.getAttribute("description"));
       
        // test a mapped attribute
View Full Code Here

        assertEquals(newDescription, modified.getAttribute("description"));
       
        // test a mapped attribute
        MultiPoint mpo = (MultiPoint) original.getAttribute("pointProperty");
        MultiPoint mpm = mpo.getFactory().createMultiPoint(new Coordinate[] {new Coordinate(10, 12)});
        store.modifyFeatures(original.getFeatureType().getDescriptor("pointProperty"), mpm,
                fidFilter);
        modified = store.getFeatures(fidFilter).features().next();
        assertTrue(mpm.equalsExact((Geometry) modified.getAttribute("pointProperty")));
    }
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.