From 407bbefe5b0b932f6c6bed65193815c78b4d41b5 Mon Sep 17 00:00:00 2001 From: Satoshi Fujii Date: Wed, 26 Feb 2020 15:39:38 +0900 Subject: Add 'required in runtime' for service inputs User may want to set required to true for some inputs so that make sure those input values are given at service instantiation time. By this change 'required in runtime' column is introduced into service inputs table in Properties Assignment screen and user can select required true/false for each input. Change-Id: I0d676d2d20e02c975d51c7f4d2bb63c699743d66 Issue-ID: SDC-2659 Signed-off-by: Satoshi Fujii --- .../sdc/be/components/impl/InputsBusinessLogic.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'catalog-be/src/main/java') 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 02d6e0b565..6b5878ee4b 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 @@ -93,6 +93,8 @@ public class InputsBusinessLogic extends BaseBusinessLogic { private static final String FAILED_TO_FOUND_INPUT_UNDER_COMPONENT_ERROR = "Failed to found input {} under component {}, error: {}"; private static final String GOING_TO_EXECUTE_ROLLBACK_ON_CREATE_GROUP = "Going to execute rollback on create group."; private static final String GOING_TO_EXECUTE_COMMIT_ON_CREATE_GROUP = "Going to execute commit on create group."; + private static final String GOING_TO_EXECUTE_ROLLBACK_ON_UPDATE_INPUT = "Going to execute rollback on update input."; + private static final String GOING_TO_EXECUTE_COMMIT_ON_UPDATE_INPUT = "Going to execute commit on update input."; public LoggerSupportability loggerSupportability=LoggerSupportability.getLogger(InputsBusinessLogic.class.getName()); private final PropertyDeclarationOrchestrator propertyDeclarationOrchestrator; @@ -307,7 +309,8 @@ public class InputsBusinessLogic extends BaseBusinessLogic { if (shouldLockComp) { try { lockComponent(component, UPDATE_INPUT); - }catch (ComponentException e){ + } catch (ComponentException e) { + log.error("Failed to lock component", e); result = Either.right(e.getResponseFormat()); return result; } @@ -337,6 +340,9 @@ public class InputsBusinessLogic extends BaseBusinessLogic { String updateInputObjectValue = updateInputObjectValue(currInput, newInput, dataTypes); currInput.setDefaultValue(updateInputObjectValue); currInput.setOwnerId(userId); + if (newInput.isRequired() != null) { + currInput.setRequired(newInput.isRequired()); + } Either status = toscaOperationFacade.updateInputOfComponent(component, currInput); if(status.isRight()){ ActionStatus actionStatus = componentsUtils.convertFromStorageResponseForResourceInstanceProperty(status.right().value()); @@ -347,13 +353,14 @@ public class InputsBusinessLogic extends BaseBusinessLogic { } } result = Either.left(returnInputs); - }catch (ComponentException e) { - log.debug(GOING_TO_EXECUTE_ROLLBACK_ON_CREATE_GROUP); + } catch (ComponentException e) { + log.debug(GOING_TO_EXECUTE_ROLLBACK_ON_UPDATE_INPUT); unlockRollbackWithException(component, e); } catch (Exception e){ + log.debug(GOING_TO_EXECUTE_ROLLBACK_ON_UPDATE_INPUT); unlockRollbackWithException(component, new ByActionStatusComponentException(ActionStatus.GENERAL_ERROR)); } - log.debug(GOING_TO_EXECUTE_COMMIT_ON_CREATE_GROUP); + log.debug(GOING_TO_EXECUTE_COMMIT_ON_UPDATE_INPUT); unlockWithCommit(component); return result; -- cgit 1.2.3-korg