Remove ECOMP in headers
[clamp.git] / src / main / java / org / onap / clamp / clds / client / req / sdc / SdcCatalogServices.java
index 45dbf81..e3bd178 100644 (file)
@@ -18,7 +18,7 @@
  * limitations under the License.\r
  * ============LICENSE_END============================================\r
  * ===================================================================\r
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
+ * \r
  */\r
 \r
 package org.onap.clamp.clds.client.req.sdc;\r
@@ -58,21 +58,23 @@ import org.apache.commons.csv.CSVRecord;
 import org.apache.commons.io.IOUtils;\r
 import org.apache.commons.lang3.StringUtils;\r
 import org.apache.http.HttpHeaders;\r
-import org.onap.clamp.clds.exception.SdcCommunicationException;\r
+import org.onap.clamp.clds.config.ClampProperties;\r
+import org.onap.clamp.clds.exception.sdc.SdcCommunicationException;\r
 import org.onap.clamp.clds.model.CldsAlarmCondition;\r
-import org.onap.clamp.clds.model.CldsSdcArtifact;\r
-import org.onap.clamp.clds.model.CldsSdcResource;\r
-import org.onap.clamp.clds.model.CldsSdcResourceBasicInfo;\r
-import org.onap.clamp.clds.model.CldsSdcServiceDetail;\r
-import org.onap.clamp.clds.model.CldsSdcServiceInfo;\r
 import org.onap.clamp.clds.model.CldsServiceData;\r
 import org.onap.clamp.clds.model.CldsVfData;\r
 import org.onap.clamp.clds.model.CldsVfKPIData;\r
 import org.onap.clamp.clds.model.CldsVfcData;\r
-import org.onap.clamp.clds.model.prop.Global;\r
-import org.onap.clamp.clds.model.prop.ModelProperties;\r
-import org.onap.clamp.clds.model.refprop.RefProp;\r
+import org.onap.clamp.clds.model.properties.Global;\r
+import org.onap.clamp.clds.model.properties.ModelProperties;\r
+import org.onap.clamp.clds.model.sdc.SdcArtifact;\r
+import org.onap.clamp.clds.model.sdc.SdcResource;\r
+import org.onap.clamp.clds.model.sdc.SdcResourceBasicInfo;\r
+import org.onap.clamp.clds.model.sdc.SdcServiceDetail;\r
+import org.onap.clamp.clds.model.sdc.SdcServiceInfo;\r
+import org.onap.clamp.clds.service.CldsService;\r
 import org.onap.clamp.clds.util.CryptoUtils;\r
+import org.onap.clamp.clds.util.JacksonUtils;\r
 import org.onap.clamp.clds.util.LoggingUtils;\r
 import org.springframework.beans.factory.annotation.Autowired;\r
 import org.springframework.stereotype.Component;\r
