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 f21e091316..8bde4d8e06 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 @@ -315,22 +315,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv return enrolmentInfos; } - @Override - public List getDeviceEnrolledTenants() throws DeviceManagementException { - try { - DeviceManagementDAOFactory.openConnection(); - return deviceDAO.getDeviceEnrolledTenants(); - } catch (DeviceManagementDAOException e) { - throw new DeviceManagementException("Error occurred while retrieving the tenants " + - "which have device enrolled.", e); - } catch (SQLException e) { - throw new DeviceManagementException("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - } - - @Override public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException { DeviceManager deviceManager = this.getDeviceManager(deviceId.getType()); @@ -1295,6 +1279,21 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv return dms.getPolicyMonitoringManager(); } + @Override + public List getDeviceEnrolledTenants() throws DeviceManagementException { + try { + DeviceManagementDAOFactory.openConnection(); + return deviceDAO.getDeviceEnrolledTenants(); + } catch (DeviceManagementDAOException e) { + throw new DeviceManagementException("Error occurred while retrieving the tenants " + + "which have device enrolled.", e); + } catch (SQLException e) { + throw new DeviceManagementException("Error occurred while opening a connection to the data source", e); + } finally { + DeviceManagementDAOFactory.closeConnection(); + } + } + @Override public List getDevicesOfUser(String username) throws DeviceManagementException { List devices = new ArrayList<>(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceDetailsRetrieverTask.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceDetailsRetrieverTask.java index fcd10a349e..9040af6654 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceDetailsRetrieverTask.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceDetailsRetrieverTask.java @@ -23,6 +23,7 @@ import com.google.gson.Gson; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig; import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; import org.wso2.carbon.device.mgt.core.task.DeviceMgtTaskException; @@ -33,6 +34,7 @@ import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import java.util.List; +import java.util.List; import java.util.Map; public class DeviceDetailsRetrieverTask implements Task {