From fd3b17eef9ee8dbb7d29fb5f3aed2e5536eaa8ab Mon Sep 17 00:00:00 2001
From: Tor-Einar Skog <tor-einar.skog@nibio.no>
Date: Tue, 19 Mar 2019 15:01:49 +0100
Subject: [PATCH] As far as we got for now. MAJOR issues with JSONB replacing
 Jackson still unresolved!

---
 nb-configuration.xml                                       | 1 -
 pom.xml                                                    | 4 ++--
 src/main/java/no/nibio/vips/core/config/JacksonConfig.java | 3 +++
 .../java/no/nibio/vips/core/service/ModelResourceImpl.java | 7 +++++++
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/nb-configuration.xml b/nb-configuration.xml
index 00dea3e..e9e56b5 100755
--- a/nb-configuration.xml
+++ b/nb-configuration.xml
@@ -18,6 +18,5 @@ Any value defined here will override the pom.xml file value but is only applicab
         <netbeans.hint.license>nibio_open_source_license.ftl</netbeans.hint.license>
         <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>
         <org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>1.7-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
-        <netbeans.hint.jdkPlatform>JDK_1.8_SUN</netbeans.hint.jdkPlatform>
     </properties>
 </project-shared-configuration>
diff --git a/pom.xml b/pom.xml
index 844ae2e..b088bda 100755
--- a/pom.xml
+++ b/pom.xml
@@ -53,8 +53,8 @@
         <artifactId>maven-compiler-plugin</artifactId>
         <version>2.0.2</version>
         <configuration>
-          <source>1.8</source>
-          <target>1.8</target>
+          <source>10</source>
+          <target>10</target>
         </configuration>
       </plugin>
       <plugin>
diff --git a/src/main/java/no/nibio/vips/core/config/JacksonConfig.java b/src/main/java/no/nibio/vips/core/config/JacksonConfig.java
index ed2c61c..be1aaab 100755
--- a/src/main/java/no/nibio/vips/core/config/JacksonConfig.java
+++ b/src/main/java/no/nibio/vips/core/config/JacksonConfig.java
@@ -20,6 +20,7 @@
 package no.nibio.vips.core.config;
 
 import com.bedatadriven.jackson.datatype.jts.JtsModule;
+import com.fasterxml.jackson.databind.DeserializationFeature;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.ext.ContextResolver;
@@ -43,6 +44,8 @@ public class JacksonConfig  implements ContextResolver<ObjectMapper>{
         objectMapper = new ObjectMapper();
         objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
         objectMapper.registerModule(new JtsModule());
+        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+        objectMapper.registerModule(new JtsModule());
     }
 
     @Override
diff --git a/src/main/java/no/nibio/vips/core/service/ModelResourceImpl.java b/src/main/java/no/nibio/vips/core/service/ModelResourceImpl.java
index 13e0c99..5fb1fec 100755
--- a/src/main/java/no/nibio/vips/core/service/ModelResourceImpl.java
+++ b/src/main/java/no/nibio/vips/core/service/ModelResourceImpl.java
@@ -24,6 +24,7 @@ import java.net.URLClassLoader;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import javax.servlet.http.HttpServletRequest;
@@ -252,6 +253,7 @@ public class ModelResourceImpl implements ModelResource{
     @Override
     public Response runModel(ModelConfiguration config)
     {
+        System.out.println("runModel 1");
         try
         {
             Model calledModel = ModelFactory.getInstance().getModelInstance(config.getModelId());
@@ -279,6 +281,11 @@ public class ModelResourceImpl implements ModelResource{
     @Override
     public Response runModel(@PathParam("modelId") String modelId, ModelConfiguration config)
     {
+        System.out.println("runModel 2");
+        List observations = (List) config.getConfigParameter("observations");
+        Map obs = (Map) observations.get(0);
+        System.out.println(obs.get("timeMeasured"));
+        System.out.println(obs.get("validitySignature"));
         try
         {
             Model calledModel = ModelFactory.getInstance().getModelInstance(modelId);
-- 
GitLab