Merge pull request #592 from geethkokila/cloud-3.1.0

Fixing the task to get the only device registered tenants
revert-70aa11f8
Geeth 8 years ago committed by GitHub
commit 264cd7e1f1

@ -315,22 +315,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
return enrolmentInfos;
}
@Override
public List<Integer> 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<Integer> 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<Device> getDevicesOfUser(String username) throws DeviceManagementException {
List<Device> devices = new ArrayList<>();

@ -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 {

Loading…
Cancel
Save