Further fixing retrieving application list with device info

revert-70aa11f8
prabathabey 8 years ago
parent d3ce96585f
commit 1a29a9f58f

@ -62,9 +62,11 @@ public class Device implements Serializable {
private List<Device.Property> properties; private List<Device.Property> properties;
@ApiModelProperty(name = "advanceInfo", value = "This defines the device registration related information. " + @ApiModelProperty(name = "advanceInfo", value = "This defines the device registration related information. " +
"It is mandatory to define this information.", required = true) "It is mandatory to define this information.", required = false)
private DeviceInfo deviceInfo; private DeviceInfo deviceInfo;
@ApiModelProperty(name = "applications", value = "This represents the application list installed into the device",
required = false)
private List<Application> applications; private List<Application> applications;
public Device() { public Device() {

@ -539,6 +539,20 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
DeviceManagementDAOFactory.closeConnection(); DeviceManagementDAOFactory.closeConnection();
} }
device.setDeviceInfo(info); device.setDeviceInfo(info);
try {
DeviceManagementDAOFactory.openConnection();
List<Application> 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(device.getType()); DeviceManager deviceManager = this.getDeviceManager(device.getType());
if (deviceManager == null) { if (deviceManager == null) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {

Loading…
Cancel
Save