From f07e3259c4d3906ddd86568278f513bf1b1409a6 Mon Sep 17 00:00:00 2001 From: Thamindu Aluthwala Date: Fri, 13 Oct 2023 21:25:37 +0530 Subject: [PATCH] address review comments --- .../v1/constants/APIResourceMgtEndpointConstants.java | 2 +- .../v1/core/ServerAPIResourceManagementService.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.api.resource/org.wso2.carbon.identity.api.server.api.resource.v1/src/main/java/org/wso2/carbon/identity/api/server/api/resource/v1/constants/APIResourceMgtEndpointConstants.java b/components/org.wso2.carbon.identity.api.server.api.resource/org.wso2.carbon.identity.api.server.api.resource.v1/src/main/java/org/wso2/carbon/identity/api/server/api/resource/v1/constants/APIResourceMgtEndpointConstants.java index 77a3914224..27518507e3 100644 --- a/components/org.wso2.carbon.identity.api.server.api.resource/org.wso2.carbon.identity.api.server.api.resource.v1/src/main/java/org/wso2/carbon/identity/api/server/api/resource/v1/constants/APIResourceMgtEndpointConstants.java +++ b/components/org.wso2.carbon.identity.api.server.api.resource/org.wso2.carbon.identity.api.server.api.resource.v1/src/main/java/org/wso2/carbon/identity/api/server/api/resource/v1/constants/APIResourceMgtEndpointConstants.java @@ -30,7 +30,7 @@ public class APIResourceMgtEndpointConstants { private APIResourceMgtEndpointConstants() { } - public static final String API_RESOURCE_TYPE = "BUSINESS"; + public static final String BUSINESS_API_RESOURCE_TYPE = "BUSINESS"; public static final String SYSTEM_API_RESOURCE_TYPE = "SYSTEM"; public static final String API_RESOURCE_MANAGEMENT_PREFIX = "API-RESOURCE-"; public static final String API_RESOURCE_PATH_COMPONENT = "/api-resources"; diff --git a/components/org.wso2.carbon.identity.api.server.api.resource/org.wso2.carbon.identity.api.server.api.resource.v1/src/main/java/org/wso2/carbon/identity/api/server/api/resource/v1/core/ServerAPIResourceManagementService.java b/components/org.wso2.carbon.identity.api.server.api.resource/org.wso2.carbon.identity.api.server.api.resource.v1/src/main/java/org/wso2/carbon/identity/api/server/api/resource/v1/core/ServerAPIResourceManagementService.java index 3a11f44855..82d27a0a3c 100644 --- a/components/org.wso2.carbon.identity.api.server.api.resource/org.wso2.carbon.identity.api.server.api.resource.v1/src/main/java/org/wso2/carbon/identity/api/server/api/resource/v1/core/ServerAPIResourceManagementService.java +++ b/components/org.wso2.carbon.identity.api.server.api.resource/org.wso2.carbon.identity.api.server.api.resource.v1/src/main/java/org/wso2/carbon/identity/api/server/api/resource/v1/core/ServerAPIResourceManagementService.java @@ -395,7 +395,7 @@ private APIResource createAPIResource(APIResourceCreationModel apIResourceCreati .scopes(createScopes(apIResourceCreationModel.getScopes())) .requiresAuthorization(apIResourceCreationModel.getRequiresAuthorization() != null ? apIResourceCreationModel.getRequiresAuthorization() : true) - .type(APIResourceMgtEndpointConstants.API_RESOURCE_TYPE); + .type(APIResourceMgtEndpointConstants.BUSINESS_API_RESOURCE_TYPE); return apiResourceBuilder.build(); } @@ -479,9 +479,9 @@ private static Integer validatedLimit(Integer limit) throws APIError { * * @param apiResource API resource to be handled. */ - private static void handleSystemAPI(APIResource apiResource) { + private void handleSystemAPI(APIResource apiResource) { - if (StringUtils.equals(apiResource.getType(), APIResourceMgtEndpointConstants.SYSTEM_API_RESOURCE_TYPE)) { + if (APIResourceMgtEndpointConstants.SYSTEM_API_RESOURCE_TYPE.equals(apiResource.getType())) { throw APIResourceMgtEndpointUtil.handleException(Response.Status.FORBIDDEN, ErrorMessage.ERROR_CODE_SYSTEM_API_RESOURCE_NOT_MODIFIABLE); }