From 14d212dc5046d597b8b56ae04fcb545b633b79f6 Mon Sep 17 00:00:00 2001 From: zhaoxiangjun666 Date: Mon, 26 Oct 2020 09:52:18 +0800 Subject: To solve the problem that the CSAR file cannot be imported when it is imported on the page, a 500 error is reported Issue-ID: SDC-3332 Change-Id: Ic62a7a3d5681c1a7d18feddd9be8f216a32cd31f Signed-off-by: zhaoxiangjun666 --- .../be/components/csar/YamlTemplateParsingHandler.java | 16 +++++++++++++++- .../sdc/be/components/impl/ServiceImportManager.java | 8 -------- .../main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java | 6 ++++++ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java index 9636885190..58f46bcfa7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java @@ -320,7 +320,7 @@ public class YamlTemplateParsingHandler { .left() .on(err -> logGroupsNotFound(fileName)); - if (MapUtils.isNotEmpty(foundGroups)) { + if (MapUtils.isNotEmpty(foundGroups) && matcheKey(foundGroups)) { Map groups = foundGroups .entrySet() .stream() @@ -336,6 +336,20 @@ public class YamlTemplateParsingHandler { return new HashMap<>(); } + private boolean matcheKey(Map foundGroups){ + if (foundGroups!=null && !foundGroups.isEmpty()) { + for (Map.Entry stringObjectEntry : foundGroups.entrySet()) { + String key = stringObjectEntry.getKey(); + if (key.contains("group")) { + if (foundGroups.get(key) instanceof Map) { + return true; + } + } + } + } + return false; + } + private Map logGroupsNotFound(String fileName) { log.debug("#logGroupsNotFound - Groups were not found in the yaml template {}.", fileName); return new HashMap<>(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportManager.java index 8e7c1e852c..fa079d2f65 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportManager.java @@ -92,14 +92,6 @@ public class ServiceImportManager { } } - public void populateRealServiceMetadata(UploadServiceInfo serviceMetaData, Service service) { - if (service != null && serviceMetaData != null) { - service.setTags(serviceMetaData.getTags()); - service.setContactId(serviceMetaData.getContactId()); - service.setName(serviceMetaData.getName()); - } - } - public synchronized void init(ServletContext servletContext) { if (this.servletContext == null) { this.servletContext = servletContext; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java index 5b03b6378e..38e60617c4 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java @@ -41,6 +41,12 @@ public class ToscaUtils { if (ResourceTypeEnum.CVFC == resourceType ) { return false; } + if (component.getComponentMetadataDefinition()!=null && component.getComponentMetadataDefinition().getMetadataDataDefinition()!=null + && component.getComponentMetadataDefinition().getMetadataDataDefinition().getDescription()!=null){ + if(component.getComponentMetadataDefinition().getMetadataDataDefinition().getDescription().equalsIgnoreCase("Nested VF in service")){ + return false; + } + } } return true; } -- cgit 1.2.3-korg