From 78d4cac13ff4cc2535d8ab8ce402984b9bb17ed2 Mon Sep 17 00:00:00 2001 From: Arshana Date: Mon, 31 Oct 2022 18:55:58 +0530 Subject: [PATCH] Removed commented section --- .../GroupManagementProviderServiceImpl.java | 58 +++---------------- 1 file changed, 7 insertions(+), 51 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java index b1892368e1..9981333428 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java @@ -1398,12 +1398,11 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid if (deviceGroup == null) { String errorMessage = "Invalid Group ID provided."; log.error(errorMessage); -// throw new GroupManagementException(errorMessage, e); throw new GroupManagementException(errorMessage); } List devices = getAllDevicesOfGroup(deviceGroup.getName(), false); for (Device device : devices) { - if ( !DEVICE_STATUS_REMOVED.equals(device.getEnrolmentInfo().getStatus().toString()) + if (!DEVICE_STATUS_REMOVED.equals(device.getEnrolmentInfo().getStatus().toString()) && !deviceIDs.contains(device.getDeviceIdentifier())) { deviceIDs.add(device.getDeviceIdentifier()); allDevices.add(device); @@ -1411,20 +1410,20 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid } } - for (Device device: allDevices){ - if (DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID.equals(device.getType())){ + for (Device device : allDevices) { + if (DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID.equals(device.getType())) { deviceTypesOfGroups.setHasAndroid(true); break; } } - for (Device device: allDevices){ - if (DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS.equals(device.getType())){ + for (Device device : allDevices) { + if (DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS.equals(device.getType())) { deviceTypesOfGroups.setHasIos(true); break; } } - for (Device device: allDevices){ - if (DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS.equals(device.getType())){ + for (Device device : allDevices) { + if (DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS.equals(device.getType())) { deviceTypesOfGroups.setHasWindows(true); break; } @@ -1439,47 +1438,4 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid return deviceTypesOfGroups; } -// DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID.equals(device.getType()) - - -// -// public static List convertStringToInteger(List list) throws BadRequestException { -// -// -// return groupsIDs; -// } -// -// public static List getDeviceIDsOfGroups(List groupIDs) throws InvalidGroupException, -// GroupDeviceException { -// -// try { -// GroupManagementProviderService groupManagementProviderService = AndroidDeviceManagementDataHolder -// .getInstance().getGroupManagementProviderService(); -// -// List deviceIDs = new ArrayList<>(); -// for (Integer groupID : groupIDs) { -// DeviceGroup deviceGroup = groupManagementProviderService.getGroup(groupID, false); -// if (deviceGroup == null) { -// String errorMessage = "Invalid Group ID provided."; -// log.error(errorMessage); -// throw new InvalidGroupException(errorMessage); -// } -// List devices = groupManagementProviderService.getAllDevicesOfGroup(deviceGroup.getName(), false); -// for (Device device : devices) { -// if (DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID.equals(device.getType()) -// && !AndroidConstants.DEVICE_STATUS_REMOVED.equals(device.getEnrolmentInfo().getStatus().toString()) -// && !deviceIDs.contains(device.getDeviceIdentifier())) { -// deviceIDs.add(device.getDeviceIdentifier()); -// } -// } -// } -// -// return deviceIDs; -// } catch (GroupManagementException e) { -// String errorMessage = "Error occurred getting group or device IDs ."; -// log.error(errorMessage, e); -// throw new GroupDeviceException(errorMessage, e); -// } -// } - }