2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.openecomp.sdc.be.servlets;
22 import com.jcabi.aspects.Loggable;
23 import fj.data.Either;
24 import io.swagger.v3.oas.annotations.Operation;
25 import io.swagger.v3.oas.annotations.Parameter;
26 import io.swagger.v3.oas.annotations.media.ArraySchema;
27 import io.swagger.v3.oas.annotations.media.Content;
28 import io.swagger.v3.oas.annotations.media.Schema;
29 import io.swagger.v3.oas.annotations.responses.ApiResponse;
30 import io.swagger.v3.oas.annotations.servers.Server;
31 import io.swagger.v3.oas.annotations.servers.Servers;
32 import io.swagger.v3.oas.annotations.tags.Tag;
33 import io.swagger.v3.oas.annotations.tags.Tags;
34 import javax.inject.Inject;
35 import javax.servlet.ServletContext;
36 import javax.servlet.http.HttpServletRequest;
37 import javax.ws.rs.Consumes;
38 import javax.ws.rs.DELETE;
39 import javax.ws.rs.GET;
40 import javax.ws.rs.HeaderParam;
41 import javax.ws.rs.POST;
42 import javax.ws.rs.PUT;
43 import javax.ws.rs.Path;
44 import javax.ws.rs.PathParam;
45 import javax.ws.rs.Produces;
46 import javax.ws.rs.core.Context;
47 import javax.ws.rs.core.MediaType;
48 import javax.ws.rs.core.Response;
49 import org.openecomp.sdc.be.components.impl.AdditionalInformationBusinessLogic;
50 import org.openecomp.sdc.be.components.impl.aaf.AafPermission;
51 import org.openecomp.sdc.be.components.impl.aaf.PermissionAllowed;
52 import org.openecomp.sdc.be.config.BeEcompErrorManager;
53 import org.openecomp.sdc.be.dao.api.ActionStatus;
54 import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterInfo;
55 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
56 import org.openecomp.sdc.be.impl.ComponentsUtils;
57 import org.openecomp.sdc.be.model.AdditionalInformationDefinition;
58 import org.openecomp.sdc.be.user.UserBusinessLogic;
59 import org.openecomp.sdc.common.api.Constants;
60 import org.openecomp.sdc.common.log.wrappers.Logger;
61 import org.openecomp.sdc.exception.ResponseFormat;
62 import org.springframework.stereotype.Controller;
64 @Loggable(prepend = true, value = Loggable.DEBUG, trim = false)
66 @Tags({@Tag(name = "SDC Internal APIs")})
67 @Servers({@Server(url = "/sdc2/rest")})
69 public class AdditionalInformationServlet extends BeGenericServlet {
71 private static final Logger log = Logger.getLogger(AdditionalInformationServlet.class);
72 private static final String START_HANDLE_REQUEST_OF = "Start handle request of {}";
73 private static final String MODIFIER_ID_IS = "modifier id is {}";
74 private static final String FAILED_TO_UPDATE_ADDITIONAL_INFO_PROPERTY = "Failed to update additional information property. Reason - {}";
75 private final AdditionalInformationBusinessLogic businessLogic;
78 public AdditionalInformationServlet(UserBusinessLogic userBusinessLogic, ComponentsUtils componentsUtils,
79 AdditionalInformationBusinessLogic businessLogic) {
80 super(userBusinessLogic, componentsUtils);
81 this.businessLogic = businessLogic;
92 @Path("/resources/{resourceId}/additionalinfo")
93 @Consumes(MediaType.APPLICATION_JSON)
94 @Produces(MediaType.APPLICATION_JSON)
95 @Operation(description = "Create Additional Information Label and Value", method = "POST", summary = "Returns created Additional Inforamtion property", responses = {
96 @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))),
97 @ApiResponse(responseCode = "201", description = "Additional information created"),
98 @ApiResponse(responseCode = "403", description = "Restricted operation"),
99 @ApiResponse(responseCode = "400", description = "Invalid content / Missing content"),
100 @ApiResponse(responseCode = "409", description = "Additional information key already exist")})
101 @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
102 public Response createResourceAdditionalInformationLabel(
103 @Parameter(description = "resource id to update with new property", required = true) @PathParam("resourceId") final String resourceId,
104 @Parameter(description = "Additional information key value to be created", required = true) String data,
105 @Context final HttpServletRequest request, @HeaderParam(value = Constants.USER_ID_HEADER) String userUserId) {
106 return createAdditionalInformationLabelForComponent(NodeTypeEnum.Resource, resourceId, request, userUserId, data);
117 @Path("/services/{serviceId}/additionalinfo")
118 @Consumes(MediaType.APPLICATION_JSON)
119 @Produces(MediaType.APPLICATION_JSON)
120 @Operation(description = "Create Additional Information Label and Value", method = "POST", summary = "Returns created Additional Inforamtion property", responses = {
121 @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))),
122 @ApiResponse(responseCode = "201", description = "Additional information created"),
123 @ApiResponse(responseCode = "403", description = "Restricted operation"),
124 @ApiResponse(responseCode = "400", description = "Invalid content / Missing content"),
125 @ApiResponse(responseCode = "409", description = "Additional information key already exist")})
126 @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
127 public Response createServiceAdditionalInformationLabel(
128 @Parameter(description = "service id to update with new property", required = true) @PathParam("serviceId") final String serviceId,
129 @Parameter(description = "Additional information key value to be created", required = true) String data,
130 @Context final HttpServletRequest request, @HeaderParam(value = Constants.USER_ID_HEADER) String userUserId) {
131 return createAdditionalInformationLabelForComponent(NodeTypeEnum.Service, serviceId, request, userUserId, data);
143 @Path("/resources/{resourceId}/additionalinfo/{labelId}")
144 @Consumes(MediaType.APPLICATION_JSON)
145 @Produces(MediaType.APPLICATION_JSON)
146 @Operation(description = "Update Additional Information Label and Value", method = "PUT", summary = "Returns updated Additional Inforamtion property", responses = {
147 @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))),
148 @ApiResponse(responseCode = "200", description = "Additional information updated"),
149 @ApiResponse(responseCode = "403", description = "Restricted operation"),
150 @ApiResponse(responseCode = "400", description = "Invalid content / Missing content"),
151 @ApiResponse(responseCode = "409", description = "Additional information key already exist")})
152 @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
153 public Response updateResourceAdditionalInformationLabel(
154 @Parameter(description = "resource id to update with new property", required = true) @PathParam("resourceId") final String resourceId,
155 @Parameter(description = "label id", required = true) @PathParam("labelId") final String labelId,
156 @Parameter(description = "Additional information key value to be created", required = true) String data,
157 @Context final HttpServletRequest request, @HeaderParam(value = Constants.USER_ID_HEADER) String userId) {
158 return updateAdditionalInformationLabelForComponent(NodeTypeEnum.Resource, resourceId, labelId, request, userId, data);
170 @Path("/services/{serviceId}/additionalinfo/{labelId}")
171 @Consumes(MediaType.APPLICATION_JSON)
172 @Produces(MediaType.APPLICATION_JSON)
173 @Operation(description = "Update Additional Information Label and Value", method = "PUT", summary = "Returns updated Additional Inforamtion property", responses = {
174 @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))),
175 @ApiResponse(responseCode = "200", description = "Additional information updated"),
176 @ApiResponse(responseCode = "403", description = "Restricted operation"),
177 @ApiResponse(responseCode = "400", description = "Invalid content / Missing content"),
178 @ApiResponse(responseCode = "409", description = "Additional information key already exist")})
179 @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
180 public Response updateServiceAdditionalInformationLabel(
181 @Parameter(description = "service id to update with new property", required = true) @PathParam("serviceId") final String serviceId,
182 @Parameter(description = "label id", required = true) @PathParam("labelId") final String labelId,
183 @Parameter(description = "Additional information key value to be created", required = true) String data,
184 @Context final HttpServletRequest request, @HeaderParam(value = Constants.USER_ID_HEADER) String userId) {
185 return updateAdditionalInformationLabelForComponent(NodeTypeEnum.Service, serviceId, labelId, request, userId, data);
196 @Path("/resources/{resourceId}/additionalinfo/{labelId}")
197 @Consumes(MediaType.APPLICATION_JSON)
198 @Produces(MediaType.APPLICATION_JSON)
199 @Operation(description = "Create Additional Information Label and Value", method = "DELETE", summary = "Returns deleted Additional Inforamtion property", responses = {
200 @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))),
201 @ApiResponse(responseCode = "200", description = "Additional information deleted"),
202 @ApiResponse(responseCode = "403", description = "Restricted operation"),
203 @ApiResponse(responseCode = "400", description = "Invalid content / Missing content"),
204 @ApiResponse(responseCode = "409", description = "Additional information key already exist")})
205 @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
206 public Response updateResourceAdditionalInformationLabel(
207 @Parameter(description = "resource id to update with new property", required = true) @PathParam("resourceId") final String resourceId,
208 @Parameter(description = "label id", required = true) @PathParam("labelId") final String labelId, @Context final HttpServletRequest request,
209 @HeaderParam(value = Constants.USER_ID_HEADER) String userId) {
210 return deleteAdditionalInformationLabelForComponent(NodeTypeEnum.Resource, resourceId, labelId, request, userId);
221 @Path("/services/{serviceId}/additionalinfo/{labelId}")
222 @Consumes(MediaType.APPLICATION_JSON)
223 @Produces(MediaType.APPLICATION_JSON)
224 @Operation(description = "Create Additional Information Label and Value", method = "DELETE", summary = "Returns deleted Additional Inforamtion property", responses = {
225 @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))),
226 @ApiResponse(responseCode = "200", description = "Additional information deleted"),
227 @ApiResponse(responseCode = "403", description = "Restricted operation"),
228 @ApiResponse(responseCode = "400", description = "Invalid content / Missing content"),
229 @ApiResponse(responseCode = "409", description = "Additional information key already exist")})
230 @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
231 public Response deleteServiceAdditionalInformationLabel(
232 @Parameter(description = "service id to update with new property", required = true) @PathParam("serviceId") final String serviceId,
233 @Parameter(description = "label id", required = true) @PathParam("labelId") final String labelId, @Context final HttpServletRequest request,
234 @HeaderParam(value = Constants.USER_ID_HEADER) String userId) {
235 return deleteAdditionalInformationLabelForComponent(NodeTypeEnum.Service, serviceId, labelId, request, userId);
246 @Path("/resources/{resourceId}/additionalinfo/{labelId}")
247 @Consumes(MediaType.APPLICATION_JSON)
248 @Produces(MediaType.APPLICATION_JSON)
249 @Operation(description = "Get Additional Information by id", method = "GET", summary = "Returns Additional Inforamtion property", responses = {
250 @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))),
251 @ApiResponse(responseCode = "200", description = "fetched additional information"),
252 @ApiResponse(responseCode = "403", description = "Restricted operation"),
253 @ApiResponse(responseCode = "400", description = "Invalid content / Missing content"),
254 @ApiResponse(responseCode = "409", description = "Additional information key already exist")})
255 @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
256 public Response getResourceAdditionalInformationLabel(
257 @Parameter(description = "resource id to update with new property", required = true) @PathParam("resourceId") final String resourceId,
258 @Parameter(description = "label id", required = true) @PathParam("labelId") final String labelId, @Context final HttpServletRequest request,
259 @HeaderParam(value = Constants.USER_ID_HEADER) String userId) {
260 return getAdditionalInformationLabelForComponent(NodeTypeEnum.Resource, resourceId, labelId, request, userId);
271 @Path("/services/{serviceId}/additionalinfo/{labelId}")
272 @Consumes(MediaType.APPLICATION_JSON)
273 @Produces(MediaType.APPLICATION_JSON)
274 @Operation(description = "Get Additional Information by id", method = "GET", summary = "Returns Additional Inforamtion property", responses = {
275 @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))),
276 @ApiResponse(responseCode = "200", description = "fetched additional information"),
277 @ApiResponse(responseCode = "403", description = "Restricted operation"),
278 @ApiResponse(responseCode = "400", description = "Invalid content / Missing content"),
279 @ApiResponse(responseCode = "409", description = "Additional information key already exist")})
280 @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
281 public Response getServiceAdditionalInformationLabel(
282 @Parameter(description = "service id to update with new property", required = true) @PathParam("serviceId") final String serviceId,
283 @Parameter(description = "label id", required = true) @PathParam("labelId") final String labelId, @Context final HttpServletRequest request,
284 @HeaderParam(value = Constants.USER_ID_HEADER) String userId) {
285 return getAdditionalInformationLabelForComponent(NodeTypeEnum.Service, serviceId, labelId, request, userId);
295 @Path("/resources/{resourceId}/additionalinfo")
296 @Consumes(MediaType.APPLICATION_JSON)
297 @Produces(MediaType.APPLICATION_JSON)
298 @Operation(description = "Get all Additional Information under resource", method = "GET", summary = "Returns Additional Inforamtion property", responses = {
299 @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))),
300 @ApiResponse(responseCode = "200", description = "list of additional information"),
301 @ApiResponse(responseCode = "403", description = "Restricted operation"),
302 @ApiResponse(responseCode = "400", description = "Invalid content / Missing content"),
303 @ApiResponse(responseCode = "409", description = "Additional information key already exist")})
304 @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
305 public Response getAllResourceAdditionalInformationLabel(
306 @Parameter(description = "resource id to update with new property", required = true) @PathParam("resourceId") final String resourceId,
307 @Context final HttpServletRequest request, @HeaderParam(value = Constants.USER_ID_HEADER) String userId) {
308 return getAllAdditionalInformationLabelForComponent(NodeTypeEnum.Resource, resourceId, request, userId);
318 @Path("/services/{serviceId}/additionalinfo")
319 @Consumes(MediaType.APPLICATION_JSON)
320 @Produces(MediaType.APPLICATION_JSON)
321 @Operation(description = "Get all Additional Information under service", method = "GET", summary = "Returns Additional Inforamtion property", responses = {
322 @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))),
323 @ApiResponse(responseCode = "200", description = "list of additional information"),
324 @ApiResponse(responseCode = "403", description = "Restricted operation"),
325 @ApiResponse(responseCode = "400", description = "Invalid content / Missing content"),
326 @ApiResponse(responseCode = "409", description = "Additional information key already exist")})
327 @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
328 public Response getAllServiceAdditionalInformationLabel(
329 @Parameter(description = "service id to update with new property", required = true) @PathParam("serviceId") final String serviceId,
330 @Context final HttpServletRequest request, @HeaderParam(value = Constants.USER_ID_HEADER) String userId) {
331 return getAllAdditionalInformationLabelForComponent(NodeTypeEnum.Service, serviceId, request, userId);
335 * Create additional information property under given resource/service
344 protected Response createAdditionalInformationLabelForComponent(NodeTypeEnum nodeType, String uniqueId, HttpServletRequest request, String userId,
346 ServletContext context = request.getSession().getServletContext();
347 String url = request.getMethod() + " " + request.getRequestURI();
348 log.debug(START_HANDLE_REQUEST_OF, url);
349 log.debug(MODIFIER_ID_IS, userId);
350 log.debug("data is {}", data);
352 // convert json to AdditionalInfoParameterInfo
353 AdditionalInfoParameterInfo additionalInfoParameterInfo = gson.fromJson(data, AdditionalInfoParameterInfo.class);
354 // create the new property
355 Either<AdditionalInfoParameterInfo, ResponseFormat> either = businessLogic
356 .createAdditionalInformation(nodeType, uniqueId, additionalInfoParameterInfo, userId);
357 if (either.isRight()) {
358 ResponseFormat responseFormat = either.right().value();
359 log.info("Failed to create additional information {}. Reason - {}", additionalInfoParameterInfo, responseFormat);
360 return buildErrorResponse(responseFormat);
362 AdditionalInfoParameterInfo createdAI = either.left().value();
363 log.debug("Additional information {}={} created successfully with id {}", createdAI.getKey(), createdAI.getValue(),
364 createdAI.getUniqueId());
365 ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.CREATED);
366 return buildOkResponse(responseFormat, createdAI);
367 } catch (Exception e) {
368 log.debug("Create additional information failed with exception", e);
369 ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR);
370 return buildErrorResponse(responseFormat);
375 * Update additional information property by id under given resource/service
385 protected Response updateAdditionalInformationLabelForComponent(NodeTypeEnum nodeType, String uniqueId, String labelId,
386 HttpServletRequest request, String userId, String data) {
387 ServletContext context = request.getSession().getServletContext();
388 String url = request.getMethod() + " " + request.getRequestURI();
389 log.debug(START_HANDLE_REQUEST_OF, url);
390 log.debug(MODIFIER_ID_IS, userId);
391 log.debug("data is {}", data);
393 // convert json to AdditionalInfoParameterInfo
394 AdditionalInfoParameterInfo additionalInfoParameterInfo = gson.fromJson(data, AdditionalInfoParameterInfo.class);
395 // create the new property
396 additionalInfoParameterInfo.setUniqueId(labelId);
397 Either<AdditionalInfoParameterInfo, ResponseFormat> either = businessLogic
398 .updateAdditionalInformation(nodeType, uniqueId, additionalInfoParameterInfo, userId);
399 if (either.isRight()) {
400 ResponseFormat responseFormat = either.right().value();
401 log.info(FAILED_TO_UPDATE_ADDITIONAL_INFO_PROPERTY, responseFormat);
402 return buildErrorResponse(responseFormat);
404 AdditionalInfoParameterInfo createdAI = either.left().value();
405 log.debug("Additional information {}={} updated successfully with id {}", createdAI.getKey(), createdAI.getValue(),
406 createdAI.getUniqueId());
407 ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.OK);
408 return buildOkResponse(responseFormat, createdAI);
409 } catch (Exception e) {
410 BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Update Additional Information");
411 log.debug("Update additional information failed with exception", e);
412 ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR);
413 return buildErrorResponse(responseFormat);
418 * Delete an additional information property by id under given resource/service
427 protected Response deleteAdditionalInformationLabelForComponent(NodeTypeEnum nodeType, String uniqueId, String labelId,
428 HttpServletRequest request, String userId) {
429 ServletContext context = request.getSession().getServletContext();
430 String url = request.getMethod() + " " + request.getRequestURI();
431 log.debug(START_HANDLE_REQUEST_OF, url);
432 log.debug(MODIFIER_ID_IS, userId);
434 AdditionalInfoParameterInfo additionalInfoParameterInfo = new AdditionalInfoParameterInfo();
435 additionalInfoParameterInfo.setUniqueId(labelId);
436 Either<AdditionalInfoParameterInfo, ResponseFormat> either = businessLogic
437 .deleteAdditionalInformation(nodeType, uniqueId, additionalInfoParameterInfo, userId);
438 if (either.isRight()) {
439 ResponseFormat responseFormat = either.right().value();
440 log.info(FAILED_TO_UPDATE_ADDITIONAL_INFO_PROPERTY, responseFormat);
441 return buildErrorResponse(responseFormat);
443 AdditionalInfoParameterInfo createdAI = either.left().value();
444 log.debug("Additional information {}={} deleted successfully with id {}", createdAI.getKey(), createdAI.getValue(),
445 createdAI.getUniqueId());
446 ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.OK);
447 return buildOkResponse(responseFormat, createdAI);
448 } catch (Exception e) {
449 BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Delete Additional Information");
450 log.debug("Delete additional information failed with exception", e);
451 ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR);
452 return buildErrorResponse(responseFormat);
457 * Get a specific additional information property by a given id under given resource/service
466 protected Response getAdditionalInformationLabelForComponent(NodeTypeEnum nodeType, String uniqueId, String labelId, HttpServletRequest request,
468 ServletContext context = request.getSession().getServletContext();
469 String url = request.getMethod() + " " + request.getRequestURI();
470 log.debug(START_HANDLE_REQUEST_OF, url);
471 log.debug(MODIFIER_ID_IS, userId);
473 // create the new property
474 AdditionalInfoParameterInfo additionalInfoParameterInfo = new AdditionalInfoParameterInfo();
475 additionalInfoParameterInfo.setUniqueId(labelId);
476 Either<AdditionalInfoParameterInfo, ResponseFormat> either = businessLogic
477 .getAdditionalInformation(nodeType, uniqueId, additionalInfoParameterInfo, userId);
478 if (either.isRight()) {
479 ResponseFormat responseFormat = either.right().value();
480 log.info(FAILED_TO_UPDATE_ADDITIONAL_INFO_PROPERTY, responseFormat);
481 return buildErrorResponse(responseFormat);
483 AdditionalInfoParameterInfo createdAI = either.left().value();
484 log.debug("Additional information {}={} fetched successfully with id {}", createdAI.getKey(), createdAI.getValue(),
485 createdAI.getUniqueId());
486 ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.OK);
487 return buildOkResponse(responseFormat, createdAI);
488 } catch (Exception e) {
489 BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Get Additional Information");
490 log.debug("get additional information failed with exception", e);
491 ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR);
492 return buildErrorResponse(responseFormat);
497 * Get all additional information properties under given resource/service
505 protected Response getAllAdditionalInformationLabelForComponent(NodeTypeEnum nodeType, String uniqueId, HttpServletRequest request,
507 ServletContext context = request.getSession().getServletContext();
508 String url = request.getMethod() + " " + request.getRequestURI();
509 log.debug(START_HANDLE_REQUEST_OF, url);
510 log.debug(MODIFIER_ID_IS, userId);
512 Either<AdditionalInformationDefinition, ResponseFormat> either = businessLogic.getAllAdditionalInformation(nodeType, uniqueId, userId);
513 if (either.isRight()) {
514 ResponseFormat responseFormat = either.right().value();
515 log.info(FAILED_TO_UPDATE_ADDITIONAL_INFO_PROPERTY, responseFormat);
516 return buildErrorResponse(responseFormat);
518 AdditionalInformationDefinition additionalInformationDefinition = either.left().value();
519 log.debug("All Additional information retrieved for component {} is {}", uniqueId, additionalInformationDefinition);
520 ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.OK);
521 return buildOkResponse(responseFormat, additionalInformationDefinition);
522 } catch (Exception e) {
523 BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Get All Additional Information");
524 log.debug("Get all addiotanl information properties failed with exception", e);
525 ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR);
526 return buildErrorResponse(responseFormat);