diff --git a/handler/src/main/java/org/n52/sos/ds/GetFeatureOfInterestHandler.java b/handler/src/main/java/org/n52/sos/ds/GetFeatureOfInterestHandler.java index 5b7621ef9d..bae609aedc 100644 --- a/handler/src/main/java/org/n52/sos/ds/GetFeatureOfInterestHandler.java +++ b/handler/src/main/java/org/n52/sos/ds/GetFeatureOfInterestHandler.java @@ -249,10 +249,13 @@ private FeatureVisitorContext getDefaultContext() { */ private Collection queryFeaturesForParameter(GetFeatureOfInterestRequest req, Session session) throws OwsExceptionReport { - Collection allFeatures = - req.isSetSpatialFilters() ? new FeatureDao(session).get(createFoiDbQuery(req)) - : new LinkedHashSet<>(); - if (!req.isSetSpatialFilters() || allFeatures != null && !allFeatures.isEmpty()) { + Collection allFeatures = req.isSetSpatialFilters() || req.isSetFeatureOfInterestIdentifiers() + ? new FeatureDao(session).get(createFoiDbQuery(req)) + : new LinkedHashSet<>(); + if ((req.isSetFeatureOfInterestIdentifiers() + || req.isSetSpatialFilters()) && (allFeatures == null || allFeatures.isEmpty())) { + return Collections.emptySet(); + } else { Collection datasets = new DatasetDao(session).get( createDbQuery(req, allFeatures.stream().map(f -> f.getIdentifier()).collect(Collectors.toSet()))); if (datasets != null) { @@ -268,8 +271,8 @@ private Collection queryFeaturesForParameter(GetFeatureOf allFeatures.stream().filter(o -> !notVisibleFeatures.contains(o)).collect(Collectors.toSet())); return features; } + return Collections.emptySet(); } - return Collections.emptySet(); } /** @@ -323,9 +326,9 @@ protected GeometryHandler getGeometryHandler() { private DbQuery createFoiDbQuery(GetFeatureOfInterestRequest req) throws OwsExceptionReport { Map map = Maps.newHashMap(); -// if (req.isSetFeatureOfInterestIdentifiers()) { -// map.put(IoParameters.FEATURES, listToString(req.getFeatureIdentifiers())); -// } + if (req.isSetFeatureOfInterestIdentifiers()) { + map.put(IoParameters.FEATURES, listToString(req.getFeatureIdentifiers())); + } if (req.isSetSpatialFilters()) { Envelope envelope = null; for (SpatialFilter spatialFilter : req.getSpatialFilters()) { @@ -350,7 +353,7 @@ private DbQuery createFoiDbQuery(GetFeatureOfInterestRequest req) throws OwsExce map.put(IoParameters.BBOX, Joiner.on(",").join(bbox)); } } -// map.put(IoParameters.MATCH_DOMAIN_IDS, Boolean.toString(true)); + map.put(IoParameters.MATCH_DOMAIN_IDS, Boolean.toString(true)); return createDbQuery(IoParameters.createFromSingleValueMap(map)); }