From 2804abfedc485ea8f15ff276fe3c8381f9997209 Mon Sep 17 00:00:00 2001 From: "katy.rotman" Date: Tue, 12 Sep 2017 11:03:25 +0300 Subject: Fixed component display name retrieval for nested Change-Id: I77d9f2755d55a03d969c8f85d2b1a4b0ba9b306f Issue-ID: SDC-311 Signed-off-by: katy.rotman --- .../impl/tosca/AbstractSubstituteToscaEnricher.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'openecomp-be') diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricher.java index 32df165eb3..a7762e86ca 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricher.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricher.java @@ -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; } -- cgit 1.2.3-korg