querySet(eObject, "featureVersion",
Collections.singletonList((String) kvp.get("featureVersion")));
}
if(kvp.containsKey("format_options")) {
GetFeatureType gft = (GetFeatureType) eObject;
gft.getFormatOptions().putAll((Map) kvp.get("format_options"));
}
// sql view params
if(kvp.containsKey("viewParams")) {
GetFeatureType gft = (GetFeatureType) eObject;
if(gft.getMetadata() == null) {
gft.setMetadata(new HashMap());
}
// fan out over all layers if necessary
List<Map<String, String>> viewParams = (List<Map<String, String>>) kvp.get("viewParams");
if(viewParams.size() > 0) {
int layerCount = gft.getQuery().size();
// if we have just one replicate over all layers
if(viewParams.size() == 1 && layerCount > 1) {
List<Map<String, String>> replacement = new ArrayList<Map<String,String>>();
for (int i = 0; i < layerCount; i++) {
replacement.add(viewParams.get(0));
}
viewParams = replacement;
} else if(viewParams.size() != layerCount) {
String msg = layerCount + " feature types requested, but found " + viewParams.size()
+ " view params specified. ";
throw new ServiceException(msg, getClass().getName());
}
}
gft.getMetadata().put(GetFeature.SQL_VIEW_PARAMS, viewParams);
}
return request;
}