Merge "Automatic Config Policy Ui generation"
[clamp.git] / src / main / java / org / onap / clamp / clds / client / req / sdc / SdcCatalogServices.java
index c725be2..37c6257 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================\r
  * ONAP CLAMP\r
  * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights\r
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights\r
  *                             reserved.\r
  * ================================================================================\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * See the License for the specific language governing permissions and\r
  * limitations under the License.\r
  * ============LICENSE_END============================================\r
+ * Modifications copyright (c) 2018 Nokia\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
 \r
 import com.att.eelf.configuration.EELFLogger;\r
 import com.att.eelf.configuration.EELFManager;\r
-import com.fasterxml.jackson.databind.JsonNode;\r
-import com.fasterxml.jackson.databind.ObjectMapper;\r
-import com.fasterxml.jackson.databind.node.ArrayNode;\r
-import com.fasterxml.jackson.databind.node.ObjectNode;\r
-import com.fasterxml.jackson.databind.node.TextNode;\r
 \r
+import com.google.gson.JsonArray;\r
+import com.google.gson.JsonElement;\r
+import com.google.gson.JsonObject;\r
+import com.google.gson.JsonParseException;\r
+import com.google.gson.reflect.TypeToken;\r
 import java.io.BufferedReader;\r
-import java.io.DataOutputStream;\r
 import java.io.IOException;\r
 import java.io.InputStream;\r
 import java.io.InputStreamReader;\r
 import java.io.Reader;\r
 import java.io.StringReader;\r
+import java.lang.reflect.Type;\r
 import java.net.HttpURLConnection;\r
 import java.net.URL;\r
 import java.nio.charset.StandardCharsets;\r
@@ -49,51 +50,57 @@ import java.util.Date;
 import java.util.Iterator;\r
 import java.util.List;\r
 \r
-import javax.ws.rs.BadRequestException;\r
-\r
 import org.apache.commons.codec.DecoderException;\r
-import org.apache.commons.codec.digest.DigestUtils;\r
 import org.apache.commons.csv.CSVFormat;\r
 import org.apache.commons.csv.CSVRecord;\r
 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.CldsDBServiceCache;\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.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.JsonUtils;\r
 import org.onap.clamp.clds.util.LoggingUtils;\r
 import org.springframework.beans.factory.annotation.Autowired;\r
+import org.springframework.context.annotation.Primary;\r
+import org.springframework.stereotype.Component;\r
 \r
+@Component\r
+@Primary\r
 public class SdcCatalogServices {\r
-    protected static final EELFLogger logger                        = EELFManager.getInstance()\r
-            .getLogger(SdcCatalogServices.class);\r
-    protected static final EELFLogger metricsLogger                 = EELFManager.getInstance().getMetricsLogger();\r
-    private static final String       RESOURCE_VF_TYPE              = "VF";\r
-    private static final String       RESOURCE_VFC_TYPE             = "VFC";\r
-    private static final String       RESOURCE_CVFC_TYPE            = "CVFC";\r
-    public static final String        SDC_REQUESTID_PROPERTY_NAME   = "sdc.header.requestId";\r
-    private static final String       SDC_METADATA_URL_PREFIX       = "/metadata";\r
-    private static final String       SDC_INSTANCE_ID_PROPERTY_NAME = "sdc.InstanceID";\r
-    private static final String       SDC_CATALOG_URL_PROPERTY_NAME = "sdc.catalog.url";\r
-    private static final String       SDC_SERVICE_URL_PROPERTY_NAME = "sdc.serviceUrl";\r
-    private static final String       SDC_INSTANCE_ID_CLAMP         = "CLAMP-Tool";\r
-    private static final String       RESOURCE_URL_PREFIX           = "resources";\r
+\r
+    private static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcCatalogServices.class);\r
+    private static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();\r
+    private static final String RESOURCE_VF_TYPE = "VF";\r
+    private static final String RESOURCE_VFC_TYPE = "VFC";\r
+    private static final String RESOURCE_CVFC_TYPE = "CVFC";\r
+    private static final String SDC_REQUESTID_PROPERTY_NAME = "sdc.header.requestId";\r
+    private static final String SDC_METADATA_URL_PREFIX = "/metadata";\r
+    private static final String SDC_INSTANCE_ID_PROPERTY_NAME = "sdc.InstanceID";\r
+    private static final String SDC_CATALOG_URL_PROPERTY_NAME = "sdc.catalog.url";\r
+    private static final String SDC_SERVICE_URL_PROPERTY_NAME = "sdc.serviceUrl";\r
+    private static final String SDC_INSTANCE_ID_CLAMP = "CLAMP-Tool";\r
+    private static final String RESOURCE_URL_PREFIX = "resources";\r
+    private static final LoggingUtils utils = new LoggingUtils(logger);\r
+\r
+    private static final Type LIST_SDC_SERVICE_INFO_TYPE = new TypeToken<List<SdcServiceInfo>>() {\r
+    }.getType();\r
+\r
+    private static final Type LIST_SDC_RESOURCE_BASIC_INFO_TYPE = new TypeToken<List<SdcResourceBasicInfo>>() {\r
+    }.getType();\r
+\r
     @Autowired\r
-    private RefProp                   refProp;\r
-    protected CryptoUtils             cryptoUtils                   = new CryptoUtils();\r
+    private ClampProperties refProp;\r
 \r
     /**\r
      * Return SDC id and pw as a HTTP Basic Auth string (for example: Basic\r
@@ -101,51 +108,50 @@ public class SdcCatalogServices {
      *\r
      * @return The String with Basic Auth and password\r
      * @throws GeneralSecurityException\r
-     *             In case of issue when decryting the SDC password\r
+     *         In case of issue when decryting the SDC password\r
      * @throws DecoderException\r
-     *             In case of issues with the decoding of the HexString message\r
+     *         In case of issues with the decoding of the HexString message\r
      */\r
