From 3d79660270cc259688e0ba20150286c1680c7559 Mon Sep 17 00:00:00 2001 From: imamSidero Date: Mon, 24 Oct 2022 17:20:46 +0100 Subject: Add default baseType to the substitution type Enabling default baseType in substitution type to be selected Issue-ID: SDC-4229 Signed-off-by: Imam hussain Change-Id: I869ede4c4e030adc3c4418c28ed787b4c10248dd --- .../sdc/be/model/operations/api/IElementOperation.java | 2 ++ .../sdc/be/model/operations/impl/ElementOperation.java | 12 ++++++++++++ 2 files changed, 14 insertions(+) (limited to 'catalog-model/src/main') diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IElementOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IElementOperation.java index ebc563268e..e942ee1fde 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IElementOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IElementOperation.java @@ -96,6 +96,8 @@ public interface IElementOperation { */ boolean isBaseTypeRequired(String categoryName); + String getDefaultBaseType(String categoryName); + Either getCategory(NodeTypeEnum nodeType, String categoryId); Either getSubCategoryUniqueForType(NodeTypeEnum nodeType, String normalizedName); diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ElementOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ElementOperation.java index 127d778f73..bf74a264f8 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ElementOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ElementOperation.java @@ -426,6 +426,18 @@ public class ElementOperation implements IElementOperation { private Configuration getConfiguration() { return ConfigurationManager.getConfigurationManager().getConfiguration(); } + @Override + public String getDefaultBaseType(final String categoryName) { + final Map categoriesSpecificBaseTypeMap = getConfiguration().getServiceBaseNodeTypes(); + if (MapUtils.isEmpty(categoriesSpecificBaseTypeMap)) { + return null; + } + final CategoryBaseTypeConfig categoryBaseTypeConfig = categoriesSpecificBaseTypeMap.get(categoryName); + if (categoryBaseTypeConfig == null) { + return null; + } + return categoryBaseTypeConfig.getDefaultBaseType(); + } @Override public boolean isBaseTypeRequired(final String categoryName) { -- cgit 1.2.3-korg