From 0514ec6635a08cdbaac5d664c3a4f13bcb0cbf51 Mon Sep 17 00:00:00 2001 From: KrupaNagabhushan Date: Wed, 14 Jul 2021 14:21:47 +0100 Subject: Consider component model when retrieving relationship types Issue-ID: SDC-3640 Signed-off-by: MichaelMorris Change-Id: Ic06a9085b8aa2f44b8d33d7de12eadf691106131 Signed-off-by: Vasyl Razinkov Signed-off-by: KrupaNagabhushan --- .../sdc/be/components/impl/RelationshipTypeBusinessLogic.java | 4 ++-- .../java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'catalog-be/src/main') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java index 9a83566166..195e43de26 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java @@ -39,9 +39,9 @@ public class RelationshipTypeBusinessLogic { this.componentsUtils = componentsUtils; } - public Either, ResponseFormat> getAllRelationshipTypes() { + public Either, ResponseFormat> getAllRelationshipTypes(final String model) { Either, JanusGraphOperationStatus> allRelationshipTypes = relationshipTypeOperation - .getAllRelationshipTypes(); + .getAllRelationshipTypes(model); if (allRelationshipTypes.isRight()) { JanusGraphOperationStatus operationStatus = allRelationshipTypes.right().value(); if (JanusGraphOperationStatus.NOT_FOUND == operationStatus) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java index 6fbdbaf217..cafcbfd211 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java @@ -22,6 +22,7 @@ package org.openecomp.sdc.be.servlets; import com.jcabi.aspects.Loggable; import fj.data.Either; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; @@ -42,10 +43,12 @@ import javax.ws.rs.GET; import javax.ws.rs.HeaderParam; import javax.ws.rs.Path; import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.commons.collections4.ListUtils; +import org.glassfish.jersey.media.multipart.FormDataParam; import org.openecomp.sdc.be.components.impl.CapabilitiesBusinessLogic; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic; @@ -223,7 +226,8 @@ public class TypesFetchServlet extends AbstractValidationsServlet { @ApiResponse(responseCode = "404", description = "Relationship types not found")}) @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE) public Response getAllRelationshipTypesServlet(@Context final HttpServletRequest request, - @HeaderParam(value = Constants.USER_ID_HEADER) String userId) { + @HeaderParam(value = Constants.USER_ID_HEADER) String userId, + @Parameter(description = "model", required = false) @QueryParam("model") String modelName) { Wrapper responseWrapper = new Wrapper<>(); Wrapper userWrapper = new Wrapper<>(); try { @@ -233,7 +237,7 @@ public class TypesFetchServlet extends AbstractValidationsServlet { String url = request.getMethod() + " " + request.getRequestURI(); log.debug("Start handle request of {} | modifier id is {}", url, userId); Either, ResponseFormat> allDataTypes = relationshipTypeBusinessLogic - .getAllRelationshipTypes(); + .getAllRelationshipTypes(modelName); if (allDataTypes.isRight()) { log.info("Failed to get all relationship types. Reason - {}", allDataTypes.right().value()); Response errorResponse = buildErrorResponse(allDataTypes.right().value()); -- cgit 1.2.3-korg