Remove globalClds.properties
[clamp.git] / src / main / java / org / onap / clamp / clds / client / req / sdc / SdcCatalogServices.java
index 5664653..fd7d096 100644 (file)
@@ -72,6 +72,7 @@ import org.onap.clamp.clds.model.sdc.SdcResource;
 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.LoggingUtils;\r
 import org.springframework.beans.factory.annotation.Autowired;\r
@@ -840,11 +841,13 @@ 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
+        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
@@ -886,28 +889,13 @@ public class SdcCatalogServices {
                     "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("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