diff options
author | andre.schmid <andre.schmid@est.tech> | 2022-06-02 16:34:57 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2022-06-07 13:10:52 +0000 |
commit | 80c2cf3c70db2605eb9c2e28515a73567f3404ee (patch) | |
tree | ddec78db9cd3f90ce9af1ff0e747cb97573b677e /catalog-be/src/main | |
parent | 90d6e2ddd348afd42b08d66c6e2308c63535e8de (diff) |
Support get functions in composition property modal
Allow to assign get functions values to properties in the composition
properties modal.
Change-Id: I470be63e2980994f43be255d8056af7392baab75
Issue-ID: SDC-4031
Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java | 21 |
1 files changed, 8 insertions, 13 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 2caa721b5e..ec4535a27d 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 @@ -1957,8 +1957,7 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { try { for (ComponentInstanceProperty property : properties) { validateMandatoryFields(property); - ComponentInstanceProperty componentInstanceProperty = validatePropertyExistsOnComponent(property, containerComponent, - foundResourceInstance); + validatePropertyExistsOnComponent(property, containerComponent, foundResourceInstance); String propertyParentUniqueId = property.getParentUniqueId(); if (property.isGetFunction()) { validateToscaGetFunction(property, containerComponent); @@ -1979,12 +1978,10 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { capPropDefinition.get().getName()), Either::right); } else { updatedPropertyValue.bimap( - updatedValue -> { - componentInstanceProperty.setValue(updatedValue); - return updatePropertyOnContainerComponent(property, updatedValue, - containerComponent, foundResourceInstance); - }, Either::right); - updatedProperties.add(componentInstanceProperty); + updatedValue -> updatePropertyOnContainerComponent(property, updatedValue, containerComponent, foundResourceInstance), + Either::right + ); + updatedProperties.add(property); } } @@ -2107,16 +2104,14 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } } - private ComponentInstanceProperty validatePropertyExistsOnComponent(ComponentInstanceProperty property, Component containerComponent, + private void validatePropertyExistsOnComponent(ComponentInstanceProperty property, Component containerComponent, ComponentInstance foundResourceInstance) { List<ComponentInstanceProperty> instanceProperties = containerComponent.getComponentInstancesProperties() .get(foundResourceInstance.getUniqueId()); - Optional<ComponentInstanceProperty> instanceProperty = instanceProperties.stream().filter(p -> p.getName().equals(property.getName())) - .findAny(); - if (instanceProperty.isEmpty()) { + final boolean hasProperty = instanceProperties.stream().anyMatch(p -> p.getName().equals(property.getName())); + if (!hasProperty) { throw new ByActionStatusComponentException(ActionStatus.PROPERTY_NOT_FOUND, property.getName()); } - return instanceProperty.get(); } private ComponentInstanceAttribute validateAttributeExistsOnComponent(final ComponentInstanceAttribute attribute, |