throw new WFSException(req, "Stored queries only supported in WFS 2.0+");
}
StoredQueryProvider sqp = new StoredQueryProvider(catalog);
for (URI storedQueryId : storedQueryIds) {
StoredQuery sq = sqp.getStoredQuery(storedQueryId.toString());
if (sq == null) {
throw new WFSException(req, "No such stored query: " + storedQueryId);
}
//JD: since stored queries are 2.0 only we will create 2.0 model objects directly... once
// the next version of wfs comes out (and if they keep stored queries around) we will have
// to abstract stored query away with a request object adapter
Wfs20Factory factory = (Wfs20Factory) req.getFactory();
StoredQueryType storedQuery = factory.createStoredQueryType();
storedQuery.setId(storedQueryId.toString());
//look for parameters in the kvp map
for (ParameterExpressionType p : sq.getQuery().getParameter()) {
if (kvp.containsKey(p.getName())) {
ParameterType param = factory.createParameterType();
param.setName(p.getName());
param.setValue(kvp.get(p.getName()).toString());
storedQuery.getParameter().add(param);