From ffce2fdab1c5f6efff795107ef7756d2e9fdcf57 Mon Sep 17 00:00:00 2001 From: KrupaNagabhushan Date: Wed, 9 Jun 2021 22:11:46 +0100 Subject: Refactor Substitution filters structure The refactor removes unnecessary component id from the substitution filters structure, as the substitution filters belongs to and only to the component. This also avoid any copying issues during the new version creation, as there is not need to update the structure with a new component id. Issue-ID: SDC-3619 Signed-off-by: KrupaNagabhushan Change-Id: Ibcfd9be0c8ceb95d5c1c3bd3f21c3dec26c398f7 --- .../be/datamodel/utils/UiComponentDataConverter.java | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'catalog-be/src/main/java/org') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java index 8439ffbefd..706f7a7304 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java @@ -50,7 +50,6 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.tosca.utils.NodeFilterConverter; import org.openecomp.sdc.be.tosca.utils.SubstitutionFilterConverter; -import org.openecomp.sdc.be.ui.model.UINodeFilter; import org.openecomp.sdc.be.ui.model.UiComponentDataTransfer; import org.openecomp.sdc.be.ui.model.UiComponentMetadata; import org.openecomp.sdc.be.ui.model.UiResourceDataTransfer; @@ -177,10 +176,11 @@ public class UiComponentDataConverter { } private void setSubstitutionFilter(final UiComponentDataTransfer dataTransfer, final Component component) { - if (component.getSubstitutionFilterComponents() == null) { - dataTransfer.setSubstitutionFilter(null); + if (component.getSubstitutionFilter() == null) { + dataTransfer.setSubstitutionFilters(null); } else { - dataTransfer.setSubstitutionFilter(component.getSubstitutionFilterComponents()); + final SubstitutionFilterConverter substitutionFilterConverter = new SubstitutionFilterConverter(); + dataTransfer.setSubstitutionFilters(substitutionFilterConverter.convertToUi(component.getSubstitutionFilter())); } } @@ -387,12 +387,10 @@ public class UiComponentDataConverter { break; case SUBSTITUTION_FILTER: if (resource.getSubstitutionFilter() == null) { - dataTransfer.setSubstitutionFilterForTopologyTemplate(null); + dataTransfer.setSubstitutionFilters(null); } else { final SubstitutionFilterConverter substitutionFilterConverter = new SubstitutionFilterConverter(); - final Map filterUiMap = new HashMap<>(); - filterUiMap.put(resource.getUniqueId(), substitutionFilterConverter.convertToUi(resource.getSubstitutionFilter())); - dataTransfer.setSubstitutionFilterForTopologyTemplate(filterUiMap); + dataTransfer.setSubstitutionFilters(substitutionFilterConverter.convertToUi(resource.getSubstitutionFilter())); } break; case NODE_FILTER: @@ -458,12 +456,10 @@ public class UiComponentDataConverter { break; case SUBSTITUTION_FILTER: if (service.getSubstitutionFilter() == null) { - dataTransfer.setSubstitutionFilterForTopologyTemplate(null); + dataTransfer.setSubstitutionFilters(null); } else { final SubstitutionFilterConverter substitutionFilterConverter = new SubstitutionFilterConverter(); - final Map filterUiMap = new HashMap<>(); - filterUiMap.put(service.getUniqueId(), substitutionFilterConverter.convertToUi(service.getSubstitutionFilter())); - dataTransfer.setSubstitutionFilterForTopologyTemplate(filterUiMap); + dataTransfer.setSubstitutionFilters(substitutionFilterConverter.convertToUi(service.getSubstitutionFilter())); } break; default: -- cgit 1.2.3-korg