diff options
author | KrupaNagabhushan <krupa.nagabhushan@est.tech> | 2021-07-14 14:21:47 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2021-07-21 14:13:29 +0000 |
commit | 0514ec6635a08cdbaac5d664c3a4f13bcb0cbf51 (patch) | |
tree | 8ece729ff236e5011b705c3c79536eb482a44a7c /catalog-be/src/main/java | |
parent | a3da4a7625f75f719a0ef1ffe1c2bef87828d2f3 (diff) |
Consider component model when retrieving relationship types
Issue-ID: SDC-3640
Signed-off-by: MichaelMorris <michael.morris@est.tech>
Change-Id: Ic06a9085b8aa2f44b8d33d7de12eadf691106131
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Signed-off-by: KrupaNagabhushan <krupa.nagabhushan@est.tech>
Diffstat (limited to 'catalog-be/src/main/java')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java | 4 | ||||
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java | 8 |
2 files changed, 8 insertions, 4 deletions
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<Map<String, RelationshipTypeDefinition>, ResponseFormat> getAllRelationshipTypes() { + public Either<Map<String, RelationshipTypeDefinition>, ResponseFormat> getAllRelationshipTypes(final String model) { Either<Map<String, RelationshipTypeDefinition>, 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<Response> responseWrapper = new Wrapper<>(); Wrapper<User> 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<Map<String, RelationshipTypeDefinition>, 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()); |