From 9c9e1bebb51c6e04058a0465af744342225a4e2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=A4rki?= Date: Fri, 30 Jun 2017 17:33:46 +0200 Subject: [PATCH] Filestorage version. --- .../controller/QueryRestController.java | 50 ++++++++++++------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/src/main/java/ch/psi/daq/queryrest/controller/QueryRestController.java b/src/main/java/ch/psi/daq/queryrest/controller/QueryRestController.java index fc27e03..f758015 100644 --- a/src/main/java/ch/psi/daq/queryrest/controller/QueryRestController.java +++ b/src/main/java/ch/psi/daq/queryrest/controller/QueryRestController.java @@ -1,5 +1,6 @@ package ch.psi.daq.queryrest.controller; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -103,7 +104,8 @@ public class QueryRestController { */ @RequestMapping(value = DomainConfig.PATH_CHANNELS + "/{channelName}", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE}) - public @ResponseBody Collection getChannels(@PathVariable(value = "channelName") String channelName) + public @ResponseBody Collection getChannels( + @PathVariable(value = "channelName") String channelName) throws Throwable { return getChannels(new ChannelsRequest(channelName)); } @@ -223,13 +225,14 @@ public class QueryRestController { public @ResponseBody List getOrderingValuesDeprecated() { return Lists.newArrayList(Ordering.values()); } - + /** * Returns the current list of {@link Ordering}s available. * * @return list of {@link Ordering}s as String array */ - @RequestMapping(value = PARAMETERS_ROOT_PATH + "/ordering", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE}) + @RequestMapping(value = PARAMETERS_ROOT_PATH + "/ordering", method = {RequestMethod.GET}, + produces = {MediaType.APPLICATION_JSON_VALUE}) public @ResponseBody List getOrderingValues() { return Lists.newArrayList(Ordering.values()); } @@ -245,7 +248,7 @@ public class QueryRestController { public @ResponseBody List getResponseFormatValuesDeprecated() { return Lists.newArrayList(ResponseFormat.values()); } - + /** * Returns the current list of {@link ResponseFormat}s available. * @@ -269,13 +272,14 @@ public class QueryRestController { .filter(queryField -> queryField.isPublish()) .collect(Collectors.toList()); } - + /** * Returns the current list of {@link QueryField}s available. * * @return list of {@link QueryField}s as String array */ - @RequestMapping(value = PARAMETERS_ROOT_PATH + "/queryfields", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE}) + @RequestMapping(value = PARAMETERS_ROOT_PATH + "/queryfields", method = {RequestMethod.GET}, + produces = {MediaType.APPLICATION_JSON_VALUE}) public @ResponseBody List getQueryFieldValues() { return Arrays.stream(QueryField.values()) .filter(queryField -> queryField.isPublish()) @@ -292,13 +296,14 @@ public class QueryRestController { public @ResponseBody List getAggregationValuesDeprecated() { return Lists.newArrayList(Aggregation.values()); } - + /** * Returns the current list of {@link Aggregation}s available. * * @return list of {@link Aggregation}s as String array */ - @RequestMapping(value = PARAMETERS_ROOT_PATH + "/aggregations", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE}) + @RequestMapping(value = PARAMETERS_ROOT_PATH + "/aggregations", method = {RequestMethod.GET}, + produces = {MediaType.APPLICATION_JSON_VALUE}) public @ResponseBody List getAggregationValues() { return Lists.newArrayList(Aggregation.values()); } @@ -314,7 +319,7 @@ public class QueryRestController { public @ResponseBody List getAggregationTypeValuesDeprecated() { return Lists.newArrayList(AggregationType.values()); } - + /** * Returns the current list of {@link AggregationType}s available. * @@ -334,17 +339,21 @@ public class QueryRestController { @Deprecated @RequestMapping(value = "backends", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE}) public @ResponseBody List getBackendValuesDeprecated() { - return Lists.newArrayList(Backend.values()); + return getBackendValues(); } - + /** * Returns the current list of {@link Backend} values. * * @return list of {@link Backend}s as String array */ - @RequestMapping(value = PARAMETERS_ROOT_PATH + "/backends", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE}) + @RequestMapping(value = PARAMETERS_ROOT_PATH + "/backends", method = {RequestMethod.GET}, + produces = {MediaType.APPLICATION_JSON_VALUE}) public @ResponseBody List getBackendValues() { - return Lists.newArrayList(Backend.values()); + List filtered = new ArrayList<>(Lists.newArrayList(Backend.values())); + filtered.remove(Backend.SF_DATABUFFER_OLD); + return filtered; + // return Lists.newArrayList(Backend.values()); } /** @@ -357,33 +366,36 @@ public class QueryRestController { public @ResponseBody List getCompressionValuesDeprecated() { return Lists.newArrayList(Compression.values()); } - + /** * Returns the current list of {@link Compression}s available. * * @return list of {@link Compression}s as String array */ - @RequestMapping(value = PARAMETERS_ROOT_PATH + "/compression", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE}) + @RequestMapping(value = PARAMETERS_ROOT_PATH + "/compression", method = {RequestMethod.GET}, + produces = {MediaType.APPLICATION_JSON_VALUE}) public @ResponseBody List getCompressionValues() { return Lists.newArrayList(Compression.values()); } - + /** * Returns the current list of {@link ValueAggregation}s available. * * @return list of {@link ValueAggregation}s as String array */ - @RequestMapping(value = PARAMETERS_ROOT_PATH + "/valueaggregations", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE}) + @RequestMapping(value = PARAMETERS_ROOT_PATH + "/valueaggregations", method = {RequestMethod.GET}, + produces = {MediaType.APPLICATION_JSON_VALUE}) public @ResponseBody List getValueAggregations() { return Lists.newArrayList(ValueAggregation.values()); } - + /** * Returns the current list of {@link ValueAggregation}s available. * * @return list of {@link ValueAggregation}s as String array */ - @RequestMapping(value = PARAMETERS_ROOT_PATH + "/colormodeltypes", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE}) + @RequestMapping(value = PARAMETERS_ROOT_PATH + "/colormodeltypes", method = {RequestMethod.GET}, + produces = {MediaType.APPLICATION_JSON_VALUE}) public @ResponseBody List getColorModelTypes() { return Lists.newArrayList(ColorModelType.values()); }