Search in sources :

Example 1 with JsonFieldsException

use of cwms.radar.api.errors.JsonFieldsException in project cwms-radar-api by USACE.

the class LevelsController method deserializeLocationLevel.

public static LocationLevel deserializeLocationLevel(String body, String format, String office) {
    ObjectMapper om = getObjectMapperForFormat(format);
    LocationLevel retVal;
    try {
        retVal = new LocationLevel.Builder(om.readValue(body, LocationLevel.class)).withOfficeId(office).build();
        return retVal;
    } catch (JsonProcessingException e) {
        throw new JsonFieldsException(e);
    }
}
Also used : JsonFieldsException(cwms.radar.api.errors.JsonFieldsException) LocationLevel(cwms.radar.data.dto.LocationLevel) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 JsonFieldsException (cwms.radar.api.errors.JsonFieldsException)1 LocationLevel (cwms.radar.data.dto.LocationLevel)1