Removed MSB Invocation During AAI Calling
[holmes/common.git] / holmes-actions / src / main / java / org / onap / holmes / common / aai / AaiQueryMdons.java
index 892638b..60b53f9 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright 2020 - 2021 Fujitsu Limited.
+ * Copyright 2020 - 2023 Fujitsu Limited, ZTE Corporation
  * <p>
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  * in compliance with the License. You may obtain a copy of the License at
@@ -17,17 +17,17 @@ package org.onap.holmes.common.aai;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
-import org.jvnet.hk2.annotations.Service;
+import jakarta.ws.rs.client.Entity;
+import jakarta.ws.rs.core.MultivaluedHashMap;
+import jakarta.ws.rs.core.MultivaluedMap;
 import org.onap.holmes.common.aai.config.AaiConfig;
 import org.onap.holmes.common.config.MicroServiceConfig;
 import org.onap.holmes.common.exception.CorrelationException;
 import org.onap.holmes.common.utils.JerseyClient;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
 
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.core.MultivaluedHashMap;
-import javax.ws.rs.core.MultivaluedMap;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -66,7 +66,7 @@ public class AaiQueryMdons {
 
     private String getResponse(String url) throws CorrelationException {
         try {
-            return new JerseyClient().headers(getHeaders()).get(url);
+            return JerseyClient.newInstance().headers(getHeaders()).get(url);
         } catch (Exception e) {
             throw new CorrelationException("Failed to get data from aai", e);
         }
@@ -174,7 +174,7 @@ public class AaiQueryMdons {
 
     private void put(String url, String content) throws CorrelationException {
         try {
-            new JerseyClient().headers(getHeaders()).put(url, Entity.json(content));
+            JerseyClient.newInstance().headers(getHeaders()).put(url, Entity.json(content));
         } catch (Exception e) {
             throw new CorrelationException("Failed to put data in AAI", e);
         }