diff --git a/rest-api/resources/src/main/java/org/eclipse/kapua/app/api/resources/v1/resources/DataMessages.java b/rest-api/resources/src/main/java/org/eclipse/kapua/app/api/resources/v1/resources/DataMessages.java index 85e66421067..98b8039355b 100644 --- a/rest-api/resources/src/main/java/org/eclipse/kapua/app/api/resources/v1/resources/DataMessages.java +++ b/rest-api/resources/src/main/java/org/eclipse/kapua/app/api/resources/v1/resources/DataMessages.java @@ -91,15 +91,15 @@ public > MessageListResult simpleQuery(@PathParam("scope @QueryParam("startDate") DateParam startDateParam, @QueryParam("endDate") DateParam endDateParam, @QueryParam("metricName") String metricName, - @QueryParam("metricType") MetricType metricType, + @QueryParam("metricType") String metricType, @QueryParam("metricMin") String metricMinValue, @QueryParam("metricMax") String metricMaxValue, @QueryParam("sortDir") @DefaultValue("DESC") SortDirection sortDir, @QueryParam("offset") @DefaultValue("0") int offset, @QueryParam("limit") @DefaultValue("50") int limit) throws KapuaException { - - MessageQuery query = parametersToQuery(datastorePredicateFactory, messageStoreFactory, scopeId, clientId, channel, strictChannel, startDateParam, endDateParam, metricName, metricType, metricMinValue, metricMaxValue, sortDir, offset, limit); + MetricType internalMetricType = new MetricType<>(metricType); + MessageQuery query = parametersToQuery(datastorePredicateFactory, messageStoreFactory, scopeId, clientId, channel, strictChannel, startDateParam, endDateParam, metricName, internalMetricType, metricMinValue, metricMaxValue, sortDir, offset, limit); return query(scopeId, query); } diff --git a/rest-api/resources/src/main/java/org/eclipse/kapua/app/api/resources/v1/resources/DataMessagesJson.java b/rest-api/resources/src/main/java/org/eclipse/kapua/app/api/resources/v1/resources/DataMessagesJson.java index afa058ddafb..44fac949ad3 100644 --- a/rest-api/resources/src/main/java/org/eclipse/kapua/app/api/resources/v1/resources/DataMessagesJson.java +++ b/rest-api/resources/src/main/java/org/eclipse/kapua/app/api/resources/v1/resources/DataMessagesJson.java @@ -93,14 +93,15 @@ public > JsonMessageListResult simpleQueryJson(@PathPara @QueryParam("startDate") DateParam startDateParam, @QueryParam("endDate") DateParam endDateParam, @QueryParam("metricName") String metricName, - @QueryParam("metricType") MetricType metricType, + @QueryParam("metricType") String metricType, @QueryParam("metricMin") String metricMinValue, @QueryParam("metricMax") String metricMaxValue, @QueryParam("sortDir") @DefaultValue("DESC") SortDirection sortDir, @QueryParam("offset") @DefaultValue("0") int offset, @QueryParam("limit") @DefaultValue("50") int limit) throws KapuaException { - MessageQuery query = DataMessages.parametersToQuery(datastorePredicateFactory, messageStoreFactory, scopeId, clientId, channel, strictChannel, startDateParam, endDateParam, metricName, metricType, metricMinValue, metricMaxValue, sortDir, offset, limit); + MetricType internalMetricType = new MetricType<>(metricType); + MessageQuery query = DataMessages.parametersToQuery(datastorePredicateFactory, messageStoreFactory, scopeId, clientId, channel, strictChannel, startDateParam, endDateParam, metricName, internalMetricType , metricMinValue, metricMaxValue, sortDir, offset, limit); query.setScopeId(scopeId); final MessageListResult result = messageStoreService.query(query);