-    private String getSdcBasicAuth() throws GeneralSecurityException, DecoderException {\r
+    public String getSdcBasicAuth() throws GeneralSecurityException, DecoderException {\r
         String sdcId = refProp.getStringValue("sdc.serviceUsername");\r
         String sdcPw = refProp.getStringValue("sdc.servicePassword");\r
-        String password = cryptoUtils.decrypt(sdcPw);\r
+        String password = CryptoUtils.decrypt(sdcPw);\r
         String idPw = Base64.getEncoder().encodeToString((sdcId + ":" + password).getBytes(StandardCharsets.UTF_8));\r
         return "Basic " + idPw;\r
     }\r
 \r
     /**\r
-     * This method get the SDC services Information with the corresponding\r
-     * Service UUID.\r
-     * \r
+     * This method get the SDC services Information with the corresponding Service\r
+     * UUID.\r
+     *\r
      * @param uuid\r
-     *            The service UUID\r
+     *        The service UUID\r
      * @return A Json String with all the service list\r
      * @throws GeneralSecurityException\r
-     *             In case of issue when decryting the SDC password\r
+     *         In case of issue when decryting the SDC password\r
      * @throws DecoderException\r
-     *             In case of issues with the decoding of the Hex String\r
+     *         In case of issues with the decoding of the Hex String\r
      */\r
     public String getSdcServicesInformation(String uuid) throws GeneralSecurityException, DecoderException {\r
         Date startTime = new Date();\r
         String baseUrl = refProp.getStringValue(SDC_SERVICE_URL_PROPERTY_NAME);\r
         String basicAuth = getSdcBasicAuth();\r
-        LoggingUtils.setTargetContext("SDC", "getSdcServicesInformation");\r
         try {\r
             String url = baseUrl;\r
-            if (uuid != null) {\r
+            if (uuid != null && !uuid.isEmpty()) {\r
                 url = baseUrl + "/" + uuid + SDC_METADATA_URL_PREFIX;\r
             }\r
             URL urlObj = new URL(url);\r
             HttpURLConnection conn = (HttpURLConnection) urlObj.openConnection();\r
+            conn = utils.invoke(conn, "SDC", "getSdcServicesInformation");\r
             conn.setRequestProperty(refProp.getStringValue(SDC_INSTANCE_ID_PROPERTY_NAME), SDC_INSTANCE_ID_CLAMP);\r
             conn.setRequestProperty(HttpHeaders.AUTHORIZATION, basicAuth);\r
             conn.setRequestProperty(HttpHeaders.CONTENT_TYPE, "application/json;charset=UTF-8");\r
             conn.setRequestProperty(refProp.getStringValue(SDC_REQUESTID_PROPERTY_NAME), LoggingUtils.getRequestId());\r
             conn.setRequestMethod("GET");\r
             String resp = getResponse(conn);\r
-            logger.info(resp);\r
-            // metrics log\r
-            LoggingUtils.setResponseContext("0", "Get sdc services success", this.getClass().getName());\r
+            logger.debug("Services list received from SDC:" + resp);\r
+            utils.invokeReturn();\r
             return resp;\r
         } catch (IOException e) {\r
             LoggingUtils.setResponseContext("900", "Get sdc services failed", this.getClass().getName());\r
@@ -155,18 +161,19 @@ public class SdcCatalogServices {
             LoggingUtils.setTimeContext(startTime, new Date());\r
             metricsLogger.info("getSdcServicesInformation complete");\r
         }\r
+        utils.invokeReturn();\r
         return "";\r
     }\r
 \r
     /**\r
      * To remove duplicate serviceUUIDs from sdc services List.\r
-     * \r
+     *\r
      * @param rawCldsSdcServiceList\r
-     *            A list of CldsSdcServiceInfo\r
+     *        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 +183,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
@@ -189,12 +196,12 @@ public class SdcCatalogServices {
 \r
     /**\r
      * To remove duplicate serviceUUIDs from sdc resources List.\r
-     * \r
+     *\r
      * @param rawCldsSdcResourceList\r
-     * @return\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 +211,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
@@ -217,55 +224,54 @@ public class SdcCatalogServices {
 \r
     /**\r
      * To remove duplicate basic resources with same resourceUUIDs.\r
-     * \r
+     *\r
      * @param rawCldsSdcResourceListBasicList\r
-     * @return\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 = new ArrayList<>();\r
         if (rawCldsSdcResourceListBasicList != null && !rawCldsSdcResourceListBasicList.isEmpty()) {\r
             // sort list\r
             Collections.sort(rawCldsSdcResourceListBasicList);\r
             // and then take only the resources with the max version (last in\r
             // the list with the same name)\r
-            cldsSdcResourceBasicInfoList = new ArrayList<>();\r
             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
             }\r
             // add the last in the list\r
             cldsSdcResourceBasicInfoList\r
-                    .add(rawCldsSdcResourceListBasicList.get(rawCldsSdcResourceListBasicList.size() - 1));\r
+                .add(rawCldsSdcResourceListBasicList.get(rawCldsSdcResourceListBasicList.size() - 1));\r
         }\r
         return cldsSdcResourceBasicInfoList;\r
     }\r
 \r
     /**\r
      * To get ServiceUUID by using serviceInvariantUUID.\r
-     * \r
+     *\r
      * @param invariantId\r
-     *            The invariant ID\r
+     *        The invariant ID\r
      * @return The service UUID\r
      * @throws GeneralSecurityException\r
-     *             In case of issue when decryting the SDC password\r
+     *         In case of issue when decryting the SDC password\r
      * @throws DecoderException\r
-     *             In case of issues with the decoding of the Hex String\r
+     *         In case of issues with the decoding of the Hex String\r
      */\r
     public String getServiceUuidFromServiceInvariantId(String invariantId)\r
-            throws GeneralSecurityException, DecoderException {\r
+        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
+                    && currCldsSdcServiceInfo.getInvariantUUID().equalsIgnoreCase(invariantId)) {\r
                     serviceUuid = currCldsSdcServiceInfo.getUuid();\r
                     break;\r
                 }\r
@@ -276,21 +282,19 @@ public class SdcCatalogServices {
 \r
     /**\r
      * To get CldsAsdsServiceInfo class by parsing json string.\r
-     * \r
+     *\r
      * @param jsonStr\r
-     *            The Json string that must be decoded\r
-     * @return The list of CldsSdcServiceInfo, if there is a failure it return\r
-     *         an empty list\r
+     *        The Json string that must be decoded\r
+     * @return The list of CldsSdcServiceInfo, if there is a failure it return an\r
+     *         empty list\r
      */\r
-    public 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
-        } catch (IOException e) {\r
+            return JsonUtils.GSON.fromJson(jsonStr, LIST_SDC_SERVICE_INFO_TYPE);\r
+        } catch (JsonParseException e) {\r
             logger.error("Error when attempting to decode the JSON containing CldsSdcServiceInfo", e);\r
             return new ArrayList<>();\r
         }\r
@@ -300,128 +304,37 @@ public class SdcCatalogServices {
      * To get List of CldsSdcResourceBasicInfo class by parsing json string.\r
      *\r
      * @param jsonStr\r
-     *            The JSOn string that must be decoded\r
-     * @return The list of CldsSdcResourceBasicInfo, an empty list in case of\r
-     *         issues\r
+     *        The JSOn string that must be decoded\r
+     * @return The list of CldsSdcResourceBasicInfo, an empty list in case of issues\r
      */\r
-    public 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
-        } catch (IOException e) {\r
+            return JsonUtils.GSON.fromJson(jsonStr, LIST_SDC_RESOURCE_BASIC_INFO_TYPE);\r
+        } catch (JsonParseException e) {\r
             logger.error("Exception occurred when attempting to decode the list of CldsSdcResourceBasicInfo JSON", e);\r
             return new ArrayList<>();\r
         }\r
     }\r
 \r
-    /**\r
-     * To get CldsAsdsResource class by parsing json string.\r
-     * \r
-     * @param jsonStr\r
-     * @return\r
-     * @throws IOException\r
-     */\r
-    public CldsSdcResource getCldsSdcResourceFromJson(String jsonStr) throws IOException {\r
-        ObjectMapper objectMapper = new ObjectMapper();\r
-        return objectMapper.readValue(jsonStr, CldsSdcResource.class);\r
-    }\r
-\r
     /**\r
      * To get CldsSdcServiceDetail by parsing json string.\r
-     * \r
+     *\r
      * @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
-        } catch (IOException e) {\r
+            return JsonUtils.GSON.fromJson(jsonStr, SdcServiceDetail.class);\r
+        } catch (JsonParseException e) {\r
             logger.error("Exception when attempting to decode the CldsSdcServiceDetail JSON", e);\r
             return null;\r
         }\r
     }\r
 \r
-    /**\r
-     * To upload artifact to sdc based on serviceUUID and resource name on url.\r
-     * \r
-     * @param prop\r
-     * @param userid\r
-     * @param url\r
-     * @param formattedSdcReq\r
-     * @return\r
-     * @throws GeneralSecurityException\r
-     */\r
-    public String uploadArtifactToSdc(ModelProperties prop, String userid, String url, String formattedSdcReq)\r
-            throws GeneralSecurityException {\r
-        // Verify whether it is triggered by Validation Test button from UI\r
-        if (prop.isTestOnly()) {\r
-            return "sdc artifact upload not executed for test action";\r
-        }\r
-        try {\r
-            logger.info("userid=" + userid);\r
-            byte[] postData = formattedSdcReq.getBytes(StandardCharsets.UTF_8);\r
-            int postDataLength = postData.length;\r
-            HttpURLConnection conn = getSdcHttpUrlConnection(userid, postDataLength, url, formattedSdcReq);\r
-            try (DataOutputStream wr = new DataOutputStream(conn.getOutputStream())) {\r
-                wr.write(postData);\r
-            }\r
-            boolean requestFailed = true;\r
-            int responseCode = conn.getResponseCode();\r
-            logger.info("responseCode=" + responseCode);\r
-            if (responseCode == 200) {\r
-                requestFailed = false;\r
-            }\r
-            String responseStr = getResponse(conn);\r
-            if (responseStr != null && requestFailed) {\r
-                logger.error("requestFailed - responseStr=" + responseStr);\r
-                throw new BadRequestException(responseStr);\r
-            }\r
-            return responseStr;\r
-        } catch (IOException e) {\r
-            logger.error("Exception when attempting to communicate with SDC", e);\r
-            throw new SdcCommunicationException("Exception when attempting to communicate with SDC", e);\r
-        }\r
-    }\r
-\r
-    private HttpURLConnection getSdcHttpUrlConnection(String userid, int postDataLength, String url, String content)\r
-            throws GeneralSecurityException {\r
-        try {\r
-            logger.info("userid=" + userid);\r
-            String basicAuth = getSdcBasicAuth();\r
-            String sdcXonapInstanceId = refProp.getStringValue("sdc.sdcX-InstanceID");\r
-            URL urlObj = new URL(url);\r
-            HttpURLConnection conn = (HttpURLConnection) urlObj.openConnection();\r
-            conn.setDoOutput(true);\r
-            conn.setRequestProperty(refProp.getStringValue(SDC_INSTANCE_ID_PROPERTY_NAME), sdcXonapInstanceId);\r
-            conn.setRequestProperty(HttpHeaders.AUTHORIZATION, basicAuth);\r
-            conn.setRequestProperty(HttpHeaders.CONTENT_TYPE, "application/json");\r
-            conn.setRequestProperty(HttpHeaders.CONTENT_MD5,\r
-                    Base64.getEncoder().encodeToString(DigestUtils.md5Hex(content).getBytes("UTF-8")));\r
-            conn.setRequestProperty("USER_ID", userid);\r
-            conn.setRequestMethod("POST");\r
-            conn.setRequestProperty("charset", "utf-8");\r
-            conn.setRequestProperty(HttpHeaders.CONTENT_LENGTH, Integer.toString(postDataLength));\r
-            conn.setUseCaches(false);\r
-            conn.setRequestProperty(refProp.getStringValue(SDC_REQUESTID_PROPERTY_NAME), LoggingUtils.getRequestId());\r
-            return conn;\r
-        } catch (IOException e) {\r
-            logger.error("Exception when attempting to open connection with SDC", e);\r
-            throw new SdcCommunicationException("Exception when attempting to open connection with SDC", e);\r
-        } catch (DecoderException e) {\r
-            logger.error("Exception when attempting to decode the Hex string", e);\r
-            throw new SdcCommunicationException("Exception when attempting to decode the Hex string", e);\r
-        } catch (GeneralSecurityException e) {\r
-            logger.error("Exception when attempting to decrypt the encrypted password", e);\r
-            throw new SdcCommunicationException("Exception when attempting to decrypt the encrypted password", e);\r
-        }\r
-    }\r
-\r
-    private String getResponse(HttpURLConnection conn) {\r
+    public String getResponse(HttpURLConnection conn) {\r
         try (InputStream is = getInputStream(conn)) {\r
             try (BufferedReader in = new BufferedReader(new InputStreamReader(is))) {\r
                 return IOUtils.toString(in);\r
@@ -445,71 +358,58 @@ public class SdcCatalogServices {
         }\r
     }\r
 \r
-    public CldsDBServiceCache getCldsDbServiceCacheUsingCldsServiceData(CldsServiceData cldsServiceData) {\r
-        try {\r
-            CldsDBServiceCache cldsDbServiceCache = new CldsDBServiceCache();\r
-            cldsDbServiceCache.setCldsDataInstream(cldsServiceData);\r
-            cldsDbServiceCache.setInvariantId(cldsServiceData.getServiceInvariantUUID());\r
-            cldsDbServiceCache.setServiceId(cldsServiceData.getServiceUUID());\r
-            return cldsDbServiceCache;\r
-        } catch (IOException e) {\r
-            logger.error("Exception when getting service in cache", e);\r
-            throw new SdcCommunicationException("Exception when getting service in cache", e);\r
-        }\r
-    }\r
-\r
     /**\r
      * Check if the SDC Info in cache has expired.\r
-     * \r
+     *\r
      * @param cldsServiceData\r
-     * @return\r
+     *        The object representing the service data\r
+     * @return boolean flag\r
      * @throws GeneralSecurityException\r
-     *             In case of issues with the decryting the encrypted password\r
+     *         In case of issues with the decryting the encrypted password\r
      * @throws DecoderException\r
-     *             In case of issues with the decoding of the Hex String\r
+     *         In case of issues with the decoding of the Hex String\r
      */\r
     public boolean isCldsSdcCacheDataExpired(CldsServiceData cldsServiceData)\r
-            throws GeneralSecurityException, DecoderException {\r
-        boolean expired = false;\r
+        throws GeneralSecurityException, DecoderException {\r
         if (cldsServiceData != null && cldsServiceData.getServiceUUID() != null) {\r
             String cachedServiceUuid = cldsServiceData.getServiceUUID();\r
             String latestServiceUuid = getServiceUuidFromServiceInvariantId(cldsServiceData.getServiceInvariantUUID());\r
-            String defaultRecordAge = refProp.getStringValue("CLDS_SERVICE_CACHE_MAX_SECONDS");\r
-            if ((!cachedServiceUuid.equalsIgnoreCase(latestServiceUuid)) || (cldsServiceData.getAgeOfRecord() != null\r
-                    && cldsServiceData.getAgeOfRecord() > Long.parseLong(defaultRecordAge))) {\r
-                expired = true;\r
+            String configuredMaxAge = refProp.getStringValue("clds.service.cache.invalidate.after.seconds");\r
+            if (configuredMaxAge == null) {\r
+                logger.warn(\r
+                    "clds.service.cache.invalidate.after.seconds NOT set in clds-reference.properties file, taking 60s as default");\r
+                configuredMaxAge = "60";\r
             }\r
+            return (!cachedServiceUuid.equalsIgnoreCase(latestServiceUuid)) || (cldsServiceData.getAgeOfRecord() != null\r
+                && cldsServiceData.getAgeOfRecord() > Long.parseLong(configuredMaxAge));\r
         } else {\r
-            expired = true;\r
+            return true;\r
         }\r
-        return expired;\r
     }\r
 \r
     /**\r
-     * Get the Service Data with Alarm Conditions for a given\r
-     * invariantServiceUuid.\r
-     * \r
+     * Get the Service Data with Alarm Conditions for a given invariantServiceUuid.\r
+     *\r
      * @param invariantServiceUuid\r
-     * @return\r
+     * @return The CldsServiceData\r
      * @throws GeneralSecurityException\r
-     *             In case of issues with the decryting the encrypted password\r
+     *         In case of issues with the decryting the encrypted password\r
      * @throws DecoderException\r
-     *             In case of issues with the decoding of the Hex String\r
+     *         In case of issues with the decoding of the Hex String\r
      */\r
     public CldsServiceData getCldsServiceDataWithAlarmConditions(String invariantServiceUuid)\r
-            throws GeneralSecurityException, DecoderException {\r
+        throws GeneralSecurityException, DecoderException {\r
         String url = refProp.getStringValue(SDC_SERVICE_URL_PROPERTY_NAME);\r
         String catalogUrl = refProp.getStringValue(SDC_CATALOG_URL_PROPERTY_NAME);\r
         String serviceUuid = getServiceUuidFromServiceInvariantId(invariantServiceUuid);\r
         String serviceDetailUrl = url + "/" + serviceUuid + SDC_METADATA_URL_PREFIX;\r
-        String responseStr = getCldsServicesOrResourcesBasedOnURL(serviceDetailUrl, false);\r
-        ObjectMapper objectMapper = new ObjectMapper();\r
+        String responseStr = getCldsServicesOrResourcesBasedOnURL(serviceDetailUrl);\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
-            } catch (IOException e) {\r
+                cldsSdcServiceDetail = JsonUtils.GSON.fromJson(responseStr, SdcServiceDetail.class);\r
+            } catch (JsonParseException 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
             }\r
@@ -518,13 +418,13 @@ 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
-                        cldsSdcServiceDetail.getResources());\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
+                            && "VF".equalsIgnoreCase(currCldsSdcResource.getResoucreType())) {\r
                             CldsVfData currCldsVfData = new CldsVfData();\r
                             currCldsVfData.setVfName(currCldsSdcResource.getResourceInstanceName());\r
                             currCldsVfData.setVfInvariantResourceUUID(currCldsSdcResource.getResourceInvariantUUID());\r
@@ -534,8 +434,7 @@ public class SdcCatalogServices {
                     cldsServiceData.setCldsVfs(cldsVfDataList);\r
                     // For each vf in the list , add all vfc's\r
                     getAllVfcForVfList(cldsVfDataList, catalogUrl);\r
-                    logger.info("value of cldsServiceData:" + cldsServiceData);\r
-                    logger.info("value of cldsServiceData:" + cldsServiceData.getServiceInvariantUUID());\r
+                    logger.info("Invariant Service ID of cldsServiceData:" + cldsServiceData.getServiceInvariantUUID());\r
                 }\r
             }\r
         }\r
@@ -543,22 +442,21 @@ public class SdcCatalogServices {
     }\r
 \r
     private void getAllVfcForVfList(List<CldsVfData> cldsVfDataList, String catalogUrl)\r
-            throws GeneralSecurityException {\r
+        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
-                    RESOURCE_VFC_TYPE);\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
                 if (currCldsVfData != null && currCldsVfData.getVfInvariantResourceUUID() != null) {\r
                     String resourceUuid = getResourceUuidFromResourceInvariantUuid(\r
-                            currCldsVfData.getVfInvariantResourceUUID(), allVfResources);\r
+                        currCldsVfData.getVfInvariantResourceUUID(), allVfResources);\r
                     if (resourceUuid != null) {\r
                         String vfResourceUuidUrl = catalogUrl + RESOURCE_URL_PREFIX + "/" + resourceUuid\r
-                                + SDC_METADATA_URL_PREFIX;\r
-                        String vfResponse = getCldsServicesOrResourcesBasedOnURL(vfResourceUuidUrl, false);\r
+                            + SDC_METADATA_URL_PREFIX;\r
+                        String vfResponse = getCldsServicesOrResourcesBasedOnURL(vfResourceUuidUrl);\r
                         if (vfResponse != null) {\r
                             // Below 2 line are to get the KPI(field path) data\r
                             // associated with the VF's\r
@@ -572,22 +470,22 @@ public class SdcCatalogServices {
                                     // alarm conditions from artifact\r
                                     for (CldsVfcData currCldsVfcData : vfcDataListFromVfResponse) {\r
                                         if (currCldsVfcData != null\r
-                                                && currCldsVfcData.getVfcInvariantResourceUUID() != null) {\r
+                                            && currCldsVfcData.getVfcInvariantResourceUUID() != null) {\r
                                             String resourceVfcUuid = getResourceUuidFromResourceInvariantUuid(\r
-                                                    currCldsVfcData.getVfcInvariantResourceUUID(), allVfcResources);\r
+                                                currCldsVfcData.getVfcInvariantResourceUUID(), allVfcResources);\r
                                             if (resourceVfcUuid != null) {\r
                                                 String vfcResourceUuidUrl = catalogUrl + RESOURCE_URL_PREFIX + "/"\r
-                                                        + resourceVfcUuid + SDC_METADATA_URL_PREFIX;\r
+                                                    + resourceVfcUuid + SDC_METADATA_URL_PREFIX;\r
                                                 String vfcResponse = getCldsServicesOrResourcesBasedOnURL(\r
-                                                        vfcResourceUuidUrl, false);\r
+                                                    vfcResourceUuidUrl);\r
                                                 if (vfcResponse != null) {\r
                                                     List<CldsAlarmCondition> alarmCondtionsFromVfc = getAlarmCondtionsFromVfc(\r
-                                                            vfcResponse);\r
+                                                        vfcResponse);\r
                                                     currCldsVfcData.setCldsAlarmConditions(alarmCondtionsFromVfc);\r
                                                 }\r
                                             } else {\r
                                                 logger.info("No resourceVFC UUID found for given invariantID:"\r
-                                                        + currCldsVfcData.getVfcInvariantResourceUUID());\r
+                                                    + currCldsVfcData.getVfcInvariantResourceUUID());\r
                                             }\r
                                         }\r
                                     }\r
@@ -596,73 +494,72 @@ public class SdcCatalogServices {
                         }\r
                     } else {\r
                         logger.info("No resourceUUID found for given invariantREsourceUUID:"\r
-                                + currCldsVfData.getVfInvariantResourceUUID());\r
+                            + currCldsVfData.getVfInvariantResourceUUID());\r
                     }\r
                 }\r
             }\r
         }\r
     }\r
 \r
