From 43ffce5d0d30872446c51afaf786d5cfad4378be Mon Sep 17 00:00:00 2001 From: imamSidero Date: Tue, 24 Jan 2023 16:03:54 +0000 Subject: Provide add/edit constraints capability to inputs in properties page Providing the capability to add or edit constraints to inputs in properies of a service Issue-ID: SDC-4346 Signed-off-by: Imam hussain Change-Id: I56261441022751a191fe057aafa4c681c8db96c5 --- .../java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java | 3 +++ .../org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'catalog-be/src') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java index 21327ea29d..44fecb311b 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java @@ -308,6 +308,9 @@ public class InputsBusinessLogic extends BaseBusinessLogic { currInput.setDefaultValue(updateInputObjectValue); currInput.setOwnerId(userId); currInput.setMetadata(newInput.getMetadata()); + if (newInput.getConstraints() != null) { + currInput.setConstraints(newInput.getConstraints()); + } if (newInput.isRequired() != null) { currInput.setRequired(newInput.isRequired()); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java index 2cccc31ded..f5db6be6bd 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java @@ -2113,7 +2113,8 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { } Service service = serviceResultEither.left().value(); if (dataParamsToReturn.contains(ComponentFieldsEnum.INPUTS.getValue())) { - ListUtils.emptyIfNull(service.getInputs()).forEach(input -> input.setConstraints(setInputConstraint(input))); + ListUtils.emptyIfNull(service.getInputs()).stream().filter(input -> CollectionUtils.isEmpty(input.getConstraints())) + .forEach(input -> input.setConstraints(setInputConstraint(input))); } UiComponentDataTransfer dataTransfer = uiComponentDataConverter.getUiDataTransferFromServiceByParams(service, dataParamsToReturn); return Either.left(dataTransfer); -- cgit 1.2.3-korg