Search in sources :

Example 1 with IntegerConverter

use of org.camunda.bpm.engine.rest.dto.converter.IntegerConverter in project camunda-bpm-platform by camunda.

the class MetricsRestServiceImpl method applyQueryParams.

protected void applyQueryParams(MetricsQuery query, MultivaluedMap<String, String> queryParameters) {
    DateConverter dateConverter = new DateConverter();
    dateConverter.setObjectMapper(objectMapper);
    if (queryParameters.getFirst(QUERY_PARAM_START_DATE) != null) {
        Date startDate = dateConverter.convertQueryParameterToType(queryParameters.getFirst(QUERY_PARAM_START_DATE));
        query.startDate(startDate);
    }
    if (queryParameters.getFirst(QUERY_PARAM_END_DATE) != null) {
        Date endDate = dateConverter.convertQueryParameterToType(queryParameters.getFirst(QUERY_PARAM_END_DATE));
        query.endDate(endDate);
    }
    IntegerConverter intConverter = new IntegerConverter();
    intConverter.setObjectMapper(objectMapper);
    if (queryParameters.getFirst(QUERY_PARAM_FIRST_RESULT) != null) {
        int firstResult = intConverter.convertQueryParameterToType(queryParameters.getFirst(QUERY_PARAM_FIRST_RESULT));
        query.offset(firstResult);
    }
    if (queryParameters.getFirst(QUERY_PARAM_MAX_RESULTS) != null) {
        int maxResults = intConverter.convertQueryParameterToType(queryParameters.getFirst(QUERY_PARAM_MAX_RESULTS));
        query.limit(maxResults);
    }
}
Also used : IntegerConverter(org.camunda.bpm.engine.rest.dto.converter.IntegerConverter) DateConverter(org.camunda.bpm.engine.rest.dto.converter.DateConverter) Date(java.util.Date)

Aggregations

Date (java.util.Date)1 DateConverter (org.camunda.bpm.engine.rest.dto.converter.DateConverter)1 IntegerConverter (org.camunda.bpm.engine.rest.dto.converter.IntegerConverter)1