diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java index 357609b122f..acb161d77e5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java @@ -1287,7 +1287,8 @@ public interface DeviceManagementService { produces = MediaType.APPLICATION_JSON, httpMethod = "PUT", value = "Remove Multiple Devices Specified by Device IDs and Device Type", - notes = "Deletes multiple devices of the specified device type specified by their device IDs and returns the status of the deletion operation.", + notes = "Deletes multiple devices of the specified device type specified by their device IDs" + + " and returns the status of the dis-enrollment operation.", tags = "Device Management", extensions = { @Extension(properties = { @@ -1319,7 +1320,7 @@ public interface DeviceManagementService { }) Response disenrollMultipleDevices(@ApiParam( name = "deviceTypeWithDeviceIds", - value = "The properties to advanced search devices.", + value = "Device type and corresponding device IDs for disenrollment", required = true) DisenrollRequest deviceTypeWithDeviceIds); @GET diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java index 881a586f828..9e82728d3aa 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java @@ -491,17 +491,22 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { List failedToDisenrollDevices = new ArrayList<>(); Map> list = deviceTypeWithDeviceIds.getDeviceTypeWithDeviceIds(); + String deviceType; + List deviceIds; + DeviceIdentifier deviceIdentifier; + Device persistedDevice; + boolean response; for (Map.Entry> entry : list.entrySet()) { - String deviceType = entry.getKey(); - List deviceIds = entry.getValue(); + deviceType = entry.getKey(); + deviceIds = entry.getValue(); for (String deviceId : deviceIds) { - DeviceIdentifier deviceIdentifier = new DeviceIdentifier(deviceId, deviceType); + deviceIdentifier = new DeviceIdentifier(deviceId, deviceType); try { - Device persistedDevice = deviceManagementProviderService.getDevice(deviceIdentifier, true); + persistedDevice = deviceManagementProviderService.getDevice(deviceIdentifier, true); if (persistedDevice != null) { - boolean response = deviceManagementProviderService.disenrollDevice(deviceIdentifier); + response = deviceManagementProviderService.disenrollDevice(deviceIdentifier); if (response) { successfullyDisenrolledDevices.add(deviceIdentifier); } else { @@ -509,6 +514,10 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { } } else { failedToDisenrollDevices.add(deviceIdentifier); + if(log.isDebugEnabled()){ + String msg = "Error encountered while dis-enrolling device of type: " + deviceType + " with " + deviceId; + log.error(msg); + } } } catch (DeviceManagementException e) { String msg = "Error encountered while dis-enrolling device of type: " + deviceType + " with " + deviceId;