diff options
author | romaingimbert <romain.gimbert@orange.com> | 2018-04-25 10:44:26 +0200 |
---|---|---|
committer | romaingimbert <romain.gimbert@orange.com> | 2018-04-25 10:44:26 +0200 |
commit | 762e0e044b08bb318438b91c38de8d8bf59f6219 (patch) | |
tree | d0ea048de74a057646806f606f89ecfdef76b6fb /src | |
parent | 198f189099a0754f6ef53c180f4d6415728828e4 (diff) |
string "null" in temp tosca file
- change uuid to id
Change-Id: I3eabf0f9eedef18585d0fef00a83ab246f7117ef
Issue-ID: EXTAPI-73
Signed-off-by: romaingimbert <romain.gimbert@orange.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java b/src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java index cfe8d82..0503e34 100644 --- a/src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java @@ -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; |