Get subscribers rewritten to new rest client
[vid.git] / vid-app-common / src / main / java / org / onap / vid / controllers / WebConfig.java
index fb8b519..56dce9a 100644 (file)
@@ -22,7 +22,7 @@
 package org.onap.vid.controllers;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import io.joshworks.restclient.http.mapper.ObjectMapper;
 import java.io.IOException;
 import org.onap.vid.aai.AaiClient;
 import org.onap.vid.aai.AaiClientInterface;
@@ -70,8 +70,8 @@ public class WebConfig {
      * @return the object mapper
      */
     @Bean
-    public ObjectMapper getObjectMapper() {
-        return new ObjectMapper();
+    public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper() {
+        return new com.fasterxml.jackson.databind.ObjectMapper();
     }
 
 
@@ -166,13 +166,41 @@ public class WebConfig {
         return new SchedulerRestInterface();
     }
 
+    @Bean(name = "aaiClientForFasterXmlMapping")
+    public AaiOverTLSClientInterface getAaiClientForFasterXmlMapping(){
+         ObjectMapper objectMapper = new ObjectMapper() {
 
-    @Bean
-    public AaiOverTLSClientInterface getAaiOverTLSClientInterface() {
+            com.fasterxml.jackson.databind.ObjectMapper om = new com.fasterxml.jackson.databind.ObjectMapper();
 
-        io.joshworks.restclient.http.mapper.ObjectMapper objectMapper = new io.joshworks.restclient.http.mapper.ObjectMapper() {
+            @Override
+            public <T> T readValue(String s, Class<T> aClass) {
+                try {
+                    return om.readValue(s, aClass);
+                } catch (IOException e) {
+                    throw new RuntimeException(e);
+                }
+            }
 
-            ObjectMapper om = new ObjectMapper();
+            @Override
+            public String writeValue(Object o) {
+                try {
+                    return om.writeValueAsString(o);
+                } catch (JsonProcessingException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        };
+
+        return new AaiOverTLSClient(new SyncRestClient(objectMapper), new AaiOverTLSPropertySupplier());
+    }
+
+
+    @Bean(name = "aaiClientForCodehausMapping")
+    public AaiOverTLSClientInterface getAaiClientForCodehausMapping() {
+
+       ObjectMapper objectMapper = new ObjectMapper() {
+
+            org.codehaus.jackson.map.ObjectMapper om = new org.codehaus.jackson.map.ObjectMapper();
 
             @Override
             public <T> T readValue(String s, Class<T> aClass) {
@@ -187,7 +215,7 @@ public class WebConfig {
             public String writeValue(Object o) {
                 try {
                     return om.writeValueAsString(o);
-                } catch (JsonProcessingException e) {
+                } catch (IOException e) {
                     throw new RuntimeException(e);
                 }
             }