Skip to content

Commit

Permalink
Fix getfoi
Browse files Browse the repository at this point in the history
  • Loading branch information
CarstenHollmann committed Nov 18, 2022
1 parent 4927739 commit 52b71e1
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,13 @@ private FeatureVisitorContext getDefaultContext() {
*/
private Collection<AbstractFeatureEntity> queryFeaturesForParameter(GetFeatureOfInterestRequest req,
Session session) throws OwsExceptionReport {
Collection<FeatureEntity> allFeatures =
req.isSetSpatialFilters() ? new FeatureDao(session).get(createFoiDbQuery(req))
: new LinkedHashSet<>();
if (!req.isSetSpatialFilters() || allFeatures != null && !allFeatures.isEmpty()) {
Collection<FeatureEntity> 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<DatasetEntity> datasets = new DatasetDao(session).get(
createDbQuery(req, allFeatures.stream().map(f -> f.getIdentifier()).collect(Collectors.toSet())));
if (datasets != null) {
Expand All @@ -268,8 +271,8 @@ private Collection<AbstractFeatureEntity> queryFeaturesForParameter(GetFeatureOf
allFeatures.stream().filter(o -> !notVisibleFeatures.contains(o)).collect(Collectors.toSet()));
return features;
}
return Collections.emptySet();
}
return Collections.emptySet();
}

/**
Expand Down Expand Up @@ -323,9 +326,9 @@ protected GeometryHandler getGeometryHandler() {

private DbQuery createFoiDbQuery(GetFeatureOfInterestRequest req) throws OwsExceptionReport {
Map<String, String> 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()) {
Expand All @@ -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));
}

Expand Down

0 comments on commit 52b71e1

Please sign in to comment.