Requested properties should be returned in order of the FeatureType, not the requested order

Description

A request of specific propertyNames should conform to the schema returned by FeatureSource.getSchema. Currently this is not the case, if I'm to request propertyNames
{ "name", "gid" }
from a FeatureType that contains Attributes (in order)

I looked into this for about an hour, but came up short. This should be done in JDBCDataStore. We've currently got way to many functions in that class that come up with the correct attributeTypes. getAttTypes(List attNames, FeatureType schema) is the only one that does the right thing with respects to ordering the attributes, getAttributeTypes(String typeName, String[] propertyNames) does about the same thing, but puts them in the order of the the propertyNames, not of the schema. Worse, we have getFeatureWriter using one, and getFeatureReader using the other.

I tried making getAttributeTypes wrap getAttTypes, but it didn't work all the way through with GeoServer. The problem was that it creates a different FeatureType that is not recognized by FeatureTransformer. I think this may have to do with reTyping, more investigation is needed. I have to get my release out right now, so I can't look at it further. If anyone wants to have a shot I can easily test it for them (though trivial testing, making sure that requested propNames are returned in featureType order instead of requested order, is easy). Or this can just serve as a reminder for me to do it, though I might not get to it for a few weeks (I have a hack that works for geoserver for the cite test I need it to).

Environment

None

Activity

Show:
codehaus
April 10, 2015, 4:00 PM

CodeHaus Comment From: seangeo - Time: Tue, 6 Jan 2004 02:36:21 -0600
---------------------
<p>Actually, now that I have thought about it I would tend to agree with Jody on this one. WFS aside, if I, as a geotools user request properties E,C,A from FeatureType A,B,C,D,E I would expect to get them in the order I requested them. </p>

<p>Think about SQL, as a generic query language, not just a DB query language, when you request certain column in a select statement you get them in the order you request them not in the table order.</p>

<p>If WFS requires something different, GeoServer should probably mangle the result as needed.</p>

codehaus
April 10, 2015, 4:00 PM

CodeHaus Comment From: cholmes - Time: Tue, 6 Jan 2004 10:18:36 -0600
---------------------
<p>Ah, you're right, I do remember that conversation now. I'll try to move this issue to geoserver. Should be able to do it in DEFFeatureLocking, as it's a decorator to requests. </p>

<p>In geotools we still should clean up the getAtt(ribute)Types methods, as we've got too many floating around. getFeatureWriter and getFeatureReader should use the same one.</p>

codehaus
April 10, 2015, 4:00 PM

CodeHaus Comment From: seangeo - Time: Wed, 7 Jan 2004 18:42:29 -0600
---------------------
<p>Ive removed the duplicate getAtt(ribute)Types methods in JDBCDataStore. </p>

codehaus
April 10, 2015, 4:00 PM

CodeHaus Comment From: jgarnett - Time: Mon, 19 Jan 2004 22:49:17 -0600
---------------------
<p>I belive the GeoServerFeatureSource wrapper now takes care of reording the attributes to order specified by the schema.xml file.</p>

codehaus
April 10, 2015, 4:00 PM

CodeHaus Comment From: aaime - Time: Thu, 29 Mar 2007 02:05:59 -0500
---------------------
<p>These issue has been in resolved state for at least one month (quite a bit, a lot more than one month). Batch transitioning them to closed state</p>

Assignee

Unassigned

Reporter

codehaus

Triage

None

Fix versions

Affects versions

Components

Priority

Medium
Configure