+ if (!errorWrapper.isEmpty()) {
+ return buildErrorResponse(errorWrapper.getInnerElement());
+ }
+ log.debug(START_HANDLE_REQUEST_OF_UPDATE_RESOURCE_INSTANCE_ATTRIBUTE_RECEIVED_ATTRIBUTE_IS, attributesToUpdate);
+ final ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(containerComponentType);
+ if (componentInstanceBusinessLogic == null) {
+ log.debug(UNSUPPORTED_COMPONENT_TYPE, containerComponentType);
+ return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.UNSUPPORTED_ERROR, containerComponentType));
+ }
+ final Either<List<ComponentInstanceAttribute>, ResponseFormat> actionResponse = componentInstanceBusinessLogic
+ .createOrUpdateAttributeValues(componentTypeEnum, componentId, componentInstanceId, attributesToUpdate, userId);
+ if (actionResponse.isRight()) {
+ return buildErrorResponse(actionResponse.right().value());
+ }
+ final List<ComponentInstanceAttribute> resourceInstanceAttributes = actionResponse.left().value();
+ final ObjectMapper mapper = new ObjectMapper();
+ String result;
+ loggerSupportability.log(LoggerSupportabilityActions.UPDATE_COMPONENT_INSTANCE, StatusCode.COMPLETE,
+ "Ended update Resource Instance Attributes for component {} ", componentId + " by " + userId);
+ try {
+ result = mapper.writeValueAsString(resourceInstanceAttributes);
+ } catch (JsonProcessingException e) {
+ log.error(UPDATE_RESOURCE_INSTANCE_WITH_EXCEPTION, e.getMessage(), e);
+ throw new ByActionStatusComponentException(ActionStatus.GENERAL_ERROR);
+ }
+ loggerSupportability.log(LoggerSupportabilityActions.UPDATE_COMPONENT_INSTANCE, StatusCode.COMPLETE,
+ "Ended update Resource Instance Attributes for component {} ", componentId + " by user " + userId);
+ return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), result);