-    private List<CldsVfcData> getVfcDataListFromVfResponse(String vfResponse) throws GeneralSecurityException {\r
-        ObjectMapper mapper = new ObjectMapper();\r
-        ObjectNode vfResponseNode;\r
+    private List<CldsVfcData> getVfcDataListFromVfResponse(String vfResponse) {\r
+        JsonObject vfResponseNode;\r
         try {\r
-            vfResponseNode = (ObjectNode) mapper.readTree(vfResponse);\r
-        } catch (IOException e) {\r
+            vfResponseNode = JsonUtils.GSON.fromJson(vfResponse, JsonObject.class);\r
+        } catch (JsonParseException e) {\r
             logger.error("Exception when decoding the JSON list of CldsVfcData", e);\r
             return new ArrayList<>();\r
         }\r
-        ArrayNode vfcArrayNode = (ArrayNode) vfResponseNode.get("resources");\r
+        JsonArray vfcArrayNode = vfResponseNode.get("resources").getAsJsonArray();\r
         List<CldsVfcData> cldsVfcDataList = new ArrayList<>();\r
         if (vfcArrayNode != null) {\r
-            for (JsonNode vfcjsonNode : vfcArrayNode) {\r
-                CldsVfcData currCldsVfcData = new CldsVfcData();\r
-                ObjectNode currVfcNode = (ObjectNode) vfcjsonNode;\r
-                TextNode resourceTypeNode = (TextNode) currVfcNode.get("resoucreType");\r
-                if (resourceTypeNode != null && "VFC".equalsIgnoreCase(resourceTypeNode.textValue())) {\r
-                    TextNode vfcResourceName = (TextNode) currVfcNode.get("resourceInstanceName");\r
-                    TextNode vfcInvariantResourceUuid = (TextNode) currVfcNode.get("resourceInvariantUUID");\r
-                    currCldsVfcData.setVfcName(vfcResourceName.textValue());\r
-                    currCldsVfcData.setVfcInvariantResourceUUID(vfcInvariantResourceUuid.textValue());\r
-                    cldsVfcDataList.add(currCldsVfcData);\r
-                } else if (resourceTypeNode != null && "CVFC".equalsIgnoreCase(resourceTypeNode.textValue())) {\r
-                    TextNode vfcResourceName = (TextNode) currVfcNode.get("resourceInstanceName");\r
-                    TextNode vfcInvariantResourceUuid = (TextNode) currVfcNode.get("resourceInvariantUUID");\r
-                    currCldsVfcData.setVfcName(vfcResourceName.textValue());\r
-                    currCldsVfcData.setVfcInvariantResourceUUID(vfcInvariantResourceUuid.textValue());\r
-                    cldsVfcDataList.add(currCldsVfcData);\r
-                    cldsVfcDataList.addAll(getVFCfromCVFC(currVfcNode.get("resourceUUID").textValue()));\r
+            for (JsonElement vfcjsonNode : vfcArrayNode) {\r
+                JsonObject currVfcNode = vfcjsonNode.getAsJsonObject();\r
+                JsonElement resourceTypeNode = currVfcNode.get("resoucreType");\r
+                if (resourceTypeNode != null && resourceTypeNode.isJsonPrimitive()) {\r
+                    if ("VFC".equalsIgnoreCase(resourceTypeNode.getAsString())) {\r
+                        handleVFCtypeNode(currVfcNode, cldsVfcDataList);\r
+                    } else if ("CVFC".equalsIgnoreCase(resourceTypeNode.getAsString())) {\r
+                        handleCVFCtypeNode(currVfcNode, cldsVfcDataList);\r
+                    }\r
                 }\r
             }\r
         }\r
         return cldsVfcDataList;\r
     }\r
 \r
-    private List<CldsVfcData> getVFCfromCVFC(String resourceUUID) throws GeneralSecurityException {\r
+    private void handleVFCtypeNode(JsonObject currVfcNode, List<CldsVfcData> cldsVfcDataList) {\r
+        CldsVfcData currCldsVfcData = new CldsVfcData();\r
+        String vfcResourceName = currVfcNode.get("resourceInstanceName").getAsString();\r
+        String vfcInvariantResourceUuid = currVfcNode.get("resourceInvariantUUID").getAsString();\r
+        currCldsVfcData.setVfcName(vfcResourceName);\r
+        currCldsVfcData.setVfcInvariantResourceUUID(vfcInvariantResourceUuid);\r
+        cldsVfcDataList.add(currCldsVfcData);\r
+    }\r
+\r
+    private void handleCVFCtypeNode(JsonObject currVfcNode, List<CldsVfcData> cldsVfcDataList) {\r
+        handleVFCtypeNode(currVfcNode, cldsVfcDataList);\r
+        cldsVfcDataList.addAll(getVFCfromCVFC(currVfcNode.get("resourceUUID").getAsString()));\r
+    }\r
+\r
+    private List<CldsVfcData> getVFCfromCVFC(String resourceUUID) {\r
         String catalogUrl = refProp.getStringValue(SDC_CATALOG_URL_PROPERTY_NAME);\r
         List<CldsVfcData> cldsVfcDataList = new ArrayList<>();\r
         if (resourceUUID != null) {\r
             String vfcResourceUUIDUrl = catalogUrl + RESOURCE_URL_PREFIX + "/" + resourceUUID + SDC_METADATA_URL_PREFIX;\r
             try {\r
-                String vfcResponse = getCldsServicesOrResourcesBasedOnURL(vfcResourceUUIDUrl, false);\r
-                ObjectMapper mapper = new ObjectMapper();\r
-                ObjectNode vfResponseNode = (ObjectNode) mapper.readTree(vfcResponse);\r
-                ArrayNode vfcArrayNode = (ArrayNode) vfResponseNode.get("resources");\r
+                String vfcResponse = getCldsServicesOrResourcesBasedOnURL(vfcResourceUUIDUrl);\r
+                JsonObject vfResponseNode = JsonUtils.GSON.fromJson(vfcResponse, JsonObject.class);\r
+                JsonArray vfcArrayNode = vfResponseNode.get("resources").getAsJsonArray();\r
                 if (vfcArrayNode != null) {\r
-                    for (JsonNode vfcjsonNode : vfcArrayNode) {\r
-                        CldsVfcData currCldsVfcData = new CldsVfcData();\r
-                        ObjectNode currVfcNode = (ObjectNode) vfcjsonNode;\r
-                        TextNode resourceTypeNode = (TextNode) currVfcNode.get("resoucreType");\r
-                        if (resourceTypeNode != null && "VFC".equalsIgnoreCase(resourceTypeNode.textValue())) {\r
-                            TextNode vfcResourceName = (TextNode) currVfcNode.get("resourceInstanceName");\r
-                            TextNode vfcInvariantResourceUUID = (TextNode) currVfcNode.get("resourceInvariantUUID");\r
-                            currCldsVfcData.setVfcName(vfcResourceName.textValue());\r
-                            currCldsVfcData.setVfcInvariantResourceUUID(vfcInvariantResourceUUID.textValue());\r
-                            cldsVfcDataList.add(currCldsVfcData);\r
+                    for (JsonElement vfcjsonNode : vfcArrayNode) {\r
+                        JsonObject currVfcNode = vfcjsonNode.getAsJsonObject();\r
+                        JsonElement resourceTypeNode = currVfcNode.get("resoucreType");\r
+                        if (resourceTypeNode != null && resourceTypeNode.isJsonPrimitive() && "VFC".equalsIgnoreCase(resourceTypeNode.getAsString())) {\r
+                            handleVFCtypeNode(currVfcNode, cldsVfcDataList);\r
                         }\r
                     }\r
                 }\r
-            } catch (IOException e) {\r
+            } catch (JsonParseException e) {\r
                 logger.error("Exception during JSON analyzis", e);\r
             }\r
         }\r
@@ -675,21 +572,21 @@ 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
+        JsonObject vfcResponseNode;\r
         try {\r
-            vfcResponseNode = (ObjectNode) mapper.readTree(vfcResponse);\r
-        } catch (IOException e) {\r
+            vfcResponseNode = JsonUtils.GSON.fromJson(vfcResponse, JsonObject.class);\r
+        } catch (JsonParseException e) {\r
             logger.error("Exception when decoding the JSON list of CldsAlarmCondition", e);\r
             return cldsAlarmConditionList;\r
         }\r
-        ArrayNode artifactsArrayNode = (ArrayNode) vfcResponseNode.get("artifacts");\r
-        if (artifactsArrayNode != null && artifactsArrayNode.size() > 0) {\r
-            for (int index = 0; index < artifactsArrayNode.size(); index++) {\r
-                ObjectNode currArtifactNode = (ObjectNode) artifactsArrayNode.get(index);\r
-                TextNode artifactUrlNode = (TextNode) currArtifactNode.get("artifactURL");\r
-                if (artifactUrlNode != null) {\r
-                    String responsesFromArtifactUrl = getResponsesFromArtifactUrl(artifactUrlNode.textValue());\r
+        JsonElement artifactsNode = vfcResponseNode.get("artifacts");\r
+        if (artifactsNode != null && artifactsNode.isJsonArray() && artifactsNode.getAsJsonArray().size() > 0) {\r
+            JsonArray artifactsList = artifactsNode.getAsJsonArray();\r
+            for (int index = 0; index < artifactsList.size(); index++) {\r
+                JsonObject currArtifactNode = artifactsList.get(index).getAsJsonObject();\r
+                JsonElement artifactUrlNode = currArtifactNode.get("artifactURL");\r
+                if (artifactUrlNode != null && artifactUrlNode.isJsonPrimitive()) {\r
+                    String responsesFromArtifactUrl = getResponsesFromArtifactUrl(artifactUrlNode.getAsString());\r
                     cldsAlarmConditionList.addAll(parseCsvToGetAlarmConditions(responsesFromArtifactUrl));\r
                     logger.info(responsesFromArtifactUrl);\r
                 }\r
@@ -720,27 +617,26 @@ 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
+        JsonObject vfResponseNode;\r
         try {\r
-            vfResponseNode = (ObjectNode) mapper.readTree(vfResponse);\r
-        } catch (IOException e) {\r
+            vfResponseNode = JsonUtils.GSON.fromJson(vfResponse, JsonObject.class);\r
+        } catch (JsonParseException e) {\r
             logger.error("Exception when decoding the JSON list of CldsVfKPIData", e);\r
             return cldsVfKPIDataList;\r
         }\r
-        ArrayNode artifactsArrayNode = (ArrayNode) vfResponseNode.get("artifacts");\r
+        JsonArray artifactsArrayNode = vfResponseNode.get("artifacts").getAsJsonArray();\r
         if (artifactsArrayNode != null && artifactsArrayNode.size() > 0) {\r
             for (int index = 0; index < artifactsArrayNode.size(); index++) {\r
-                ObjectNode currArtifactNode = (ObjectNode) artifactsArrayNode.get(index);\r
-                TextNode artifactUrlNode = (TextNode) currArtifactNode.get("artifactURL");\r
-                TextNode artifactNameNode = (TextNode) currArtifactNode.get("artifactName");\r
+                JsonObject currArtifactNode = artifactsArrayNode.get(index).getAsJsonObject();\r
+                JsonElement artifactUrlNode = currArtifactNode.get("artifactURL");\r
+                JsonElement artifactNameNode = currArtifactNode.get("artifactName");\r
                 String artifactName = "";\r
                 if (artifactNameNode != null) {\r
-                    artifactName = artifactNameNode.textValue();\r
+                    artifactName = artifactNameNode.getAsString();\r
                     artifactName = artifactName.substring(artifactName.lastIndexOf('.') + 1);\r
                 }\r
                 if (artifactUrlNode != null && "csv".equalsIgnoreCase(artifactName)) {\r
-                    String responsesFromArtifactUrl = getResponsesFromArtifactUrl(artifactUrlNode.textValue());\r
+                    String responsesFromArtifactUrl = getResponsesFromArtifactUrl(artifactUrlNode.getAsString());\r
                     cldsVfKPIDataList.addAll(parseCsvToGetFieldPath(responsesFromArtifactUrl));\r
                     logger.info(responsesFromArtifactUrl);\r
                 }\r
@@ -755,7 +651,7 @@ public class SdcCatalogServices {
             return null;\r
         }\r
         if (StringUtils.isBlank(record.get(1)) || StringUtils.isBlank(record.get(3))\r
-                || StringUtils.isBlank(record.get(5))) {\r
+            || StringUtils.isBlank(record.get(5))) {\r
             logger.debug("Invalid csv field path Record,one of column is having blank value : " + record);\r
             return null;\r
         }\r
@@ -799,7 +695,7 @@ public class SdcCatalogServices {
             return;\r
         }\r
         if (StringUtils.isBlank(record.get(1)) || StringUtils.isBlank(record.get(3))\r
-                || StringUtils.isBlank(record.get(4))) {\r
+            || StringUtils.isBlank(record.get(4))) {\r
             logger.debug("invalid csv alarm Record,one of column is having blank value : " + record);\r
             return;\r
         }\r
@@ -811,42 +707,33 @@ public class SdcCatalogServices {
         cldsAlarmConditionList.add(cldsAlarmCondition);\r
     }\r
 \r
-    /**\r
-     * Get the responses for the current artifact from the artifacts URL.\r
-     * \r
-     * @param artifactsUrl\r
-     * @return\r
-     * @throws GeneralSecurityException\r
-     */\r
-    public String getResponsesFromArtifactUrl(String artifactsUrl) throws GeneralSecurityException {\r
+    // Get the responses for the current artifact from the artifacts URL.\r
+    private String getResponsesFromArtifactUrl(String artifactsUrl) {\r
         String hostUrl = refProp.getStringValue("sdc.hostUrl");\r
         String artifactsUrlReworked = artifactsUrl.replaceAll("\"", "");\r
         String artifactUrl = hostUrl + artifactsUrlReworked;\r
         logger.info("value of artifactURl:" + artifactUrl);\r
-        String currArtifactResponse = getCldsServicesOrResourcesBasedOnURL(artifactUrl, true);\r
+        String currArtifactResponse = getCldsServicesOrResourcesBasedOnURL(artifactUrl);\r
         logger.info("value of artifactResponse:" + currArtifactResponse);\r
         return currArtifactResponse;\r
     }\r
 \r
     /**\r
-     * Service to services/resources/artifacts from sdc.Pass alarmConditions as\r
-     * true to get alarm conditons from artifact url and else it is false\r
-     * \r
+     * Service to services/resources/artifacts from sdc.Pass alarmConditions as true\r
+     * to get alarm conditons from artifact url and else it is false\r
+     *\r
      * @param url\r
-     * @param alarmConditions\r
-     * @return\r
-     * @throws GeneralSecurityException\r
-     *             In case of issue when decrypting the SDC password\r
-     * \r
+     *        The URL to trigger\r
+     * @return The String containing the payload\r
      */\r
-    public String getCldsServicesOrResourcesBasedOnURL(String url, boolean alarmConditions)\r
-            throws GeneralSecurityException {\r
+    public String getCldsServicesOrResourcesBasedOnURL(String url) {\r
         Date startTime = new Date();\r
         try {\r
             LoggingUtils.setTargetContext("SDC", "getCldsServicesOrResourcesBasedOnURL");\r
             String urlReworked = removeUnwantedBracesFromString(url);\r
             URL urlObj = new URL(urlReworked);\r
             HttpURLConnection conn = (HttpURLConnection) urlObj.openConnection();\r
+            conn = utils.invoke(conn, "SDC", "getSdcResources");\r
             String basicAuth = getSdcBasicAuth();\r
             conn.setRequestProperty(refProp.getStringValue(SDC_INSTANCE_ID_PROPERTY_NAME), SDC_INSTANCE_ID_CLAMP);\r
             conn.setRequestProperty(HttpHeaders.AUTHORIZATION, basicAuth);\r
@@ -857,115 +744,95 @@ public class SdcCatalogServices {
             logger.info("Sdc resource url - " + urlReworked + " , responseCode=" + responseCode);\r
             try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()))) {\r
                 String response = IOUtils.toString(in);\r
-                LoggingUtils.setResponseContext("0", "Get sdc resources success", this.getClass().getName());\r
                 return response;\r
             }\r
         } catch (IOException e) {\r
-            LoggingUtils.setResponseContext("900", "Get sdc resources failed", this.getClass().getName());\r
             LoggingUtils.setErrorContext("900", "Get sdc resources error");\r
             logger.error("Exception occurred during query to SDC", e);\r
             return "";\r
         } catch (DecoderException e) {\r
+            LoggingUtils.setErrorContext("900", "Get sdc resources error");\r
             logger.error("Exception when attempting to decode the Hex string", e);\r
             throw new SdcCommunicationException("Exception when attempting to decode the Hex string", e);\r
         } catch (GeneralSecurityException e) {\r
+            LoggingUtils.setErrorContext("900", "Get sdc resources error");\r
             logger.error("Exception when attempting to decrypt the encrypted password", e);\r
             throw new SdcCommunicationException("Exception when attempting to decrypt the encrypted password", e);\r
         } finally {\r
             LoggingUtils.setTimeContext(startTime, new Date());\r
             metricsLogger.info("getCldsServicesOrResourcesBasedOnURL completed");\r
+            utils.invokeReturn();\r
         }\r
     }\r
 \r
     /**\r
      * To create properties object by using cldsServicedata.\r
      *\r
-     * @param globalProps\r
-     * @param cldsServiceData\r
-     * @return\r
+     * @throws IOException 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
+        JsonObject globalPropsJson = refProp.getJsonTemplate(CldsService.GLOBAL_PROPERTIES_KEY).getAsJsonObject();\r
         if (cldsServiceData != null && cldsServiceData.getServiceUUID() != null) {\r
             // Objectnode to save all byservice, byvf , byvfc and byalarm nodes\r
-            ObjectNode byIdObjectNode = mapper.createObjectNode();\r
+            JsonObject byIdObjectNode = new JsonObject();\r
             // To create vf ResourceUUID node with serviceInvariantUUID\r
-            ObjectNode invariantUuidObjectNodeWithVf = createVfObjectNodeByServiceInvariantUuid(mapper,\r
-                    cldsServiceData);\r
-            byIdObjectNode.putPOJO("byService", invariantUuidObjectNodeWithVf);\r
+            JsonObject invariantUuidObjectNodeWithVf = createVfObjectNodeByServiceInvariantUuid(cldsServiceData);\r
+            byIdObjectNode.add("byService", invariantUuidObjectNodeWithVf);\r
             // To create byVf and vfcResourceNode with vfResourceUUID\r
-            ObjectNode vfcObjectNodeByVfUuid = createVfcObjectNodeByVfUuid(mapper, cldsServiceData.getCldsVfs());\r
-            byIdObjectNode.putPOJO("byVf", vfcObjectNodeByVfUuid);\r
+            JsonObject vfcObjectNodeByVfUuid = createVfcObjectNodeByVfUuid(cldsServiceData.getCldsVfs());\r
+            byIdObjectNode.add("byVf", vfcObjectNodeByVfUuid);\r
             // To create byKpi\r
-            ObjectNode kpiObjectNode = mapper.createObjectNode();\r
+            JsonObject kpiJsonObject = new JsonObject();\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(kpiJsonObject, currCldsVfData.getCldsKPIList());\r
                     }\r
                 }\r
             }\r
-            byIdObjectNode.putPOJO("byKpi", kpiObjectNode);\r
+            byIdObjectNode.add("byKpi", kpiJsonObject);\r
             // To create byVfc and alarmCondition with vfcResourceUUID\r
-            ObjectNode vfcResourceUuidObjectNode = mapper.createObjectNode();\r
+            JsonObject vfcResourceUuidObjectNode = new JsonObject();\r
             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
-            byIdObjectNode.putPOJO("byVfc", vfcResourceUuidObjectNode);\r
+            byIdObjectNode.add("byVfc", vfcResourceUuidObjectNode);\r
             // To create byAlarmCondition with alarmConditionKey\r
             List<CldsAlarmCondition> allAlarmConditions = getAllAlarmConditionsFromCldsServiceData(cldsServiceData,\r
-                    "alarmCondition");\r
-            ObjectNode alarmCondObjectNodeByAlarmKey = createAlarmCondObjectNodeByAlarmKey(mapper, allAlarmConditions);\r
-            byIdObjectNode.putPOJO("byAlarmCondition", alarmCondObjectNodeByAlarmKey);\r
+                "alarmCondition");\r
+            JsonObject alarmCondObjectNodeByAlarmKey = createAlarmCondObjectNodeByAlarmKey(allAlarmConditions);\r
+            byIdObjectNode.add("byAlarmCondition", alarmCondObjectNodeByAlarmKey);\r
             // To create byAlertDescription with AlertDescription\r
             List<CldsAlarmCondition> allAlertDescriptions = getAllAlarmConditionsFromCldsServiceData(cldsServiceData,\r
-                    "alertDescription");\r
-            ObjectNode alertDescObjectNodeByAlert = createAlarmCondObjectNodeByAlarmKey(mapper, allAlertDescriptions);\r
-            byIdObjectNode.putPOJO("byAlertDescription", alertDescObjectNodeByAlert);\r
-            globalPropsJson = decodeGlobalProp(globalProps, mapper);\r
-            globalPropsJson.putPOJO("shared", byIdObjectNode);\r
-            logger.info("value of objNode:" + globalPropsJson);\r
-        } else {\r
-            /**\r
-             * to create json with total properties when no serviceUUID passed\r
-             */\r
-            globalPropsJson = decodeGlobalProp(globalProps, mapper);\r
+                "alertDescription");\r
+            JsonObject alertDescObjectNodeByAlert = createAlarmCondObjectNodeByAlarmKey(allAlertDescriptions);\r
+            byIdObjectNode.add("byAlertDescription", alertDescObjectNodeByAlert);\r
+            globalPropsJson.add("shared", byIdObjectNode);\r
+            logger.info("Global properties JSON created with SDC info:" + globalPropsJson);\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
+     *\r
      * @param cldsServiceData\r
-     *            CldsServiceData the Service Data to analyze\r
+     *        CldsServiceData the Service Data to analyze\r
      * @param eventName\r
-     *            The String event name that will be used to filter the alarm\r
-     *            list\r
+     *        The String event name that will be used to filter the alarm list\r
      * @return The list of CldsAlarmCondition for the event name specified\r
      */\r
     public List<CldsAlarmCondition> getAllAlarmConditionsFromCldsServiceData(CldsServiceData cldsServiceData,\r
-            String eventName) {\r
+        String eventName) {\r
         List<CldsAlarmCondition> alarmCondList = new ArrayList<>();\r
         if (cldsServiceData != null && cldsServiceData.getCldsVfs() != null\r
-                && !cldsServiceData.getCldsVfs().isEmpty()) {\r
+            && !cldsServiceData.getCldsVfs().isEmpty()) {\r
             for (CldsVfData currCldsVfData : cldsServiceData.getCldsVfs()) {\r
                 alarmCondList.addAll(getAllAlarmConditionsFromCldsVfData(currCldsVfData, eventName));\r
             }\r
@@ -975,12 +842,11 @@ public class SdcCatalogServices {
 \r
     /**\r
      * Method to get alarm conditions/alert description from VF Data.\r
-     * \r
+     *\r
      * @param currCldsVfData\r
-     *            The Vf Data to analyze\r
+     *        The Vf Data to analyze\r
      * @param eventName\r
-     *            The String event name that will be used to filter the alarm\r
-     *            list\r
+     *        The String event name that will be used to filter the alarm list\r
      * @return The list of CldsAlarmCondition for the event name specified\r
      */\r
     private List<CldsAlarmCondition> getAllAlarmConditionsFromCldsVfData(CldsVfData currCldsVfData, String eventName) {\r
@@ -995,22 +861,21 @@ public class SdcCatalogServices {
 \r
     /**\r
      * Method to get alarm conditions/alert description from VFC Data.\r
-     * \r
+     *\r
      * @param currCldsVfcData\r
-     *            The VfC Data to analyze\r
+     *        The VfC Data to analyze\r
      * @param eventName\r
-     *            The String event name that will be used to filter the alarm\r
-     *            list\r
+     *        The String event name that will be used to filter the alarm list\r
      * @return The list of CldsAlarmCondition for the event name specified\r
      */\r
     private List<CldsAlarmCondition> getAllAlarmConditionsFromCldsVfcData(CldsVfcData currCldsVfcData,\r
-            String eventName) {\r
+        String eventName) {\r
         List<CldsAlarmCondition> alarmCondList = new ArrayList<>();\r
         if (currCldsVfcData != null && currCldsVfcData.getCldsAlarmConditions() != null\r
-                && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) {\r
+            && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) {\r
             for (CldsAlarmCondition currCldsAlarmCondition : currCldsVfcData.getCldsAlarmConditions()) {\r
                 if (currCldsAlarmCondition != null\r
-                        && currCldsAlarmCondition.getEventName().equalsIgnoreCase(eventName)) {\r
+                    && currCldsAlarmCondition.getEventName().equalsIgnoreCase(eventName)) {\r
                     alarmCondList.add(currCldsAlarmCondition);\r
                 }\r
             }\r
@@ -1018,208 +883,163 @@ public class SdcCatalogServices {
         return alarmCondList;\r
     }\r
 \r
-    private ObjectNode createAlarmCondObjectNodeByAlarmKey(ObjectMapper mapper,\r
-            List<CldsAlarmCondition> cldsAlarmCondList) {\r
-        ObjectNode alarmCondKeyNode = mapper.createObjectNode();\r
+    private JsonObject createAlarmCondObjectNodeByAlarmKey(List<CldsAlarmCondition> cldsAlarmCondList) {\r
+        JsonObject alarmCondKeyNode = new JsonObject();\r
         if (cldsAlarmCondList != null && !cldsAlarmCondList.isEmpty()) {\r
             for (CldsAlarmCondition currCldsAlarmCondition : cldsAlarmCondList) {\r
                 if (currCldsAlarmCondition != null) {\r
-                    ObjectNode alarmCondNode = mapper.createObjectNode();\r
-                    alarmCondNode.put("eventSourceType", currCldsAlarmCondition.getEventSourceType());\r
-                    alarmCondNode.put("eventSeverity", currCldsAlarmCondition.getSeverity());\r
-                    alarmCondKeyNode.putPOJO(currCldsAlarmCondition.getAlarmConditionKey(), alarmCondNode);\r
+                    JsonObject alarmCondNode = new JsonObject();\r
+                    alarmCondNode.addProperty("eventSourceType", currCldsAlarmCondition.getEventSourceType());\r
+                    alarmCondNode.addProperty("eventSeverity", currCldsAlarmCondition.getSeverity());\r
+                    alarmCondKeyNode.add(currCldsAlarmCondition.getAlarmConditionKey(), alarmCondNode);\r
                 }\r
             }\r
         } else {\r
-            ObjectNode alarmCondNode = mapper.createObjectNode();\r
-            alarmCondNode.put("eventSourceType", "");\r
-            alarmCondNode.put("eventSeverity", "");\r
-            alarmCondKeyNode.putPOJO("", alarmCondNode);\r
+            JsonObject alarmCondNode = new JsonObject();\r
+            alarmCondNode.addProperty("eventSourceType", "");\r
+            alarmCondNode.addProperty("eventSeverity", "");\r
+            alarmCondKeyNode.add("", alarmCondNode);\r
         }\r
         return alarmCondKeyNode;\r
     }\r
 \r
-    private ObjectNode createVfObjectNodeByServiceInvariantUuid(ObjectMapper mapper, CldsServiceData cldsServiceData) {\r
-        ObjectNode invariantUuidObjectNode = mapper.createObjectNode();\r
-        ObjectNode vfObjectNode = mapper.createObjectNode();\r
-        ObjectNode vfUuidNode = mapper.createObjectNode();\r
+    private JsonObject createVfObjectNodeByServiceInvariantUuid(CldsServiceData cldsServiceData) {\r
+        JsonObject invariantUuidObjectNode = new JsonObject();\r
+        JsonObject vfObjectNode = new JsonObject();\r
+        JsonObject vfUuidNode = new JsonObject();\r
         List<CldsVfData> cldsVfsList = cldsServiceData.getCldsVfs();\r
         if (cldsVfsList != null && !cldsVfsList.isEmpty()) {\r
             for (CldsVfData currCldsVfData : cldsVfsList) {\r
                 if (currCldsVfData != null) {\r
-                    vfUuidNode.put(currCldsVfData.getVfInvariantResourceUUID(), currCldsVfData.getVfName());\r
+                    vfUuidNode.addProperty(currCldsVfData.getVfInvariantResourceUUID(), currCldsVfData.getVfName());\r
                 }\r
             }\r
         } else {\r
-            vfUuidNode.put("", "");\r
+            vfUuidNode.addProperty("", "");\r
         }\r
-        vfObjectNode.putPOJO("vf", vfUuidNode);\r
-        invariantUuidObjectNode.putPOJO(cldsServiceData.getServiceInvariantUUID(), vfObjectNode);\r
+        vfObjectNode.add("vf", vfUuidNode);\r
+        invariantUuidObjectNode.add(cldsServiceData.getServiceInvariantUUID(), vfObjectNode);\r
         return invariantUuidObjectNode;\r
     }\r
 \r
-    private void createKpiObjectNodeByVfUuid(ObjectMapper mapper, ObjectNode vfResourceUuidObjectNode,\r
-            List<CldsVfKPIData> cldsVfKpiDataList) {\r
+    private void createKpiObjectNodeByVfUuid(JsonObject vfResourceUuidObjectNode,\r
+        List<CldsVfKPIData> cldsVfKpiDataList) {\r
         if (cldsVfKpiDataList != null && !cldsVfKpiDataList.isEmpty()) {\r
             for (CldsVfKPIData currCldsVfKpiData : cldsVfKpiDataList) {\r
                 if (currCldsVfKpiData != null) {\r
-                    ObjectNode thresholdNameObjectNode = mapper.createObjectNode();\r
-                    ObjectNode fieldPathObjectNode = mapper.createObjectNode();\r
-                    ObjectNode nfNamingCodeNode = mapper.createObjectNode();\r
-                    fieldPathObjectNode.put(currCldsVfKpiData.getFieldPathValue(),\r
-                            currCldsVfKpiData.getFieldPathValue());\r
-                    nfNamingCodeNode.put(currCldsVfKpiData.getNfNamingValue(), currCldsVfKpiData.getNfNamingValue());\r
-                    thresholdNameObjectNode.putPOJO("fieldPath", fieldPathObjectNode);\r
-                    thresholdNameObjectNode.putPOJO("nfNamingCode", nfNamingCodeNode);\r
-                    vfResourceUuidObjectNode.putPOJO(currCldsVfKpiData.getThresholdValue(), thresholdNameObjectNode);\r
+                    JsonObject thresholdNameObjectNode = new JsonObject();\r
+                    JsonObject fieldPathObjectNode = new JsonObject();\r
+                    JsonObject nfNamingCodeNode = new JsonObject();\r
+                    fieldPathObjectNode.addProperty(currCldsVfKpiData.getFieldPathValue(),\r
+                        currCldsVfKpiData.getFieldPathValue());\r
+                    nfNamingCodeNode.addProperty(currCldsVfKpiData.getNfNamingValue(), currCldsVfKpiData.getNfNamingValue());\r
+                    thresholdNameObjectNode.add("fieldPath", fieldPathObjectNode);\r
+                    thresholdNameObjectNode.add("nfNamingCode", nfNamingCodeNode);\r
+                    vfResourceUuidObjectNode.add(currCldsVfKpiData.getThresholdValue(), thresholdNameObjectNode);\r
                 }\r
             }\r
         }\r
     }\r
 \r
-    private void createAlarmCondObjectNodeByVfcUuid(ObjectMapper mapper, ObjectNode vfcResourceUuidObjectNode,\r
-            List<CldsVfcData> cldsVfcDataList) {\r
-        ObjectNode vfcObjectNode = mapper.createObjectNode();\r
-        ObjectNode alarmCondNode = mapper.createObjectNode();\r
-        ObjectNode alertDescNode = mapper.createObjectNode();\r
+    private void createAlarmCondObjectNodeByVfcUuid(JsonObject vfcResourceUuidObjectNode,\r
+        List<CldsVfcData> cldsVfcDataList) {\r
+        JsonObject vfcObjectNode = new JsonObject();\r
+        JsonObject alarmCondNode = new JsonObject();\r
+        JsonObject alertDescNode = new JsonObject();\r
         if (cldsVfcDataList != null && !cldsVfcDataList.isEmpty()) {\r
             for (CldsVfcData currCldsVfcData : cldsVfcDataList) {\r
                 if (currCldsVfcData != null) {\r
                     if (currCldsVfcData.getCldsAlarmConditions() != null\r
-                            && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) {\r
+                        && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) {\r
                         for (CldsAlarmCondition currCldsAlarmCondition : currCldsVfcData.getCldsAlarmConditions()) {\r
                             if ("alarmCondition".equalsIgnoreCase(currCldsAlarmCondition.getEventName())) {\r
-                                alarmCondNode.put(currCldsAlarmCondition.getAlarmConditionKey(),\r
-                                        currCldsAlarmCondition.getAlarmConditionKey());\r
+                                alarmCondNode.addProperty(currCldsAlarmCondition.getAlarmConditionKey(),\r
+                                    currCldsAlarmCondition.getAlarmConditionKey());\r
                             } else {\r
-                                alertDescNode.put(currCldsAlarmCondition.getAlarmConditionKey(),\r
-                                        currCldsAlarmCondition.getAlarmConditionKey());\r
+                                alertDescNode.addProperty(currCldsAlarmCondition.getAlarmConditionKey(),\r
+                                    currCldsAlarmCondition.getAlarmConditionKey());\r
                             }\r
                         }\r
                     }\r
-                    vfcObjectNode.putPOJO("alarmCondition", alarmCondNode);\r
-                    vfcObjectNode.putPOJO("alertDescription", alertDescNode);\r
-                    vfcResourceUuidObjectNode.putPOJO(currCldsVfcData.getVfcInvariantResourceUUID(), vfcObjectNode);\r
+                    vfcObjectNode.add("alarmCondition", alarmCondNode);\r
+                    vfcObjectNode.add("alertDescription", alertDescNode);\r
+                    vfcResourceUuidObjectNode.add(currCldsVfcData.getVfcInvariantResourceUUID(), vfcObjectNode);\r
                 }\r
             }\r
         } else {\r
-            alarmCondNode.put("", "");\r
-            vfcObjectNode.putPOJO("alarmCondition", alarmCondNode);\r
-            alertDescNode.put("", "");\r
-            vfcObjectNode.putPOJO("alertDescription", alarmCondNode);\r
-            vfcResourceUuidObjectNode.putPOJO("", vfcObjectNode);\r
+            alarmCondNode.addProperty("", "");\r
+            vfcObjectNode.add("alarmCondition", alarmCondNode);\r
+            alertDescNode.addProperty("", "");\r
+            vfcObjectNode.add("alertDescription", alarmCondNode);\r
+            vfcResourceUuidObjectNode.add("", vfcObjectNode);\r
         }\r
     }\r
 \r
     /**\r
      * Method to create vfc and kpi nodes inside vf node\r
-     * \r
+     *\r
      * @param mapper\r
      * @param cldsVfDataList\r
      * @return\r
      */\r
-    private ObjectNode createVfcObjectNodeByVfUuid(ObjectMapper mapper, List<CldsVfData> cldsVfDataList) {\r
-        ObjectNode vfUuidObjectNode = mapper.createObjectNode();\r
+    private JsonObject createVfcObjectNodeByVfUuid(List<CldsVfData> cldsVfDataList) {\r
+        JsonObject vfUuidObjectNode = new JsonObject();\r
         if (cldsVfDataList != null && !cldsVfDataList.isEmpty()) {\r
             for (CldsVfData currCldsVfData : cldsVfDataList) {\r
                 if (currCldsVfData != null) {\r
-                    ObjectNode vfObjectNode = mapper.createObjectNode();\r
-                    ObjectNode vfcUuidNode = mapper.createObjectNode();\r
-                    ObjectNode kpiObjectNode = mapper.createObjectNode();\r
+                    JsonObject vfObjectNode = new JsonObject();\r
+                    JsonObject vfcUuidNode = new JsonObject();\r
+                    JsonObject kpiObjectNode = new JsonObject();\r
                     if (currCldsVfData.getCldsVfcs() != null && !currCldsVfData.getCldsVfcs().isEmpty()) {\r
                         for (CldsVfcData currCldsVfcData : currCldsVfData.getCldsVfcs()) {\r
                             if (currCldsVfcData.getCldsAlarmConditions() != null\r
-                                    && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) {\r
-                                vfcUuidNode.put(currCldsVfcData.getVfcInvariantResourceUUID(),\r
-                                        currCldsVfcData.getVfcName());\r
+                                && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) {\r
+                                vfcUuidNode.addProperty(currCldsVfcData.getVfcInvariantResourceUUID(),\r
+                                    currCldsVfcData.getVfcName());\r
                             }\r
                         }\r
                     } else {\r
-                        vfcUuidNode.put("", "");\r
+                        vfcUuidNode.addProperty("", "");\r
                     }\r
                     if (currCldsVfData.getCldsKPIList() != null && !currCldsVfData.getCldsKPIList().isEmpty()) {\r
                         for (CldsVfKPIData currCldsVfKPIData : currCldsVfData.getCldsKPIList()) {\r
-                            kpiObjectNode.put(currCldsVfKPIData.getThresholdValue(),\r
-                                    currCldsVfKPIData.getThresholdValue());\r
+                            // ToDo: something wrong happened here\r
+                            kpiObjectNode.addProperty(currCldsVfKPIData.getThresholdValue(),\r
+                                currCldsVfKPIData.getThresholdValue());\r
                         }\r
                     } else {\r
-                        kpiObjectNode.put("", "");\r
+                        kpiObjectNode.addProperty("", "");\r
                     }\r
-                    vfObjectNode.putPOJO("vfc", vfcUuidNode);\r
-                    vfObjectNode.putPOJO("kpi", kpiObjectNode);\r
-                    vfUuidObjectNode.putPOJO(currCldsVfData.getVfInvariantResourceUUID(), vfObjectNode);\r
+                    vfObjectNode.add("vfc", vfcUuidNode);\r
+                    vfObjectNode.add("kpi", kpiObjectNode);\r
+                    vfUuidObjectNode.add(currCldsVfData.getVfInvariantResourceUUID(), vfObjectNode);\r
                 }\r
             }\r
         } else {\r
-            ObjectNode vfcUuidNode = mapper.createObjectNode();\r
-            vfcUuidNode.put("", "");\r
-            ObjectNode vfcObjectNode = mapper.createObjectNode();\r
-            vfcObjectNode.putPOJO("vfc", vfcUuidNode);\r
-            vfUuidObjectNode.putPOJO("", vfcObjectNode);\r
+            JsonObject vfcUuidNode = new JsonObject();\r
+            vfcUuidNode.addProperty("", "");\r
+            JsonObject vfcObjectNode = new JsonObject();\r
+            vfcObjectNode.add("vfc", vfcUuidNode);\r
+            vfUuidObjectNode.add("", vfcObjectNode);\r
         }\r
         return vfUuidObjectNode;\r
     }\r
 \r
-    /**\r
-     * This method searches the equivalent artifact UUID for a specific\r
-     * artifactName in a SdcServiceDetail.\r
-     * \r
-     * @param cldsSdcServiceDetail\r
-     *            The SdcServiceDetail that will be analyzed\r
-     * @param artifactName\r
-     *            The artifact name that will be searched\r
-     * @return The artifact UUID found\r
-     */\r
-    public String getArtifactIdIfArtifactAlreadyExists(CldsSdcServiceDetail 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
-                if (artifactExists) {\r
-                    break;\r
-                }\r
-                if (currCldsSdcResource != null && currCldsSdcResource.getArtifacts() != null\r
-                        && !currCldsSdcResource.getArtifacts().isEmpty()) {\r
-                    for (CldsSdcArtifact currCldsSdcArtifact : currCldsSdcResource.getArtifacts()) {\r
-                        if (currCldsSdcArtifact != null && currCldsSdcArtifact.getArtifactName() != null\r
-                                && currCldsSdcArtifact.getArtifactName().equalsIgnoreCase(artifactName)) {\r
-                            artifactUuid = currCldsSdcArtifact.getArtifactUUID();\r
-                            artifactExists = true;\r
-                            break;\r
-                        }\r
-                    }\r
-                }\r
-            }\r
-        }\r
-        return artifactUuid;\r
-    }\r
-\r
-    /**\r
-     * To get all sdc VF/VFC Resources basic info.\r
-     * \r
-     * @param resourceType\r
-     *            The resourceType\r
-     * @return The list of CldsSdcResourceBasicInfo\r
-     * @throws GeneralSecurityException\r
-     *             In case of issue when decryting the SDC password\r
-     * \r
-     */\r
-    private List<CldsSdcResourceBasicInfo> getAllSdcVForVfcResourcesBasedOnResourceType(String resourceType)\r
-            throws GeneralSecurityException {\r
+    // To get all sdc VF/VFC Resources basic info.\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, false);\r
+        String allSdcVfcResources = getCldsServicesOrResourcesBasedOnURL(resourceUrl);\r
         return removeDuplicateSdcResourceBasicInfo(getAllSdcResourcesListFromJson(allSdcVfcResources));\r
     }\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
+                    && currResource.getInvariantUUID().equalsIgnoreCase(resourceInvariantUuid)) {\r
                     resourceUuid = currResource.getUuid();\r
                     break;\r
                 }\r
@@ -1227,79 +1047,4 @@ public class SdcCatalogServices {
         }\r
         return resourceUuid;\r
     }\r
-\r
-    /**\r
-     * Method to get service invariant uuid from model properties.\r
-     * \r
-     * @param props\r
-     *            The Clds model properties\r
-     * @return The Service Id\r
-     */\r
-    private String getServiceInvariantUuidFromProps(ModelProperties props) {\r
-        String invariantUuid = "";\r
-        Global globalProps = props.getGlobal();\r
-        if (globalProps != null && globalProps.getService() != null) {\r
-            invariantUuid = globalProps.getService();\r
-        }\r
-        return invariantUuid;\r
-    }\r
-\r
-    /**\r
-     * This method upload the BluePrint to SDC.\r
-     * \r
-     * @param prop\r
-     *            The Clds model Properties\r
-     * @param userid\r
-     *            The user id for SDC\r
-     * @param sdcReqUrlsList\r
-     *            The list of SDC URL to try\r
-     * @param formattedSdcReq\r
-     *            The blueprint to upload\r
-     * @param formattedSdcLocationReq\r
-     *            THe location Blueprint to upload\r
-     * @param artifactName\r
-     *            The artifact name from where we can get the Artifact UUID\r
-     * @param locationArtifactName\r
-     *            The location artifact name from where we can get the Artifact\r
-     *            UUID\r
-     * @throws GeneralSecurityException\r
-     *             In case of issues with the decryting the encrypted password\r
-     * @throws DecoderException\r
-     *             In case of issues with the decoding of the Hex String\r
-     */\r
-    public void uploadToSdc(ModelProperties prop, String userid, List<String> sdcReqUrlsList, String formattedSdcReq,\r
-            String formattedSdcLocationReq, String artifactName, String locationArtifactName)\r
-            throws GeneralSecurityException, DecoderException {\r
-        logger.info("userid=" + userid);\r
-        String serviceInvariantUuid = getServiceInvariantUuidFromProps(prop);\r
-        if (sdcReqUrlsList != null && !sdcReqUrlsList.isEmpty()) {\r
-            for (String url : sdcReqUrlsList) {\r
-                if (url != null) {\r
-                    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
-                    String uploadedArtifactUuid = getArtifactIdIfArtifactAlreadyExists(cldsSdcServiceDetail,\r
-                            artifactName);\r
-                    // Upload artifacts to sdc\r
-                    String updateUrl = uploadedArtifactUuid != null ? url + "/" + uploadedArtifactUuid : url;\r
-                    String responseStr = uploadArtifactToSdc(prop, userid, updateUrl, formattedSdcReq);\r
-                    logger.info("value of sdc Response of uploading to sdc :" + responseStr);\r
-                    String updatedServiceUuid = getServiceUuidFromServiceInvariantId(serviceInvariantUuid);\r
-                    if (!originalServiceUuid.equalsIgnoreCase(updatedServiceUuid)) {\r
-                        url = url.replace(originalServiceUuid, updatedServiceUuid);\r
-                    }\r
-                    logger.info("ServiceUUID used after upload in ulr:" + updatedServiceUuid);\r
-                    sdcServicesInformation = getSdcServicesInformation(updatedServiceUuid);\r
-                    cldsSdcServiceDetail = getCldsSdcServiceDetailFromJson(sdcServicesInformation);\r
-                    uploadedArtifactUuid = getArtifactIdIfArtifactAlreadyExists(cldsSdcServiceDetail,\r
-                            locationArtifactName);\r
-                    // To send location information also to sdc\r
-                    updateUrl = uploadedArtifactUuid != null ? url + "/" + uploadedArtifactUuid : url;\r
-                    responseStr = uploadArtifactToSdc(prop, userid, updateUrl, formattedSdcLocationReq);\r
-                    logger.info("value of sdc Response of uploading location to sdc :" + responseStr);\r
-                }\r
-            }\r
-        }\r
-    }\r
 }\r