Skip to content
Snippets Groups Projects
Commit fbee27d7 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Adding custom (de)serialization

parent 5c652f93
No related branches found
No related tags found
No related merge requests found
...@@ -256,6 +256,11 @@ ...@@ -256,6 +256,11 @@
<artifactId>enunciate-rt-util</artifactId> <artifactId>enunciate-rt-util</artifactId>
<version>2.10.1</version> <version>2.10.1</version>
</dependency> </dependency>
<dependency>
<groupId>com.bedatadriven</groupId>
<artifactId>jackson-datatype-jts</artifactId>
<version>2.2</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -207,7 +207,8 @@ public class RoughageService { ...@@ -207,7 +207,8 @@ public class RoughageService {
TMel, TMel,
firstLongTermForecastTime, firstLongTermForecastTime,
dateOfLastWeatherData, dateOfLastWeatherData,
timeZone timeZone,
false
); );
Collections.sort(TMLongTime); Collections.sort(TMLongTime);
TMLongTime = wUtil.fillHourlyHolesBruteForce(TMLongTime, WeatherUtil.AGGREGATION_TYPE_AVERAGE, firstLongTermForecastTime, dateOfLastWeatherData); TMLongTime = wUtil.fillHourlyHolesBruteForce(TMLongTime, WeatherUtil.AGGREGATION_TYPE_AVERAGE, firstLongTermForecastTime, dateOfLastWeatherData);
...@@ -232,7 +233,8 @@ public class RoughageService { ...@@ -232,7 +233,8 @@ public class RoughageService {
RRel, RRel,
firstLongTermForecastTime, firstLongTermForecastTime,
dateOfLastWeatherData, dateOfLastWeatherData,
timeZone timeZone,
false
); );
RRLongTime = wUtil.fillHourlyHolesBruteForce(RRLongTime, WeatherUtil.AGGREGATION_TYPE_SUM, firstLongTermForecastTime, dateOfLastWeatherData); RRLongTime = wUtil.fillHourlyHolesBruteForce(RRLongTime, WeatherUtil.AGGREGATION_TYPE_SUM, firstLongTermForecastTime, dateOfLastWeatherData);
......
...@@ -19,18 +19,24 @@ ...@@ -19,18 +19,24 @@
package no.nibio.vips.logic.service; package no.nibio.vips.logic.service;
import com.bedatadriven.jackson.datatype.jts.JtsModule;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.SerializationFeature;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.ext.ContextResolver; import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider; import javax.ws.rs.ext.Provider;
/** /**
* Add this to no.nibio.vips.logic.VIPSLogicApplication if you want all * Add this to no.nibio.vips.logic.VIPSLogicApplication if you want all
* dates to be serialized as ISO formatted date strings * dates to be serialized as ISO formatted date strings
* @copyright 2015 <a href="http://www.nibio.no/">NIBIO</a> * @copyright 2018 <a href="http://www.nibio.no/">NIBIO</a>
* @author Tor-Einar Skog <tor-einar.skog@nibio.no> * @author Tor-Einar Skog <tor-einar.skog@nibio.no>
*/ */
@Provider @Provider
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class JacksonConfig implements ContextResolver<ObjectMapper> public class JacksonConfig implements ContextResolver<ObjectMapper>
{ {
private final ObjectMapper objectMapper; private final ObjectMapper objectMapper;
...@@ -39,6 +45,7 @@ public class JacksonConfig implements ContextResolver<ObjectMapper> ...@@ -39,6 +45,7 @@ public class JacksonConfig implements ContextResolver<ObjectMapper>
{ {
objectMapper = new ObjectMapper().configure( objectMapper = new ObjectMapper().configure(
SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
objectMapper.registerModule(new JtsModule());
} }
@Override @Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment