Fixing the isssue in retrieving the device info

merge-requests/7/head
geethkokila 9 years ago
parent 016414c076
commit 626142a59b

@ -238,20 +238,11 @@ public class SearchDAOImpl implements SearchDAO {
}
rs = stmt.executeQuery();
int deviceId = 0;
DeviceInfo dInfo;
while (rs.next()) {
DeviceInfo dInfo = new DeviceInfo();
if (deviceId != rs.getInt("DEVICE_ID")) {
deviceId = rs.getInt("DEVICE_ID");
dInfo = this.getDeviceInfo(devices, deviceId);
if (dInfo != null) {
dInfo.getDeviceDetailsMap().put(rs.getString("KEY_FIELD"), rs.getString("VALUE_FIELD"));
}
} else {
dInfo = this.getDeviceInfo(devices, rs.getInt("DEVICE_ID"));
dInfo.getDeviceDetailsMap().put(rs.getString("KEY_FIELD"), rs.getString("VALUE_FIELD"));
}
}
} catch (SQLException e) {
throw new SearchDAOException("Error occurred while retrieving the device properties.", e);
}
@ -262,6 +253,9 @@ public class SearchDAOImpl implements SearchDAO {
for (DeviceWrapper dw : devices) {
if (dw.getDevice().getId() == deviceId) {
if (dw.getDeviceInfo() == null) {
dw.setDeviceInfo(new DeviceInfo());
}
return dw.getDeviceInfo();
}
}

Loading…
Cancel
Save