Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of srsName in StoredQueries #1629

Merged
merged 3 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@

import java.io.IOException;
import java.io.StringReader;
import java.math.BigInteger;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -260,10 +259,11 @@ private List<Pair<AdHocQuery, org.deegree.protocol.wfs.query.Query>> convertTemp
try {
String templ = IOUtils.toString(u.openStream());
for (Entry<String, OMElement> e : query.getParams().entrySet()) {
String val = e.getValue().getText();
Pattern p = Pattern.compile("[$][{]" + e.getKey() + "[}]", Pattern.CASE_INSENSITIVE);
templ = p.matcher(templ).replaceAll(val);
String key = e.getKey();
templ = replaceParam(key, e.getValue().getText(), templ);
}
String defaultSrsName = controller.getDefaultQueryCrs().getAlias();
templ = replaceParam("srsName", defaultSrsName, templ);

LOG.debug("Stored query template after replacement: {}", templ);

Expand All @@ -287,6 +287,11 @@ private List<Pair<AdHocQuery, org.deegree.protocol.wfs.query.Query>> convertTemp
}
}

private static String replaceParam(String key, String val, String templ) {
Pattern p = Pattern.compile("[$][{]" + key + "[}]", Pattern.CASE_INSENSITIVE);
return p.matcher(templ).replaceAll(val);
}

private List<Pair<AdHocQuery, org.deegree.protocol.wfs.query.Query>> convertStoredQueries(
List<org.deegree.protocol.wfs.query.Query> wfsQueries) throws OWSException {
List<Pair<AdHocQuery, org.deegree.protocol.wfs.query.Query>> adHocQueries = new ArrayList<Pair<AdHocQuery, org.deegree.protocol.wfs.query.Query>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ StoredQueryDefinition file. Here's an example:
</Parameter>
<QueryExpressionText returnFeatureTypes="ad:Address"
language="urn:ogc:def:queryLanguage:OGC-:WFSQueryExpression">
<Query typeNames="ad:Address">
<Query srsName="${srsName}" typeNames="ad:Address">
<Filter xmlns="http://www.opengis.net/fes/2.0">
<PropertyIsEqualTo>
<ValueReference>
Expand Down Expand Up @@ -798,6 +798,8 @@ Query-Elements should be used. An exception is thrown as
DescribeStoredQueries response, if the configured feature type is not
served by the WFS.

The optional attribute _srsName="${srsName}"_ can be set to support the parameter _srsName_ in the GetFeature request to determine the CRS of the returned geometries. If the paramater is missing in the request, the default CRS of the WFS is returned.

To enable support for the Manage Stored Queries conformance class for WFS 2.0.0 it is required to create a directory storedqueries/managed in your workspace. The stored queries created with _CreateStoredQuery_ requests are stored in this directory. They are loaded during startup of deegree automatically. It is not recommend to put the StoredQueries configured in the WFS configuration with the StoredQuery element into this folder. If the directory is missing the _CreateStoredQuery_ request returns an exception.

TIP: deegree WFS supports the execution of stored queries using
Expand Down