From dd2e1700187449a017b75589aeb0c2dfb989dec7 Mon Sep 17 00:00:00 2001 From: KrupaNagabhushan Date: Thu, 15 Jul 2021 15:29:02 +0100 Subject: Consider component model when retrieving capability types Issue-ID: SDC-3642 Signed-off-by: KrupaNagabhushan Change-Id: Ie09b5f8d64b95fc2db14f19d3857a9935075b2fe --- .../openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java | 4 ++-- .../main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'catalog-be/src') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java index be9b519e18..c070d89fd4 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java @@ -566,9 +566,9 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { .equals(capabilityDefinition.getUniqueId())); } - public Either, ResponseFormat> getAllCapabilityTypes() { + public Either, ResponseFormat> getAllCapabilityTypes(String modelName) { Either, JanusGraphOperationStatus> capabilityTypeCacheAll = capabilityTypeOperation - .getAllCapabilityTypes(); + .getAllCapabilityTypes(modelName); if (capabilityTypeCacheAll.isRight()) { JanusGraphOperationStatus operationStatus = capabilityTypeCacheAll.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 cafcbfd211..c3c42e27f5 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 @@ -184,7 +184,8 @@ public class TypesFetchServlet extends AbstractValidationsServlet { @ApiResponse(responseCode = "404", description = "Capability types not found")}) @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE) public Response getAllCapabilityTypesServlet(@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 { @@ -193,7 +194,7 @@ public class TypesFetchServlet extends AbstractValidationsServlet { if (responseWrapper.isEmpty()) { String url = request.getMethod() + " " + request.getRequestURI(); log.debug("Start handle request of {} | modifier id is {}", url, userId); - Either, ResponseFormat> allDataTypes = capabilitiesBusinessLogic.getAllCapabilityTypes(); + Either, ResponseFormat> allDataTypes = capabilitiesBusinessLogic.getAllCapabilityTypes(modelName); if (allDataTypes.isRight()) { log.info("Failed to get all capability types. Reason - {}", allDataTypes.right().value()); Response errorResponse = buildErrorResponse(allDataTypes.right().value()); -- cgit 1.2.3-korg