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

As far as we got for now. MAJOR issues with JSONB replacing Jackson still unresolved!

parent 46dcf1e2
No related branches found
No related tags found
2 merge requests!17Develop,!12Ny server 2019
This commit is part of merge request !12. Comments created here will be created in the context of that merge request.
......@@ -25,5 +25,6 @@ Any value defined here will override the pom.xml file value but is only applicab
<org-netbeans-modules-css-prep.less_2e_compiler_2e_options/>
<org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
<netbeans.compile.on.save>none</netbeans.compile.on.save>
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>WildFly</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
</properties>
</project-shared-configuration>
......@@ -75,13 +75,13 @@
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.0.9.Final</version>
<version>3.6.3.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.0.9.Final</version>
<version>3.6.3.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
......@@ -140,19 +140,19 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.7.4</version>
<version>2.9.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.7.4</version>
<version>2.9.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.7.4</version>
<version>2.9.8</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
......@@ -180,20 +180,20 @@
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-csv</artifactId>
<version>2.6.2</version>
<version>2.9.8</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<version>8.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<version>8.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
......
......@@ -56,6 +56,7 @@ public class VIPSLogicApplication extends Application
resources.add(no.nibio.vips.logic.service.ObservationService.class);
resources.add(no.nibio.vips.logic.service.ModelFormService.class);
resources.add(no.nibio.vips.logic.service.JacksonConfig.class);
//resources.add(no.nibio.vips.logic.service.JSONBConfig.class);
//resources.add(no.nibio.vips.coremanager.service.ManagerResourceImpl.class);
}
......@@ -70,6 +71,7 @@ public class VIPSLogicApplication extends Application
resources.add(no.nibio.vips.logic.modules.barleynetblotch.BarleyNetBlotchModelService.class);
resources.add(no.nibio.vips.logic.modules.roughage.RoughageService.class);
resources.add(no.nibio.vips.logic.modules.wheatleafblotch.WheatLeafBlotchModelService.class);
resources.add(no.nibio.vips.logic.service.JSONBConfig.class);
resources.add(no.nibio.vips.logic.service.JacksonConfig.class);
resources.add(no.nibio.vips.logic.service.LogicService.class);
resources.add(no.nibio.vips.logic.service.ModelFormService.class);
......
......@@ -600,6 +600,7 @@ public class ForecastBean {
Response resp = this.getManagerResource().runModel(config.getModelId(), request);
if(resp.getStatus() == Response.Status.OK.getStatusCode())
{
//System.out.println(resp.readEntity(String.class));
List<Result> results = (List<Result>) resp.readEntity(new GenericType<List<Result>>(){});
//System.out.println("ForecastConfigId=" + forecastConfiguration.getForecastConfigurationId() + ", resultsize=" + results.size());
// We delete all former results before we store the new ones
......
......@@ -20,20 +20,16 @@
package no.nibio.vips.logic.messaging;
import java.io.Serializable;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
* @copyright 2016 <a href="http://www.nibio.no/">NIBIO</a>
......
/*
* Copyright (c) 2015 NIBIO <http://www.nibio.no/>.
*
* This file is part of VIPSLogic.
* VIPSLogic is free software: you can redistribute it and/or modify
* it under the terms of the NIBIO Open Source License as published by
* NIBIO, either version 1 of the License, or (at your option) any
* later version.
*
* VIPSLogic is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* NIBIO Open Source License for more details.
*
* You should have received a copy of the NIBIO Open Source License
* along with VIPSLogic. If not, see <http://www.nibio.no/licenses/>.
*
*/
package no.nibio.vips.logic.service;
import javax.json.bind.Jsonb;
import javax.json.bind.JsonbBuilder;
import javax.json.bind.JsonbConfig;
import javax.json.bind.annotation.JsonbDateFormat;
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.Provider;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Add this to no.nibio.vips.logic.VIPSLogicApplication if you want all
* dates to be serialized as ISO formatted date strings
* @copyright 2018 <a href="http://www.nibio.no/">NIBIO</a>
* @author Tor-Einar Skog <tor-einar.skog@nibio.no>
*/
@Provider
@Produces(MediaType.APPLICATION_JSON)
//@Consumes(MediaType.APPLICATION_JSON)
public class JSONBConfig implements ContextResolver<javax.json.bind.Jsonb>
{
//private final ObjectMapper objectMapper;
private final Jsonb jsonB;
private Logger log;
public JSONBConfig() throws Exception
{
log = Logger.getLogger(JacksonConfig.class.getName());
log.log(Level.INFO,"Created JSONBConfig");
//System.out.println("This is what you should expect");
JsonbConfig config = new JsonbConfig();
config.setProperty(JsonbConfig.DATE_FORMAT, JsonbDateFormat.DEFAULT_FORMAT);
jsonB = JsonbBuilder.create(config);
}
@Override
public Jsonb getContext(Class objectType)
{
log.log(Level.INFO,"Retrieved Objectmapper "+objectType.toGenericString());
return jsonB;
}
}
\ No newline at end of file
......@@ -20,8 +20,11 @@
package no.nibio.vips.logic.service;
import com.bedatadriven.jackson.datatype.jts.JtsModule;
import com.fasterxml.jackson.databind.DeserializationConfig;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import java.text.SimpleDateFormat;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
......@@ -45,6 +48,8 @@ public class JacksonConfig implements ContextResolver<ObjectMapper>
{
objectMapper = new ObjectMapper().configure(
SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"));
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.registerModule(new JtsModule());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment