From 6a6795ce77219b28f18a3572ae89c8cb4d4406be Mon Sep 17 00:00:00 2001 From: franciscovila Date: Thu, 23 Jun 2022 09:33:08 +0100 Subject: Maintain VFC instance directives and node filters Maintain VFC directives and node filters on instance version change Issue-ID: SDC-4062 Signed-off-by: franciscovila Change-Id: I90e8d4e5f8262879fb533389a93e2fdfa052caad --- .../components/impl/ComponentInstanceBusinessLogic.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'catalog-be/src/main/java') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java index dcccfd961d..76db103525 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java @@ -2990,6 +2990,7 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { newComponentInstance.setInstanceCount(resResourceInfo.getInstanceCount()); newComponentInstance.setMaxOccurrences(resResourceInfo.getMaxOccurrences()); newComponentInstance.setMinOccurrences(resResourceInfo.getMinOccurrences()); + newComponentInstance.setDirectives(resResourceInfo.getDirectives()); checkForExternalReqAndCapabilities(origComponent, resResourceInfo); ComponentInstance updatedComponentInstance = @@ -3014,6 +3015,9 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { log.debug("Component with id {} was not found", containerComponentId); throw new ByActionStatusComponentException(actionStatus, Constants.EMPTY_STRING); } + + maintainNodeFilters(currentResourceInstance, newComponentInstance, containerComponentId); + resourceInstanceStatus = getResourceInstanceById(updatedComponentRes.left().value(), updatedComponentInstance.getUniqueId()); if (resourceInstanceStatus.isRight()) { @@ -3030,6 +3034,19 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } } + private void maintainNodeFilters( + ComponentInstance currentResourceInstance, + ComponentInstance newComponentInstance, + String containerComponentId) { + CINodeFilterDataDefinition filterToMaintain = currentResourceInstance.getNodeFilter(); + if (null != filterToMaintain) { + nodeFilterOperation.addNodeFilterData( + containerComponentId.toLowerCase(), + newComponentInstance.getUniqueId(), + filterToMaintain); + } + } + private void checkForExternalReqAndCapabilities(Component component, ComponentInstance resResourceInfo) { Map> requirementsMap = resResourceInfo.getRequirements(); Map> externalRequirementsMap = new HashMap<>(); -- cgit 1.2.3-korg