From 56a46bc21d91c52ac72094d22015ba522c8f0c73 Mon Sep 17 00:00:00 2001 From: Arshana Date: Tue, 8 Nov 2022 16:00:22 +0530 Subject: [PATCH] Fix getGroupHasDeviceTypes API --- .../mgt/jaxrs/service/api/GroupManagementService.java | 5 ++--- .../jaxrs/service/impl/GroupManagementServiceImpl.java | 9 +++------ .../mgt/core/service/GroupManagementProviderService.java | 6 ++++++ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java index eb5e5bfd19..96b3188f70 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java @@ -1193,7 +1193,7 @@ public interface GroupManagementService { boolean requireGroupProps); @Path("/device-types") - @GET + @POST @ApiOperation( produces = MediaType.APPLICATION_JSON, httpMethod = HTTPConstants.HEADER_GET, @@ -1242,9 +1242,8 @@ public interface GroupManagementService { Response getGroupHasDeviceTypes( @ApiParam( name = "identifiers", - value = "list of identifiers.", + value = "GET list of identifiers.", required = true) - @QueryParam("identifiers") List identifiers); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GroupManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GroupManagementServiceImpl.java index 19edf4cedf..898ffb6c23 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GroupManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GroupManagementServiceImpl.java @@ -67,6 +67,7 @@ import org.wso2.carbon.policy.mgt.common.PolicyManagementException; import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; +import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response; @@ -430,12 +431,10 @@ public class GroupManagementServiceImpl implements GroupManagementService { } } - @GET + @POST @Path("/device-types") @Override - public Response getGroupHasDeviceTypes(@QueryParam("identifiers") List identifiers) { - - + public Response getGroupHasDeviceTypes(List identifiers) { try { DeviceTypesOfGroups deviceTypesOfGroups = DeviceMgtAPIUtils.getGroupManagementProviderService() .getDeviceTypesOfGroups(identifiers); @@ -446,8 +445,6 @@ public class GroupManagementServiceImpl implements GroupManagementService { log.error(msg, e); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); } - - } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderService.java index 94cf1f10f5..8f12f8a1df 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderService.java @@ -336,5 +336,11 @@ public interface GroupManagementProviderService { */ boolean isDeviceMappedToGroup(int groupId, DeviceIdentifier deviceIdentifier) throws GroupManagementException; + /** + * + * @param identifiers identifiers of groups + * @return whether the groups has android, iOS, Windows device types + * @throws GroupManagementException + */ DeviceTypesOfGroups getDeviceTypesOfGroups(List identifiers) throws GroupManagementException; }