Commit 989af0fd authored by Matija Obreza's avatar Matija Obreza

Merge branch '331-accession-apiv1-wrap-overview-response' into 'master'

Resolve "Accession APIv1: wrap Overview response"

Closes #331

See merge request genesys-pgr/genesys-server!229
parents 415f0728 2e9c372f
......@@ -187,7 +187,7 @@ public class AccessionController {
*/
@PostMapping(value = "/overview", produces = { MediaType.APPLICATION_JSON_VALUE })
@JsonView({ JsonViews.Public.class })
public Map<String, TermResult> overview(@RequestParam(name = "f", required = false) String filterCode, @RequestBody(required = false) AccessionFilter filter)
public AccessionOverview overview(@RequestParam(name = "f", required = false) String filterCode, @RequestBody(required = false) AccessionFilter filter)
throws IOException, SearchException {
if (filterCode != null) {
......@@ -196,7 +196,9 @@ public class AccessionController {
filterCode = shortFilterService.getCode(filter);
}
return elasticsearchService.termStatisticsAuto(Accession.class, filter, 10, terms.toArray(new String[] {}));
Map<String, TermResult> overview = elasticsearchService.termStatisticsAuto(Accession.class, filter, 10, terms.toArray(new String[] {}));
return AccessionOverview.from(filterCode, filter, overview);
}
/**
......@@ -411,4 +413,19 @@ public class AccessionController {
public String[] tileServers;
}
private static class AccessionOverview {
public String filterCode;
public AccessionFilter filter;
public Map<String, TermResult> overview;
private static AccessionOverview from(String filterCode, AccessionFilter filter, Map<String, TermResult> overview) {
AccessionOverview res = new AccessionOverview();
res.filterCode = filterCode;
res.filter = filter;
res.overview = overview;
return res;
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment