string "null" in temp tosca file 29/44629/1
authorromaingimbert <romain.gimbert@orange.com>
Wed, 25 Apr 2018 08:44:26 +0000 (10:44 +0200)
committerromaingimbert <romain.gimbert@orange.com>
Wed, 25 Apr 2018 08:44:26 +0000 (10:44 +0200)
- change uuid to id

Change-Id: I3eabf0f9eedef18585d0fef00a83ab246f7117ef
Issue-ID: EXTAPI-73
Signed-off-by: romaingimbert <romain.gimbert@orange.com>
src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java

index cfe8d82..0503e34 100644 (file)
@@ -78,13 +78,14 @@ public class ToscaInfosProcessor {
         List<LinkedHashMap> resourceSpecifications =
                 (List<LinkedHashMap>) serviceCatalogResponse.get("resourceSpecification");
         for (LinkedHashMap resourceSpecification : resourceSpecifications) {
-            String id = (String) resourceSpecification.get("id");
-            LOGGER.debug("get tosca infos for service id: {0}", id);
-            LinkedHashMap toscaInfosFromResourceId = getToscaInfosFromResourceUUID(nodeTemplate, id);
-            if (toscaInfosFromResourceId != null) {
-                resourceSpecification.put("modelCustomizationId", toscaInfosFromResourceId.get("customizationUUID"));
+            if(resourceSpecification.get("id")!=null){
+                String id = (String) resourceSpecification.get("id");
+                LOGGER.debug("get tosca infos for service id: {0}", id);
+                LinkedHashMap toscaInfosFromResourceId = getToscaInfosFromResourceUUID(nodeTemplate, id);
+                if (toscaInfosFromResourceId != null && toscaInfosFromResourceId.get("customizationUUID")!=null) {
+                    resourceSpecification.put("modelCustomizationId", toscaInfosFromResourceId.get("customizationUUID"));
+                }
             }
-
         }
     }
 
@@ -133,10 +134,12 @@ public class ToscaInfosProcessor {
             for (Object nodeTemplateObject : node_templates.values()) {
                 LinkedHashMap nodeTemplate = (LinkedHashMap) nodeTemplateObject;
                 LinkedHashMap metadata = (LinkedHashMap) nodeTemplate.get("metadata");
-                String metadataUUID = (String) metadata.get("UUID");
-                String metadataType = (String) metadata.get("type");
-                if ("VF".equalsIgnoreCase(metadataType) && name.equalsIgnoreCase(metadataUUID)) {
-                    return metadata;
+                if(metadata.get("UUID")!=null && metadata.get("type")!=null) {
+                    String metadataUUID = (String) metadata.get("UUID");
+                    String metadataType = (String) metadata.get("type");
+                    if ("VF".equalsIgnoreCase(metadataType) && name!=null &&  name.equalsIgnoreCase(metadataUUID)) {
+                        return metadata;
+                    }
                 }
             }
         }
@@ -149,7 +152,7 @@ public class ToscaInfosProcessor {
         LinkedHashMap topologyTemplate = null;
 
         String toscaModelUrl = (String) sdcResponse.get("toscaModelURL");
-        String serviceId = (String) sdcResponse.get("uuid");
+        String serviceId = (String) sdcResponse.get("id");
         File toscaFile = sdcClient.callGetWithAttachment(toscaModelUrl);
         Timestamp timestamp = new Timestamp(System.currentTimeMillis());
         String tempFolderName = serviceId + timestamp;