// geoserver call
try {
MfFeatureCollection featureCollection = featuresProvider.getFeatures(featureSource, parameters);
List featureList = new ArrayList(featureCollection.getCollection());
MfFeature feature = (MfFeature) featureList.get(0);
//Geometry from GeoServer
MfGeometry geom = feature.getMfGeometry();
// JSON creation
JSONObject jsonProperties = new JSONObject();
//for each col
for(int j=0; j<nc; j++){
jsonProperties.accumulate(
dataStoreMeta.getFieldName(j),
record.getFieldAt( dataStoreMeta.getFieldIndex(dataStoreMeta.getFieldName(j)) ).getValue()
);
}
//for each prop
if(feature instanceof SbiFeature) {
JSONObject properties = ((SbiFeature)feature).getProperties();
Iterator keysIterator = properties.sortedKeys();
while(keysIterator.hasNext()) {
String key = (String)keysIterator.next();
jsonProperties.accumulate(key, properties.get(key));
}
}
MfFeature featureToCollect = SbiFeatureFactory.getInstance().createFeature(geoIdPValue, geom, jsonProperties);
outputFeatureCollection.add(featureToCollect);
} catch (Exception e) {
e.printStackTrace();
}
}