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 4ef0278..82061b6 100644 --- a/src/main/java/ch/psi/daq/queryrest/controller/QueryRestController.java +++ b/src/main/java/ch/psi/daq/queryrest/controller/QueryRestController.java @@ -43,6 +43,7 @@ import ch.psi.daq.domain.query.operation.Compression; import ch.psi.daq.domain.query.operation.QueryField; import ch.psi.daq.domain.query.response.Response; import ch.psi.daq.domain.query.response.ResponseFormat; +import ch.psi.daq.domain.query.transform.image.resize.ValueAggregation; import ch.psi.daq.domain.request.validate.RequestProviderValidator; import ch.psi.daq.queryrest.query.QueryManager; import ch.psi.daq.queryrest.response.AbstractHTTPResponse; @@ -53,6 +54,7 @@ import ch.psi.daq.queryrest.response.json.JSONHTTPResponse; public class QueryRestController { private static final Logger LOGGER = LoggerFactory.getLogger(QueryRestController.class); + public static final String PARAMETERS_ROOT_PATH = "params"; @Resource private ApplicationContext appContext; @@ -215,7 +217,18 @@ public class QueryRestController { * * @return list of {@link Ordering}s as String array */ + @Deprecated @RequestMapping(value = "ordering", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE}) + 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}) public @ResponseBody List getOrderingValues() { return Lists.newArrayList(Ordering.values()); } @@ -225,8 +238,20 @@ public class QueryRestController { * * @return list of {@link Ordering}s as String array */ + @Deprecated @RequestMapping(value = "responseformat", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE}) + public @ResponseBody List getResponseFormatValuesDeprecated() { + return Lists.newArrayList(ResponseFormat.values()); + } + + /** + * Returns the current list of {@link ResponseFormat}s available. + * + * @return list of {@link Ordering}s as String array + */ + @RequestMapping(value = PARAMETERS_ROOT_PATH + "/responseformat", method = {RequestMethod.GET}, + produces = {MediaType.APPLICATION_JSON_VALUE}) public @ResponseBody List getResponseFormatValues() { return Lists.newArrayList(ResponseFormat.values()); } @@ -236,7 +261,20 @@ public class QueryRestController { * * @return list of {@link QueryField}s as String array */ + @Deprecated @RequestMapping(value = "queryfields", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE}) + public @ResponseBody List getQueryFieldValuesDeprecated() { + return Arrays.stream(QueryField.values()) + .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}) public @ResponseBody List getQueryFieldValues() { return Arrays.stream(QueryField.values()) .filter(queryField -> queryField.isPublish()) @@ -248,8 +286,19 @@ public class QueryRestController { * * @return list of {@link Aggregation}s as String array */ + @Deprecated @RequestMapping(value = "aggregations", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE}) - public @ResponseBody List getAggregationsValues() { + 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}) + public @ResponseBody List getAggregationValues() { return Lists.newArrayList(Aggregation.values()); } @@ -258,9 +307,21 @@ public class QueryRestController { * * @return list of {@link AggregationType}s as String array */ + @Deprecated @RequestMapping(value = "aggregationtypes", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE}) - public @ResponseBody List getAggregationTypesValues() { + public @ResponseBody List getAggregationTypeValuesDeprecated() { + return Lists.newArrayList(AggregationType.values()); + } + + /** + * Returns the current list of {@link AggregationType}s available. + * + * @return list of {@link AggregationType}s as String array + */ + @RequestMapping(value = PARAMETERS_ROOT_PATH + "/aggregationtypes", method = {RequestMethod.GET}, + produces = {MediaType.APPLICATION_JSON_VALUE}) + public @ResponseBody List getAggregationTypeValues() { return Lists.newArrayList(AggregationType.values()); } @@ -269,8 +330,19 @@ public class QueryRestController { * * @return list of {@link Backend}s as String array */ + @Deprecated @RequestMapping(value = "backends", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE}) - public @ResponseBody List getDBModeValues() { + public @ResponseBody List getBackendValuesDeprecated() { + return Lists.newArrayList(Backend.values()); + } + + /** + * 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}) + public @ResponseBody List getBackendValues() { return Lists.newArrayList(Backend.values()); } @@ -279,8 +351,29 @@ public class QueryRestController { * * @return list of {@link Compression}s as String array */ + @Deprecated @RequestMapping(value = "compression", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE}) + 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}) public @ResponseBody List getCompressionValues() { 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 + "/valueaggregations", method = {RequestMethod.GET}, produces = {MediaType.APPLICATION_JSON_VALUE}) + public @ResponseBody List getValueAggregations() { + return Lists.newArrayList(ValueAggregation.values()); + } }