Skip to content

Commit

Permalink
Merge pull request 52North#308 from ridoo/fix/issue_307_broken_metada…
Browse files Browse the repository at this point in the history
…ta_filtering

parse single id which was not taken over when introducing lambda
  • Loading branch information
ridoo authored Mar 9, 2017
2 parents 27b3eb5 + 3cb10b3 commit 462b817
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import org.n52.io.request.IoParameters;
import org.n52.io.request.Parameters;
import org.n52.io.response.PlatformType;
import org.n52.io.response.dataset.DatasetType;
import org.n52.series.db.beans.DatasetEntity;
import org.n52.series.db.beans.PlatformEntity;
import org.opengis.referencing.FactoryException;
Expand Down Expand Up @@ -278,7 +279,7 @@ protected Long parseToId(String id) {
}

public Set<Long> parseToIds(Set<String> ids) {
return ids.stream().map(e -> Long.parseLong(e)).collect(Collectors.toSet());
return ids.stream().map(e -> parseToId(e)).collect(Collectors.toSet());
}

public Criteria addSpatialFilterTo(Criteria criteria, DbQuery query) {
Expand Down Expand Up @@ -340,9 +341,13 @@ public Criteria addDetachedFilters(String propertyName, Criteria criteria) {
addHierarchicalFilterRestriction(parameters.getOfferings(), "offering", filter);
addFilterRestriction(parameters.getFeatures(), "feature", filter);
addFilterRestriction(parameters.getCategories(), "category", filter);
addFilterRestriction(parameters.getDatasets(), filter);
addFilterRestriction(parameters.getSeries(), filter);

addFilterRestriction(parameters.getDatasets()
.stream()
.map(e -> DatasetType.extractId(e))
.collect(Collectors.toSet()), filter);

if (hasValues(parameters.getPlatforms())) {
Set<String> stationaryIds = getStationaryIds(parameters.getPlatforms());
Set<String> mobileIds = getMobileIds(parameters.getPlatforms());
Expand Down Expand Up @@ -403,7 +408,7 @@ private Criterion createDomainIdFilter(Set<String> filterValues) {
private Criterion createIdFilter(Set<String> filterValues) {
return Restrictions.in(COLUMN_KEY, parseToIds(filterValues));
}

private boolean hasValues(Set<String> values) {
return values != null && !values.isEmpty();
}
Expand Down

0 comments on commit 462b817

Please sign in to comment.