protected internal virtual void applyQueryParams(MetricsQuery query, MultivaluedMap <string, string> queryParameters) { DateConverter dateConverter = new DateConverter(); dateConverter.ObjectMapper = objectMapper; if (queryParameters.getFirst(QUERY_PARAM_START_DATE) != null) { DateTime startDate = dateConverter.convertQueryParameterToType(queryParameters.getFirst(QUERY_PARAM_START_DATE)); query.startDate(startDate); } if (queryParameters.getFirst(QUERY_PARAM_END_DATE) != null) { DateTime endDate = dateConverter.convertQueryParameterToType(queryParameters.getFirst(QUERY_PARAM_END_DATE)); query.endDate(endDate); } IntegerConverter intConverter = new IntegerConverter(); intConverter.ObjectMapper = objectMapper; if (queryParameters.getFirst(QUERY_PARAM_FIRST_RESULT) != null) { int firstResult = intConverter.convertQueryParameterToType(queryParameters.getFirst(QUERY_PARAM_FIRST_RESULT)).Value; query.offset(firstResult); } if (queryParameters.getFirst(QUERY_PARAM_MAX_RESULTS) != null) { int maxResults = intConverter.convertQueryParameterToType(queryParameters.getFirst(QUERY_PARAM_MAX_RESULTS)).Value; query.limit(maxResults); } if (queryParameters.getFirst(QUERY_PARAM_AGG_BY_REPORTER) != null) { query.aggregateByReporter(); } }