From c993051a0728645935d1da9e74d1bdf36b6981c1 Mon Sep 17 00:00:00 2001 From: isuri Date: Mon, 1 Jan 2024 09:21:53 +0530 Subject: [PATCH] replace query params with path params as required --- .../api/DeviceOrganizationMgtService.java | 22 +++++++++---------- .../api/DeviceOrganizationMgtServiceImpl.java | 12 +++++----- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationMgtService.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationMgtService.java index f02486432e..cfc669c767 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationMgtService.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationMgtService.java @@ -491,7 +491,7 @@ public interface DeviceOrganizationMgtService { * @return A response indicating whether the organization exists or not. */ @GET - @Path("exists") + @Path("exists/{deviceId}/{parentDeviceId}") @ApiOperation( produces = MediaType.APPLICATION_JSON, httpMethod = "GET", @@ -538,10 +538,10 @@ public interface DeviceOrganizationMgtService { response = ErrorResponse.class) }) Response isDeviceOrganizationExist( - @ApiParam(value = "The ID of the child device.", required = true) - @QueryParam("deviceId") int deviceId, - @ApiParam(value = "The ID of the parent device.") - @QueryParam("parentDeviceId") String parentDeviceId); + @ApiParam(name = "deviceId", value = "The ID of the child device.", required = true) + @PathParam("deviceId") int deviceId, + @ApiParam(name = "parentDeviceId", value = "The ID of the parent device.") + @PathParam("parentDeviceId") String parentDeviceId); /** @@ -552,7 +552,7 @@ public interface DeviceOrganizationMgtService { * @return A response containing the retrieved DeviceOrganization object, or null if not found. */ @GET - @Path("organization") + @Path("organization/{deviceId}/{parentDeviceId}") @ApiOperation( produces = MediaType.APPLICATION_JSON, httpMethod = "GET", @@ -603,10 +603,10 @@ public interface DeviceOrganizationMgtService { response = ErrorResponse.class) }) Response getDeviceOrganizationByUniqueKey( - @ApiParam(value = "The ID of the child device.", required = true) - @QueryParam("deviceId") int deviceId, - @ApiParam(value = "The ID of the parent device.") - @QueryParam("parentDeviceId") String parentDeviceId); + @ApiParam(name = "deviceId", value = "The ID of the child device.", required = true) + @PathParam("deviceId") int deviceId, + @ApiParam(name = "parentDeviceId", value = "The ID of the parent device.") + @PathParam("parentDeviceId") String parentDeviceId); /** * Updates a device organization. @@ -786,7 +786,7 @@ public interface DeviceOrganizationMgtService { response = ErrorResponse.class) }) Response deleteDeviceAssociations( - @ApiParam(value = "The ID of the device for which associations should be deleted.", required = true) + @ApiParam(name = "deviceId", value = "The ID of the device for which associations should be deleted.", required = true) @PathParam("deviceId") int deviceId); diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationMgtServiceImpl.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationMgtServiceImpl.java index d47672944b..9a4b2590be 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationMgtServiceImpl.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationMgtServiceImpl.java @@ -171,10 +171,10 @@ public class DeviceOrganizationMgtServiceImpl implements DeviceOrganizationMgtSe @GET @Override - @Path("exists") + @Path("exists/{deviceId}/{parentDeviceId}") public Response isDeviceOrganizationExist( - @QueryParam("deviceId") int deviceId, - @QueryParam("parentDeviceId") String parentDeviceId) { + @PathParam("deviceId") int deviceId, + @PathParam("parentDeviceId") String parentDeviceId) { try { DeviceOrganizationService deviceOrganizationService = DeviceOrgAPIUtils.getDeviceOrganizationService(); boolean exists; @@ -196,10 +196,10 @@ public class DeviceOrganizationMgtServiceImpl implements DeviceOrganizationMgtSe @GET @Override - @Path("organization") + @Path("organization/{deviceId}/{parentDeviceId}") public Response getDeviceOrganizationByUniqueKey( - @QueryParam("deviceId") int deviceId, - @QueryParam("parentDeviceId") String parentDeviceId) { + @PathParam("deviceId") int deviceId, + @PathParam("parentDeviceId") String parentDeviceId) { try { DeviceOrganizationService deviceOrganizationService = DeviceOrgAPIUtils.getDeviceOrganizationService(); DeviceOrganization organization;