Fixed component display name retrieval for nested 91/11891/1
authorkaty.rotman <katy.rotman@amdocs.com>
Tue, 12 Sep 2017 08:03:25 +0000 (11:03 +0300)
committerkaty.rotman <katy.rotman@amdocs.com>
Tue, 12 Sep 2017 08:23:28 +0000 (11:23 +0300)
Change-Id: I77d9f2755d55a03d969c8f85d2b1a4b0ba9b306f
Issue-ID: SDC-311
Signed-off-by: katy.rotman <katy.rotman@amdocs.com>
openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricher.java

index 32df165..a7762e8 100644 (file)
@@ -77,7 +77,7 @@ public class AbstractSubstituteToscaEnricher {
           if (toscaAnalyzerService.isTypeOf(nodeTemplate, VFC_ABSTRACT_SUBSTITUTE, serviceTemplate,
               toscaModel)) {
 
-            String componentDisplayName = getComponentDisplayName(nodeTemplateId);
+            String componentDisplayName = getComponentDisplayName(nodeTemplateId, nodeTemplate);
 
             setProperty(nodeTemplate, VM_TYPE_TAG, componentDisplayName);
 
@@ -157,7 +157,7 @@ public class AbstractSubstituteToscaEnricher {
           if (toscaAnalyzerService.isTypeOf(nodeTemplate, VFC_ABSTRACT_SUBSTITUTE, serviceTemplate,
               toscaModel)) {
 
-            String componentDisplayName = getComponentDisplayName(nodeTemplateId);
+            String componentDisplayName = getComponentDisplayName(nodeTemplateId, nodeTemplate);
 
             if (componentDisplayNameToNodeTempalteIds.containsKey(componentDisplayName)) {
               componentDisplayNameToNodeTempalteIds.get(componentDisplayName).add(nodeTemplateId);
@@ -206,12 +206,17 @@ public class AbstractSubstituteToscaEnricher {
       nodeTemplate.setRequirements(requirements);
   }
 
-  private String getComponentDisplayName(String nodeTemplateId ) {
+  private String getComponentDisplayName(String nodeTemplateId, NodeTemplate nodeTemplate) {
     String componentDisplayName = null;
     if (nodeTemplateId.contains(ABSTRACT_NODE_TEMPLATE_ID_PREFIX)) {
       String removedPrefix = nodeTemplateId.split(ABSTRACT_NODE_TEMPLATE_ID_PREFIX)[1];
       final String[] removedSuffix = removedPrefix.split("_\\d");
       componentDisplayName = removedSuffix[0];
+    } else {
+      final String type = nodeTemplate.getType();
+      final String[] splitted = type.split("\\.");
+      componentDisplayName = splitted[splitted.length - 1];
+
     }
     return componentDisplayName;
   }