|
|
|
@ -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<Device> 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<Integer> convertStringToInteger(List<String> list) throws BadRequestException {
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// return groupsIDs;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// public static List<String> getDeviceIDsOfGroups(List<Integer> groupIDs) throws InvalidGroupException,
|
|
|
|
|
// GroupDeviceException {
|
|
|
|
|
//
|
|
|
|
|
// try {
|
|
|
|
|
// GroupManagementProviderService groupManagementProviderService = AndroidDeviceManagementDataHolder
|
|
|
|
|
// .getInstance().getGroupManagementProviderService();
|
|
|
|
|
//
|
|
|
|
|
// List<String> 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<Device> 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);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|