@@ -93,7 +95,7 @@ public class SdcCatalogServices {
     private static final String SDC_INSTANCE_ID_CLAMP = "CLAMP-Tool";\r
     private static final String RESOURCE_URL_PREFIX = "resources";\r
     @Autowired\r
-    private RefProp refProp;\r
+    private ClampProperties refProp;\r
 \r
     /**\r
      * Return SDC id and pw as a HTTP Basic Auth string (for example: Basic\r
@@ -165,8 +167,8 @@ public class SdcCatalogServices {
      *            A list of CldsSdcServiceInfo\r
      * @return A list of CldsSdcServiceInfo without duplicate service UUID\r
      */\r
-    public List<CldsSdcServiceInfo> removeDuplicateServices(List<CldsSdcServiceInfo> rawCldsSdcServiceList) {\r
-        List<CldsSdcServiceInfo> cldsSdcServiceInfoList = null;\r
+    public List<SdcServiceInfo> removeDuplicateServices(List<SdcServiceInfo> rawCldsSdcServiceList) {\r
+        List<SdcServiceInfo> cldsSdcServiceInfoList = null;\r
         if (rawCldsSdcServiceList != null && !rawCldsSdcServiceList.isEmpty()) {\r
             // sort list\r
             Collections.sort(rawCldsSdcServiceList);\r
@@ -176,7 +178,7 @@ public class SdcCatalogServices {
             for (int i = 1; i < rawCldsSdcServiceList.size(); i++) {\r
                 // compare name with previous - if not equal, then keep the\r
                 // previous (it's the last with that name)\r
-                CldsSdcServiceInfo prev = rawCldsSdcServiceList.get(i - 1);\r
+                SdcServiceInfo prev = rawCldsSdcServiceList.get(i - 1);\r
                 if (!rawCldsSdcServiceList.get(i).getName().equals(prev.getName())) {\r
                     cldsSdcServiceInfoList.add(prev);\r
                 }\r
@@ -193,8 +195,8 @@ public class SdcCatalogServices {
      * @param rawCldsSdcResourceList\r
      * @return List of CldsSdcResource\r
      */\r
-    public List<CldsSdcResource> removeDuplicateSdcResourceInstances(List<CldsSdcResource> rawCldsSdcResourceList) {\r
-        List<CldsSdcResource> cldsSdcResourceList = null;\r
+    public List<SdcResource> removeDuplicateSdcResourceInstances(List<SdcResource> rawCldsSdcResourceList) {\r
+        List<SdcResource> cldsSdcResourceList = null;\r
         if (rawCldsSdcResourceList != null && !rawCldsSdcResourceList.isEmpty()) {\r
             // sort list\r
             Collections.sort(rawCldsSdcResourceList);\r
@@ -204,7 +206,7 @@ public class SdcCatalogServices {
             for (int i = 1; i < rawCldsSdcResourceList.size(); i++) {\r
                 // compare name with previous - if not equal, then keep the\r
                 // previous (it's the last with that name)\r
-                CldsSdcResource prev = rawCldsSdcResourceList.get(i - 1);\r
+                SdcResource prev = rawCldsSdcResourceList.get(i - 1);\r
                 if (!rawCldsSdcResourceList.get(i).getResourceInstanceName().equals(prev.getResourceInstanceName())) {\r
                     cldsSdcResourceList.add(prev);\r
                 }\r
@@ -221,9 +223,9 @@ public class SdcCatalogServices {
      * @param rawCldsSdcResourceListBasicList\r
      * @return List of CldsSdcResourceBasicInfo\r
      */\r
-    public List<CldsSdcResourceBasicInfo> removeDuplicateSdcResourceBasicInfo(\r
-            List<CldsSdcResourceBasicInfo> rawCldsSdcResourceListBasicList) {\r
-        List<CldsSdcResourceBasicInfo> cldsSdcResourceBasicInfoList = null;\r
+    public List<SdcResourceBasicInfo> removeDuplicateSdcResourceBasicInfo(\r
+            List<SdcResourceBasicInfo> rawCldsSdcResourceListBasicList) {\r
+        List<SdcResourceBasicInfo> cldsSdcResourceBasicInfoList = null;\r
         if (rawCldsSdcResourceListBasicList != null && !rawCldsSdcResourceListBasicList.isEmpty()) {\r
             // sort list\r
             Collections.sort(rawCldsSdcResourceListBasicList);\r
@@ -233,7 +235,7 @@ public class SdcCatalogServices {
             for (int i = 1; i < rawCldsSdcResourceListBasicList.size(); i++) {\r
                 // compare name with previous - if not equal, then keep the\r
                 // previous (it's the last with that name)\r
-                CldsSdcResourceBasicInfo prev = rawCldsSdcResourceListBasicList.get(i - 1);\r
+                SdcResourceBasicInfo prev = rawCldsSdcResourceListBasicList.get(i - 1);\r
                 if (!rawCldsSdcResourceListBasicList.get(i).getName().equals(prev.getName())) {\r
                     cldsSdcResourceBasicInfoList.add(prev);\r
                 }\r
@@ -260,10 +262,10 @@ public class SdcCatalogServices {
             throws GeneralSecurityException, DecoderException {\r
         String serviceUuid = "";\r
         String responseStr = getSdcServicesInformation(null);\r
-        List<CldsSdcServiceInfo> rawCldsSdcServicesList = getCldsSdcServicesListFromJson(responseStr);\r
-        List<CldsSdcServiceInfo> cldsSdcServicesList = removeDuplicateServices(rawCldsSdcServicesList);\r
+        List<SdcServiceInfo> rawCldsSdcServicesList = getCldsSdcServicesListFromJson(responseStr);\r
+        List<SdcServiceInfo> cldsSdcServicesList = removeDuplicateServices(rawCldsSdcServicesList);\r
         if (cldsSdcServicesList != null && !cldsSdcServicesList.isEmpty()) {\r
-            for (CldsSdcServiceInfo currCldsSdcServiceInfo : cldsSdcServicesList) {\r
+            for (SdcServiceInfo currCldsSdcServiceInfo : cldsSdcServicesList) {\r
                 if (currCldsSdcServiceInfo != null && currCldsSdcServiceInfo.getInvariantUUID() != null\r
                         && currCldsSdcServiceInfo.getInvariantUUID().equalsIgnoreCase(invariantId)) {\r
                     serviceUuid = currCldsSdcServiceInfo.getUuid();\r
@@ -282,14 +284,13 @@ public class SdcCatalogServices {
      * @return The list of CldsSdcServiceInfo, if there is a failure it return\r
      *         an empty list\r
      */\r
-    private List<CldsSdcServiceInfo> getCldsSdcServicesListFromJson(String jsonStr) {\r
-        ObjectMapper objectMapper = new ObjectMapper();\r
+    private List<SdcServiceInfo> getCldsSdcServicesListFromJson(String jsonStr) {\r
         if (StringUtils.isBlank(jsonStr)) {\r
             return new ArrayList<>();\r
         }\r
         try {\r
-            return objectMapper.readValue(jsonStr,\r
-                    objectMapper.getTypeFactory().constructCollectionType(List.class, CldsSdcServiceInfo.class));\r
+            return JacksonUtils.getObjectMapperInstance().readValue(jsonStr, JacksonUtils.getObjectMapperInstance()\r
+                    .getTypeFactory().constructCollectionType(List.class, SdcServiceInfo.class));\r
         } catch (IOException e) {\r
             logger.error("Error when attempting to decode the JSON containing CldsSdcServiceInfo", e);\r
             return new ArrayList<>();\r
@@ -304,14 +305,13 @@ public class SdcCatalogServices {
      * @return The list of CldsSdcResourceBasicInfo, an empty list in case of\r
      *         issues\r
      */\r
-    private List<CldsSdcResourceBasicInfo> getAllSdcResourcesListFromJson(String jsonStr) {\r
-        ObjectMapper objectMapper = new ObjectMapper();\r
+    private List<SdcResourceBasicInfo> getAllSdcResourcesListFromJson(String jsonStr) {\r
         if (StringUtils.isBlank(jsonStr)) {\r
             return new ArrayList<>();\r
         }\r
         try {\r
-            return objectMapper.readValue(jsonStr,\r
-                    objectMapper.getTypeFactory().constructCollectionType(List.class, CldsSdcResourceBasicInfo.class));\r
+            return JacksonUtils.getObjectMapperInstance().readValue(jsonStr, JacksonUtils.getObjectMapperInstance()\r
+                    .getTypeFactory().constructCollectionType(List.class, SdcResourceBasicInfo.class));\r
         } catch (IOException e) {\r
             logger.error("Exception occurred when attempting to decode the list of CldsSdcResourceBasicInfo JSON", e);\r
             return new ArrayList<>();\r
@@ -324,10 +324,9 @@ public class SdcCatalogServices {
      * @param jsonStr\r
      * @return\r
      */\r
-    public CldsSdcServiceDetail getCldsSdcServiceDetailFromJson(String jsonStr) {\r
-        ObjectMapper objectMapper = new ObjectMapper();\r
+    public SdcServiceDetail decodeCldsSdcServiceDetailFromJson(String jsonStr) {\r
         try {\r
-            return objectMapper.readValue(jsonStr, CldsSdcServiceDetail.class);\r
+            return JacksonUtils.getObjectMapperInstance().readValue(jsonStr, SdcServiceDetail.class);\r
         } catch (IOException e) {\r
             logger.error("Exception when attempting to decode the CldsSdcServiceDetail JSON", e);\r
             return null;\r
@@ -469,12 +468,12 @@ public class SdcCatalogServices {
         String serviceUuid = getServiceUuidFromServiceInvariantId(invariantServiceUuid);\r
         String serviceDetailUrl = url + "/" + serviceUuid + SDC_METADATA_URL_PREFIX;\r
         String responseStr = getCldsServicesOrResourcesBasedOnURL(serviceDetailUrl);\r
-        ObjectMapper objectMapper = new ObjectMapper();\r
         CldsServiceData cldsServiceData = new CldsServiceData();\r
         if (responseStr != null) {\r
-            CldsSdcServiceDetail cldsSdcServiceDetail;\r
+            SdcServiceDetail cldsSdcServiceDetail;\r
             try {\r
-                cldsSdcServiceDetail = objectMapper.readValue(responseStr, CldsSdcServiceDetail.class);\r
+                cldsSdcServiceDetail = JacksonUtils.getObjectMapperInstance().readValue(responseStr,\r
+                        SdcServiceDetail.class);\r
             } catch (IOException e) {\r
                 logger.error("Exception when decoding the CldsServiceData JSON from SDC", e);\r
                 throw new SdcCommunicationException("Exception when decoding the CldsServiceData JSON from SDC", e);\r
@@ -484,11 +483,11 @@ public class SdcCatalogServices {
             if (cldsSdcServiceDetail != null && cldsSdcServiceDetail.getResources() != null) {\r
                 cldsServiceData.setServiceUUID(cldsSdcServiceDetail.getUuid());\r
                 cldsServiceData.setServiceInvariantUUID(cldsSdcServiceDetail.getInvariantUUID());\r
-                List<CldsSdcResource> cldsSdcResourceList = removeDuplicateSdcResourceInstances(\r
+                List<SdcResource> cldsSdcResourceList = removeDuplicateSdcResourceInstances(\r
                         cldsSdcServiceDetail.getResources());\r
                 if (cldsSdcResourceList != null && !cldsSdcResourceList.isEmpty()) {\r
                     List<CldsVfData> cldsVfDataList = new ArrayList<>();\r
-                    for (CldsSdcResource currCldsSdcResource : cldsSdcResourceList) {\r
+                    for (SdcResource currCldsSdcResource : cldsSdcResourceList) {\r
                         if (currCldsSdcResource != null && currCldsSdcResource.getResoucreType() != null\r
                                 && "VF".equalsIgnoreCase(currCldsSdcResource.getResoucreType())) {\r
                             CldsVfData currCldsVfData = new CldsVfData();\r
@@ -511,9 +510,8 @@ public class SdcCatalogServices {
             throws GeneralSecurityException {\r
         // todo : refact this..\r
         if (cldsVfDataList != null && !cldsVfDataList.isEmpty()) {\r
-            List<CldsSdcResourceBasicInfo> allVfResources = getAllSdcVForVfcResourcesBasedOnResourceType(\r
-                    RESOURCE_VF_TYPE);\r
-            List<CldsSdcResourceBasicInfo> allVfcResources = getAllSdcVForVfcResourcesBasedOnResourceType(\r
+            List<SdcResourceBasicInfo> allVfResources = getAllSdcVForVfcResourcesBasedOnResourceType(RESOURCE_VF_TYPE);\r
+            List<SdcResourceBasicInfo> allVfcResources = getAllSdcVForVfcResourcesBasedOnResourceType(\r
                     RESOURCE_VFC_TYPE);\r
             allVfcResources.addAll(getAllSdcVForVfcResourcesBasedOnResourceType(RESOURCE_CVFC_TYPE));\r
             for (CldsVfData currCldsVfData : cldsVfDataList) {\r
@@ -568,11 +566,10 @@ public class SdcCatalogServices {
         }\r
     }\r
 \r
-    private List<CldsVfcData> getVfcDataListFromVfResponse(String vfResponse) throws GeneralSecurityException {\r
-        ObjectMapper mapper = new ObjectMapper();\r
+    private List<CldsVfcData> getVfcDataListFromVfResponse(String vfResponse) {\r
         ObjectNode vfResponseNode;\r
         try {\r
-            vfResponseNode = (ObjectNode) mapper.readTree(vfResponse);\r
+            vfResponseNode = (ObjectNode) JacksonUtils.getObjectMapperInstance().readTree(vfResponse);\r
         } catch (IOException e) {\r
             logger.error("Exception when decoding the JSON list of CldsVfcData", e);\r
             return new ArrayList<>();\r
@@ -614,8 +611,7 @@ public class SdcCatalogServices {
             String vfcResourceUUIDUrl = catalogUrl + RESOURCE_URL_PREFIX + "/" + resourceUUID + SDC_METADATA_URL_PREFIX;\r
             try {\r
                 String vfcResponse = getCldsServicesOrResourcesBasedOnURL(vfcResourceUUIDUrl);\r
-                ObjectMapper mapper = new ObjectMapper();\r
-                ObjectNode vfResponseNode = (ObjectNode) mapper.readTree(vfcResponse);\r
+                ObjectNode vfResponseNode = (ObjectNode) JacksonUtils.getObjectMapperInstance().readTree(vfcResponse);\r
                 ArrayNode vfcArrayNode = (ArrayNode) vfResponseNode.get("resources");\r
                 if (vfcArrayNode != null) {\r
                     for (JsonNode vfcjsonNode : vfcArrayNode) {\r
@@ -639,10 +635,9 @@ public class SdcCatalogServices {
 \r
     private List<CldsAlarmCondition> getAlarmCondtionsFromVfc(String vfcResponse) throws GeneralSecurityException {\r
         List<CldsAlarmCondition> cldsAlarmConditionList = new ArrayList<>();\r
-        ObjectMapper mapper = new ObjectMapper();\r
         ObjectNode vfcResponseNode;\r
         try {\r
-            vfcResponseNode = (ObjectNode) mapper.readTree(vfcResponse);\r
+            vfcResponseNode = (ObjectNode) JacksonUtils.getObjectMapperInstance().readTree(vfcResponse);\r
         } catch (IOException e) {\r
             logger.error("Exception when decoding the JSON list of CldsAlarmCondition", e);\r
             return cldsAlarmConditionList;\r
@@ -684,10 +679,9 @@ public class SdcCatalogServices {
     // Method to get the artifact for any particular VF\r
     private List<CldsVfKPIData> getFieldPathFromVF(String vfResponse) throws GeneralSecurityException {\r
         List<CldsVfKPIData> cldsVfKPIDataList = new ArrayList<>();\r
-        ObjectMapper mapper = new ObjectMapper();\r
         ObjectNode vfResponseNode;\r
         try {\r
-            vfResponseNode = (ObjectNode) mapper.readTree(vfResponse);\r
+            vfResponseNode = (ObjectNode) JacksonUtils.getObjectMapperInstance().readTree(vfResponse);\r
         } catch (IOException e) {\r
             logger.error("Exception when decoding the JSON list of CldsVfKPIData", e);\r
             return cldsVfKPIDataList;\r
@@ -841,27 +835,28 @@ public class SdcCatalogServices {
      * @param globalProps\r
      * @param cldsServiceData\r
      * @return\r
+     * @throws IOException\r
+     *             In case of issues during the parsing of the Global Properties\r
      */\r
-    public String createPropertiesObjectByUUID(String globalProps, CldsServiceData cldsServiceData) {\r
+    public String createPropertiesObjectByUUID(CldsServiceData cldsServiceData) throws IOException {\r
         String totalPropsStr;\r
-        ObjectMapper mapper = new ObjectMapper();\r
-        ObjectNode globalPropsJson;\r
+        ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();\r
+        ObjectNode globalPropsJson = (ObjectNode) refProp.getJsonTemplate(CldsService.GLOBAL_PROPERTIES_KEY);\r
         if (cldsServiceData != null && cldsServiceData.getServiceUUID() != null) {\r
             // Objectnode to save all byservice, byvf , byvfc and byalarm nodes\r
             ObjectNode byIdObjectNode = mapper.createObjectNode();\r
             // To create vf ResourceUUID node with serviceInvariantUUID\r
-            ObjectNode invariantUuidObjectNodeWithVf = createVfObjectNodeByServiceInvariantUuid(mapper,\r
-                    cldsServiceData);\r
+            ObjectNode invariantUuidObjectNodeWithVf = createVfObjectNodeByServiceInvariantUuid(cldsServiceData);\r
             byIdObjectNode.putPOJO("byService", invariantUuidObjectNodeWithVf);\r
             // To create byVf and vfcResourceNode with vfResourceUUID\r
-            ObjectNode vfcObjectNodeByVfUuid = createVfcObjectNodeByVfUuid(mapper, cldsServiceData.getCldsVfs());\r
+            ObjectNode vfcObjectNodeByVfUuid = createVfcObjectNodeByVfUuid(cldsServiceData.getCldsVfs());\r
             byIdObjectNode.putPOJO("byVf", vfcObjectNodeByVfUuid);\r
             // To create byKpi\r
             ObjectNode kpiObjectNode = mapper.createObjectNode();\r
             if (cldsServiceData.getCldsVfs() != null && !cldsServiceData.getCldsVfs().isEmpty()) {\r
                 for (CldsVfData currCldsVfData : cldsServiceData.getCldsVfs()) {\r
                     if (currCldsVfData != null) {\r
-                        createKpiObjectNodeByVfUuid(mapper, kpiObjectNode, currCldsVfData.getCldsKPIList());\r
+                        createKpiObjectNodeByVfUuid(kpiObjectNode, currCldsVfData.getCldsKPIList());\r
                     }\r
                 }\r
             }\r
@@ -871,8 +866,7 @@ public class SdcCatalogServices {
             if (cldsServiceData.getCldsVfs() != null && !cldsServiceData.getCldsVfs().isEmpty()) {\r
                 for (CldsVfData currCldsVfData : cldsServiceData.getCldsVfs()) {\r
                     if (currCldsVfData != null) {\r
-                        createAlarmCondObjectNodeByVfcUuid(mapper, vfcResourceUuidObjectNode,\r
-                                currCldsVfData.getCldsVfcs());\r
+                        createAlarmCondObjectNodeByVfcUuid(vfcResourceUuidObjectNode, currCldsVfData.getCldsVfcs());\r
                     }\r
                 }\r
             }\r
@@ -880,35 +874,20 @@ public class SdcCatalogServices {
             // To create byAlarmCondition with alarmConditionKey\r
             List<CldsAlarmCondition> allAlarmConditions = getAllAlarmConditionsFromCldsServiceData(cldsServiceData,\r
                     "alarmCondition");\r
-            ObjectNode alarmCondObjectNodeByAlarmKey = createAlarmCondObjectNodeByAlarmKey(mapper, allAlarmConditions);\r
+            ObjectNode alarmCondObjectNodeByAlarmKey = createAlarmCondObjectNodeByAlarmKey(allAlarmConditions);\r
             byIdObjectNode.putPOJO("byAlarmCondition", alarmCondObjectNodeByAlarmKey);\r
             // To create byAlertDescription with AlertDescription\r
             List<CldsAlarmCondition> allAlertDescriptions = getAllAlarmConditionsFromCldsServiceData(cldsServiceData,\r
                     "alertDescription");\r
-            ObjectNode alertDescObjectNodeByAlert = createAlarmCondObjectNodeByAlarmKey(mapper, allAlertDescriptions);\r
+            ObjectNode alertDescObjectNodeByAlert = createAlarmCondObjectNodeByAlarmKey(allAlertDescriptions);\r
             byIdObjectNode.putPOJO("byAlertDescription", alertDescObjectNodeByAlert);\r
-            globalPropsJson = decodeGlobalProp(globalProps, mapper);\r
             globalPropsJson.putPOJO("shared", byIdObjectNode);\r
             logger.info("Global properties JSON created with SDC info:" + globalPropsJson);\r
-        } else {\r
-            /**\r
-             * to create json with total properties when no serviceUUID passed\r
-             */\r
-            globalPropsJson = decodeGlobalProp(globalProps, mapper);\r
         }\r
         totalPropsStr = globalPropsJson.toString();\r
         return totalPropsStr;\r
     }\r
 \r
-    private ObjectNode decodeGlobalProp(String globalProps, ObjectMapper mapper) {\r
-        try {\r
-            return (ObjectNode) mapper.readValue(globalProps, JsonNode.class);\r
-        } catch (IOException e) {\r
-            logger.error("Exception occurred during decoding of the global props, returning an empty objectNode", e);\r
-            return mapper.createObjectNode();\r
-        }\r
-    }\r
-\r
     /**\r
      * Method to get alarm conditions/alert description from Service Data.\r
      * \r
@@ -976,8 +955,8 @@ public class SdcCatalogServices {
         return alarmCondList;\r
     }\r
 \r
-    private ObjectNode createAlarmCondObjectNodeByAlarmKey(ObjectMapper mapper,\r
-            List<CldsAlarmCondition> cldsAlarmCondList) {\r
+    private ObjectNode createAlarmCondObjectNodeByAlarmKey(List<CldsAlarmCondition> cldsAlarmCondList) {\r
+        ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();\r
         ObjectNode alarmCondKeyNode = mapper.createObjectNode();\r
         if (cldsAlarmCondList != null && !cldsAlarmCondList.isEmpty()) {\r
             for (CldsAlarmCondition currCldsAlarmCondition : cldsAlarmCondList) {\r
@@ -997,7 +976,8 @@ public class SdcCatalogServices {
         return alarmCondKeyNode;\r
     }\r
 \r
-    private ObjectNode createVfObjectNodeByServiceInvariantUuid(ObjectMapper mapper, CldsServiceData cldsServiceData) {\r
+    private ObjectNode createVfObjectNodeByServiceInvariantUuid(CldsServiceData cldsServiceData) {\r
+        ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();\r
         ObjectNode invariantUuidObjectNode = mapper.createObjectNode();\r
         ObjectNode vfObjectNode = mapper.createObjectNode();\r
         ObjectNode vfUuidNode = mapper.createObjectNode();\r
@@ -1016,8 +996,9 @@ public class SdcCatalogServices {
         return invariantUuidObjectNode;\r
     }\r
 \r
-    private void createKpiObjectNodeByVfUuid(ObjectMapper mapper, ObjectNode vfResourceUuidObjectNode,\r
+    private void createKpiObjectNodeByVfUuid(ObjectNode vfResourceUuidObjectNode,\r
             List<CldsVfKPIData> cldsVfKpiDataList) {\r
+        ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();\r
         if (cldsVfKpiDataList != null && !cldsVfKpiDataList.isEmpty()) {\r
             for (CldsVfKPIData currCldsVfKpiData : cldsVfKpiDataList) {\r
                 if (currCldsVfKpiData != null) {\r
@@ -1035,8 +1016,9 @@ public class SdcCatalogServices {
         }\r
     }\r
 \r
-    private void createAlarmCondObjectNodeByVfcUuid(ObjectMapper mapper, ObjectNode vfcResourceUuidObjectNode,\r
+    private void createAlarmCondObjectNodeByVfcUuid(ObjectNode vfcResourceUuidObjectNode,\r
             List<CldsVfcData> cldsVfcDataList) {\r
+        ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();\r
         ObjectNode vfcObjectNode = mapper.createObjectNode();\r
         ObjectNode alarmCondNode = mapper.createObjectNode();\r
         ObjectNode alertDescNode = mapper.createObjectNode();\r
@@ -1076,7 +1058,8 @@ public class SdcCatalogServices {
      * @param cldsVfDataList\r
      * @return\r
      */\r
-    private ObjectNode createVfcObjectNodeByVfUuid(ObjectMapper mapper, List<CldsVfData> cldsVfDataList) {\r
+    private ObjectNode createVfcObjectNodeByVfUuid(List<CldsVfData> cldsVfDataList) {\r
+        ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();\r
         ObjectNode vfUuidObjectNode = mapper.createObjectNode();\r
         if (cldsVfDataList != null && !cldsVfDataList.isEmpty()) {\r
             for (CldsVfData currCldsVfData : cldsVfDataList) {\r
@@ -1128,18 +1111,18 @@ public class SdcCatalogServices {
      *            The artifact name that will be searched\r
      * @return The artifact UUID found\r
      */\r
-    public String getArtifactIdIfArtifactAlreadyExists(CldsSdcServiceDetail cldsSdcServiceDetail, String artifactName) {\r
+    public String getArtifactIdIfArtifactAlreadyExists(SdcServiceDetail cldsSdcServiceDetail, String artifactName) {\r
         String artifactUuid = null;\r
         boolean artifactExists = false;\r
         if (cldsSdcServiceDetail != null && cldsSdcServiceDetail.getResources() != null\r
                 && !cldsSdcServiceDetail.getResources().isEmpty()) {\r
-            for (CldsSdcResource currCldsSdcResource : cldsSdcServiceDetail.getResources()) {\r
+            for (SdcResource currCldsSdcResource : cldsSdcServiceDetail.getResources()) {\r
                 if (artifactExists) {\r
                     break;\r
                 }\r
                 if (currCldsSdcResource != null && currCldsSdcResource.getArtifacts() != null\r
                         && !currCldsSdcResource.getArtifacts().isEmpty()) {\r
-                    for (CldsSdcArtifact currCldsSdcArtifact : currCldsSdcResource.getArtifacts()) {\r
+                    for (SdcArtifact currCldsSdcArtifact : currCldsSdcResource.getArtifacts()) {\r
                         if (currCldsSdcArtifact != null && currCldsSdcArtifact.getArtifactName() != null\r
                                 && currCldsSdcArtifact.getArtifactName().equalsIgnoreCase(artifactName)) {\r
                             artifactUuid = currCldsSdcArtifact.getArtifactUUID();\r
@@ -1154,7 +1137,7 @@ public class SdcCatalogServices {
     }\r
 \r
     // To get all sdc VF/VFC Resources basic info.\r
-    private List<CldsSdcResourceBasicInfo> getAllSdcVForVfcResourcesBasedOnResourceType(String resourceType) {\r
+    private List<SdcResourceBasicInfo> getAllSdcVForVfcResourcesBasedOnResourceType(String resourceType) {\r
         String catalogUrl = refProp.getStringValue(SDC_CATALOG_URL_PROPERTY_NAME);\r
         String resourceUrl = catalogUrl + "resources?resourceType=" + resourceType;\r
         String allSdcVfcResources = getCldsServicesOrResourcesBasedOnURL(resourceUrl);\r
@@ -1162,10 +1145,10 @@ public class SdcCatalogServices {
     }\r
 \r
     private String getResourceUuidFromResourceInvariantUuid(String resourceInvariantUuid,\r
-            List<CldsSdcResourceBasicInfo> resourceInfoList) {\r
+            List<SdcResourceBasicInfo> resourceInfoList) {\r
         String resourceUuid = null;\r
         if (resourceInfoList != null && !resourceInfoList.isEmpty()) {\r
-            for (CldsSdcResourceBasicInfo currResource : resourceInfoList) {\r
+            for (SdcResourceBasicInfo currResource : resourceInfoList) {\r
                 if (currResource != null && currResource.getInvariantUUID() != null && currResource.getUuid() != null\r
                         && currResource.getInvariantUUID().equalsIgnoreCase(resourceInvariantUuid)) {\r
                     resourceUuid = currResource.getUuid();\r
@@ -1220,7 +1203,7 @@ public class SdcCatalogServices {
                     String originalServiceUuid = getServiceUuidFromServiceInvariantId(serviceInvariantUuid);\r
                     logger.info("ServiceUUID used before upload in url:" + originalServiceUuid);\r
                     String sdcServicesInformation = getSdcServicesInformation(originalServiceUuid);\r
-                    CldsSdcServiceDetail cldsSdcServiceDetail = getCldsSdcServiceDetailFromJson(sdcServicesInformation);\r
+                    SdcServiceDetail cldsSdcServiceDetail = decodeCldsSdcServiceDetailFromJson(sdcServicesInformation);\r
                     String uploadedArtifactUuid = getArtifactIdIfArtifactAlreadyExists(cldsSdcServiceDetail,\r
                             artifactName);\r
                     // Upload artifacts to sdc\r
@@ -1233,7 +1216,7 @@ public class SdcCatalogServices {
                     }\r
                     logger.info("ServiceUUID used after upload in ulr:" + updatedServiceUuid);\r
                     sdcServicesInformation = getSdcServicesInformation(updatedServiceUuid);\r
-                    cldsSdcServiceDetail = getCldsSdcServiceDetailFromJson(sdcServicesInformation);\r
+                    cldsSdcServiceDetail = decodeCldsSdcServiceDetailFromJson(sdcServicesInformation);\r
                     uploadedArtifactUuid = getArtifactIdIfArtifactAlreadyExists(cldsSdcServiceDetail,\r
                             locationArtifactName);\r
                     // To send location information also to sdc\r