summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main
diff options
context:
space:
mode:
authorimamSidero <imam.hussain@est.tech>2022-09-20 16:29:19 +0100
committerMichael Morris <michael.morris@est.tech>2022-10-04 18:05:23 +0000
commitca487f60c2ca67794b16c0ff0cf5cc6deca556fc (patch)
tree3c80107f0c38eb1e4481128e376839743ebba067 /catalog-be/src/main
parentd073b803991a841ee8fef40aa0c3dd3febbd8e56 (diff)
Fix for VFC version update on composition window
On add service - composition window VFC version update/change is fixed by mapping appropriate requirements and capabilities Issue-ID: SDC-4185 Signed-off-by: Imam hussain <imam.hussain@est.tech> Change-Id: I0de616510ca27c511179f1f34cf7290cd584c7c5
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java47
1 files changed, 22 insertions, 25 deletions
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 ac01be010d..1d10c92313 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
@@ -3068,39 +3068,36 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic {
}
private void checkForExternalReqAndCapabilities(Component component, ComponentInstance resResourceInfo) {
- Map<String, List<RequirementDefinition>> requirementsMap = resResourceInfo.getRequirements();
- Map<String, List<RequirementDefinition>> externalRequirementsMap = new HashMap<>();
- List<RequirementDefinition> externalRequirementList = new ArrayList<>();
- if (requirementsMap != null && !requirementsMap.isEmpty()) {
- requirementsMap.forEach((type, requirementDefinitions) -> {
- if (requirementDefinitions != null && !requirementDefinitions.isEmpty()) {
- for (final RequirementDefinition requirementDefinition : requirementDefinitions) {
- if (requirementDefinition.isExternal()) {
- externalRequirementList.add(requirementDefinition);
- externalRequirementsMap.put(type, externalRequirementList);
- }
+ if (MapUtils.isNotEmpty(component.getRequirements())) {
+ component.getRequirements().entrySet().forEach(requirementsMap -> {
+ if (MapUtils.isNotEmpty(resResourceInfo.getRequirements()) && resResourceInfo.getRequirements().containsKey(requirementsMap.getKey())) {
+ List<RequirementDefinition> resourceReqList = resResourceInfo.getRequirements().get(requirementsMap.getKey());
+ for (RequirementDefinition requirements : requirementsMap.getValue()) {
+ String requirementName = requirements.getName();
+ resourceReqList.forEach(requirementDefinition -> {
+ if (requirementName.equals(requirementDefinition.getName()) && requirementDefinition.isExternal()) {
+ requirements.setExternal(requirementDefinition.isExternal());
+ }
+ });
}
}
});
}
-
- Map<String, List<CapabilityDefinition>> capabilitiesMap = resResourceInfo.getCapabilities();
- Map<String, List<CapabilityDefinition>> externalCapabilitiesMap = new HashMap<>();
- List<CapabilityDefinition> externalCapabilitiesList = new ArrayList<>();
- if (capabilitiesMap != null && !capabilitiesMap.isEmpty()) {
- capabilitiesMap.forEach((type, capabilityDefinitions) -> {
- if (capabilityDefinitions != null && !capabilityDefinitions.isEmpty()) {
- for (final CapabilityDefinition capabilityDefinition : capabilityDefinitions) {
- if (capabilityDefinition.isExternal()) {
- externalCapabilitiesList.add(capabilityDefinition);
- externalCapabilitiesMap.put(type, externalCapabilitiesList);
+ if (MapUtils.isNotEmpty(component.getCapabilities())) {
+ component.getCapabilities().entrySet().forEach(capabilityMap -> {
+ if (MapUtils.isNotEmpty(resResourceInfo.getCapabilities()) && resResourceInfo.getCapabilities().containsKey(capabilityMap.getKey())) {
+ List<CapabilityDefinition> resourceCapList = resResourceInfo.getCapabilities().get(capabilityMap.getKey());
+ capabilityMap.getValue().forEach(capabilities -> {
+ String capabilityName = capabilities.getName();
+ for (CapabilityDefinition capDef : resourceCapList) {
+ if (capabilityName.equals(capDef.getName()) && capDef.isExternal()) {
+ capabilities.setExternal(capDef.isExternal());
+ }
}
- }
+ });
}
});
}
- component.setCapabilities(externalCapabilitiesMap);
- component.setRequirements(externalRequirementsMap);
}
private boolean isFillProxyRes(StorageOperationStatus fillProxyRes) {