To solve the problem that the CSAR file cannot be imported when it is imported on... 28/114228/2
authorzhaoxiangjun666 <xjzhaop@isoftstone.com>
Mon, 26 Oct 2020 01:52:18 +0000 (09:52 +0800)
committerS�bastien Determe <sebastien.determe@intl.att.com>
Mon, 26 Oct 2020 09:26:25 +0000 (09:26 +0000)
Issue-ID: SDC-3332
Change-Id: Ic62a7a3d5681c1a7d18feddd9be8f216a32cd31f
Signed-off-by: zhaoxiangjun666 <xjzhaop@isoftstone.com>
catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java
catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportManager.java
catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java

index 9636885..58f46bc 100644 (file)
@@ -320,7 +320,7 @@ public class YamlTemplateParsingHandler {
                 .left()
                 .on(err -> logGroupsNotFound(fileName));
 
-        if (MapUtils.isNotEmpty(foundGroups)) {
+        if (MapUtils.isNotEmpty(foundGroups) && matcheKey(foundGroups)) {
             Map<String, GroupDefinition> groups = foundGroups
                     .entrySet()
                     .stream()
@@ -336,6 +336,20 @@ public class YamlTemplateParsingHandler {
         return new HashMap<>();
     }
 
+    private boolean matcheKey(Map<String, Object> foundGroups){
+        if (foundGroups!=null && !foundGroups.isEmpty()) {
+            for (Map.Entry<String, Object> stringObjectEntry : foundGroups.entrySet()) {
+                String key = stringObjectEntry.getKey();
+                if (key.contains("group")) {
+                    if (foundGroups.get(key) instanceof Map) {
+                        return true;
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
     private Map<String, Object> logGroupsNotFound(String fileName) {
         log.debug("#logGroupsNotFound - Groups were not found in the yaml template {}.", fileName);
         return new HashMap<>();
index 8e7c1e8..fa079d2 100644 (file)
@@ -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;
index 5b03b63..38e6061 100644 (file)
@@ -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;
     }