mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merged changes
This commit is contained in:
parent
93e641893c
commit
5d107b0d56
@ -667,6 +667,40 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Device getDevice(DeviceIdentifier deviceId, EnrolmentInfo.Status status) throws DeviceManagementException {
|
||||||
|
Device device;
|
||||||
|
try {
|
||||||
|
DeviceManagementDAOFactory.openConnection();
|
||||||
|
device = deviceDAO.getDevice(deviceId, status, this.getTenantId());
|
||||||
|
} catch (DeviceManagementDAOException e) {
|
||||||
|
throw new DeviceManagementException("Error occurred while obtaining the device for id " +
|
||||||
|
"'" + deviceId.getId() + "'", e);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new DeviceManagementException("Error occurred while opening a connection to the data source", e);
|
||||||
|
} finally {
|
||||||
|
DeviceManagementDAOFactory.closeConnection();
|
||||||
|
}
|
||||||
|
if (device != null) {
|
||||||
|
// The changes made here to prevent unit tests getting failed. They failed because when running the unit
|
||||||
|
// tests there is no osgi services. So getDeviceManager() returns a null.
|
||||||
|
DeviceManager deviceManager = this.getDeviceManager(deviceId.getType());
|
||||||
|
if (deviceManager == null) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Device Manager associated with the device type '" + deviceId.getType() + "' is null. " +
|
||||||
|
"Therefore, not attempting method 'getDevice'");
|
||||||
|
}
|
||||||
|
return device;
|
||||||
|
}
|
||||||
|
Device pluginSpecificInfo = deviceManager.getDevice(deviceId);
|
||||||
|
if (pluginSpecificInfo != null) {
|
||||||
|
device.setFeatures(pluginSpecificInfo.getFeatures());
|
||||||
|
device.setProperties(pluginSpecificInfo.getProperties());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return device;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DeviceType> getAvailableDeviceTypes() throws DeviceManagementException {
|
public List<DeviceType> getAvailableDeviceTypes() throws DeviceManagementException {
|
||||||
List<DeviceType> deviceTypesInDatabase;
|
List<DeviceType> deviceTypesInDatabase;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user