|
|
@ -1390,12 +1390,11 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|
|
|
if (deviceGroup == null) {
|
|
|
|
if (deviceGroup == null) {
|
|
|
|
String errorMessage = "Invalid Group ID provided.";
|
|
|
|
String errorMessage = "Invalid Group ID provided.";
|
|
|
|
log.error(errorMessage);
|
|
|
|
log.error(errorMessage);
|
|
|
|
// throw new GroupManagementException(errorMessage, e);
|
|
|
|
|
|
|
|
throw new GroupManagementException(errorMessage);
|
|
|
|
throw new GroupManagementException(errorMessage);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<Device> devices = getAllDevicesOfGroup(deviceGroup.getName(), false);
|
|
|
|
List<Device> devices = getAllDevicesOfGroup(deviceGroup.getName(), false);
|
|
|
|
for (Device device : devices) {
|
|
|
|
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.contains(device.getDeviceIdentifier())) {
|
|
|
|
deviceIDs.add(device.getDeviceIdentifier());
|
|
|
|
deviceIDs.add(device.getDeviceIdentifier());
|
|
|
|
allDevices.add(device);
|
|
|
|
allDevices.add(device);
|
|
|
@ -1403,20 +1402,20 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (Device device: allDevices){
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
if (DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID.equals(device.getType())){
|
|
|
|
if (DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID.equals(device.getType())) {
|
|
|
|
deviceTypesOfGroups.setHasAndroid(true);
|
|
|
|
deviceTypesOfGroups.setHasAndroid(true);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (Device device: allDevices){
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
if (DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS.equals(device.getType())){
|
|
|
|
if (DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS.equals(device.getType())) {
|
|
|
|
deviceTypesOfGroups.setHasIos(true);
|
|
|
|
deviceTypesOfGroups.setHasIos(true);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (Device device: allDevices){
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
if (DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS.equals(device.getType())){
|
|
|
|
if (DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS.equals(device.getType())) {
|
|
|
|
deviceTypesOfGroups.setHasWindows(true);
|
|
|
|
deviceTypesOfGroups.setHasWindows(true);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1431,47 +1430,4 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|
|
|
|
|
|
|
|
|
|
|
return deviceTypesOfGroups;
|
|
|
|
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);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|