Skip to content

featurestore modifyfeature by name

Jody Garnett edited this page Apr 11, 2015 · 8 revisions

Description

I have a bug assigned to me, GEOT-2376 covering what appears to be a mistake early on when defining FeatureStore. The modifyFeature methods both take an AttributeDescriptor, rather then a Name.

There are a couple of drawbacks to this:

  • it introduced the possibility of error (the user has to look up the exactly correct attribute descriptor).
  • It "mixing up "query" api with "metadata" description (a mistake me made earlier when Filter required an AttributeType)
  • it is needlessly complicated

To back up this bug a code review of all feature store implementations show that:

  • implementors noticed the waste of time and simply use the provided AttributeDescriptor as as String (using descriptor.getLocalName())
  • i the case of JDBCDataStore they look up the correct attribute descriptor by Name and silently substitute.

API CHANGE

Before:

interface implements FeatureStore<T,F> extends FeatureSource<T,F> {
   ...
   modifyFeature( AttributeDescriptor type, Object value, Filter filter );
   modifyFeature( AttributeDescriptor type[], Object value[], Filter filter );
   ...
}

After:

interface implements FeatureStore<T,F> extends FeatureSource<T,F> {
   ...
   modifyFeature( Name name, Object value, Filter filter );

   @deprecated
   modifyFeature( AttributeDescriptor type, Object value, Filter filter );

   modifyFeature( Name names[], Object values[], Filter filter );

   @deprecated
   modifyFeature( AttributeDescriptor type[], Object value[], Filter filter );
   ...
}

The patch also updates implementations and passes tests when applied against 2.6.x at the time of writing.

Related:

  • It would be kind to add SimpleFeatureStore implementations that take a String should that proposal be accepted.

Status

This bug report now needs a proposal as it reflects an api change; the patch is ready.

Proposal accepted; applied to trunk:

------------|--------------------|------------|-------------------------|-------------------------------| no progress | done | impeded | lack mandate/funds/time | volunteer needed |

  1. Apply patch from https://osgeo-org.atlassian.net/browse/GEOT-2376 to trunk
    • May wish to update SimpleFeatureStore with modifyFeature( String name, Object value, Filter filter ) and modifyFeatures( String name[], Object value[], Filter filter )
  1. Update example code
Clone this wiki locally