Rework the submit operation
[clamp.git] / src / main / java / org / onap / clamp / clds / client / DcaeInventoryServices.java
index e5ef3c6..d8bfeea 100644 (file)
@@ -45,6 +45,7 @@ import org.onap.clamp.clds.model.properties.Global;
 import org.onap.clamp.clds.model.properties.ModelProperties;\r
 import org.onap.clamp.clds.util.JsonUtils;\r
 import org.onap.clamp.clds.util.LoggingUtils;\r
+import org.onap.clamp.util.HttpConnectionManager;\r
 import org.springframework.beans.factory.annotation.Autowired;\r
 import org.springframework.stereotype.Component;\r
 \r
@@ -62,14 +63,17 @@ public class DcaeInventoryServices {
     public static final String DCAE_INVENTORY_RETRY_LIMIT = "dcae.intentory.retry.limit";\r
     private final ClampProperties refProp;\r
     private final CldsDao cldsDao;\r
-    private final DcaeHttpConnectionManager dcaeHttpConnectionManager;\r
+    private final HttpConnectionManager httpConnectionManager;\r
 \r
+    /**\r
+     * Constructor.\r
+     */\r
     @Autowired\r
     public DcaeInventoryServices(ClampProperties refProp, CldsDao cldsDao,\r
-        DcaeHttpConnectionManager dcaeHttpConnectionManager) {\r
+               HttpConnectionManager httpConnectionManager) {\r
         this.refProp = refProp;\r
         this.cldsDao = cldsDao;\r
-        this.dcaeHttpConnectionManager = dcaeHttpConnectionManager;\r
+        this.httpConnectionManager = httpConnectionManager;\r
     }\r
 \r
     /**\r
@@ -179,7 +183,6 @@ public class DcaeInventoryServices {
      */\r
     public DcaeInventoryResponse getDcaeInformation(String artifactName, String serviceUuid, String resourceUuid)\r
         throws IOException, ParseException, InterruptedException {\r
-        Date startTime = new Date();\r
         LoggingUtils.setTargetContext("DCAE", "getDcaeInformation");\r
         String queryString = "?asdcResourceId=" + resourceUuid + "&asdcServiceId=" + serviceUuid + "&typeName="\r
             + artifactName;\r
@@ -187,6 +190,7 @@ public class DcaeInventoryServices {
         logger.info("Dcae Inventory Service full url - " + fullUrl);\r
         DcaeInventoryResponse response = queryDcaeInventory(fullUrl);\r
         LoggingUtils.setResponseContext("0", "Get Dcae Information success", this.getClass().getName());\r
+        Date startTime = new Date();\r
         LoggingUtils.setTimeContext(startTime, new Date());\r
         return response;\r
     }\r
@@ -203,7 +207,7 @@ public class DcaeInventoryServices {
         }\r
         for (int i = 0; i < retryLimit; i++) {\r
             metricsLogger.info("Attempt n°" + i + " to contact DCAE inventory");\r
-            String response = dcaeHttpConnectionManager.doDcaeHttpQuery(fullUrl, "GET", null, null);\r
+            String response = httpConnectionManager.doGeneralHttpQuery(fullUrl, "GET", null, null, "DCAE", null, null);\r
             int totalCount = getTotalCountFromDcaeInventoryResponse(response);\r
             metricsLogger.info("getDcaeInformation complete: totalCount returned=" + totalCount);\r
             if (totalCount > 0) {\r