diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java index 2d3320e1c90..17732fea861 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java @@ -44,16 +44,6 @@ public interface DeviceManagementProviderService { */ List getAllDevices(String deviceType) throws DeviceManagementException; - /** - * Method to retrieve all the devices of a given device type without other device information. - * - * @param deviceType Device-type of the required devices - * @return List of devices of given device-type. - * @throws DeviceManagementException If some unusual behaviour is observed while fetching the - * devices. - */ - List getAllDevicesWithoutInfo(String deviceType) throws DeviceManagementException; - /** * Method to retrieve all the devices registered in the system. * diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index b7f508cb22c..dda2caf5925 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -713,80 +713,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv return devices; } - @Override - public List getAllDevicesWithoutInfo(String deviceType) throws DeviceManagementException { - List devices = new ArrayList<>(); - List allDevices; - try { - DeviceManagementDAOFactory.openConnection(); - allDevices = deviceDAO.getDevices(deviceType, this.getTenantId()); - if (allDevices == null) { - if (log.isDebugEnabled()) { - log.debug("No device is found upon the type '" + deviceType + "'"); - } - return null; - } - } catch (DeviceManagementDAOException e) { - throw new DeviceManagementException("Error occurred while retrieving all devices of type '" + - deviceType + "' that are being managed within the scope of current tenant", e); - } catch (SQLException e) { - throw new DeviceManagementException("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - - for (Device device : allDevices) { - DeviceInfo info = null; - try { - DeviceManagementDAOFactory.openConnection(); - info = deviceInfoDAO.getDeviceInformation(device.getId()); - DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId()); - if (info != null) { - info.setLocation(location); - } - } catch (DeviceDetailsMgtDAOException e) { - log.error("Error occurred while retrieving advance info of '" + device.getType() + - "' that carries the id '" + device.getDeviceIdentifier() + "'"); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - device.setDeviceInfo(info); - - try { - DeviceManagementDAOFactory.openConnection(); - List applications = applicationDAO.getInstalledApplications(device.getId()); - device.setApplications(applications); - } catch (DeviceManagementDAOException e) { - log.error("Error occurred while retrieving the application list of '" + device.getType() + "', " + - "which carries the id '" + device.getId() + "'", e); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - - DeviceManager deviceManager = this.getDeviceManager(deviceType); - if (deviceManager == null) { - if (log.isDebugEnabled()) { - log.debug("Device Manager associated with the device type '" + deviceType + "' is null. " + - "Therefore, not attempting method 'isEnrolled'"); - } - devices.add(device); - continue; - } - Device dmsDevice = - deviceManager.getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); - if (dmsDevice != null) { - device.setFeatures(dmsDevice.getFeatures()); - device.setProperties(dmsDevice.getProperties()); - } - devices.add(device); - } - return devices; - } - @Override public void sendEnrolmentInvitation(EmailMetaInfo metaInfo) throws DeviceManagementException { Map, Object>> params = new HashMap<>();