* Added update device implementation

revert-70aa11f8
Dulitha Wijewantha 10 years ago
parent 707a8c9709
commit 34a8641582

@ -79,7 +79,23 @@ public class DeviceDAOImpl implements DeviceDAO {
@Override @Override
public void updateDevice(Device device) throws DeviceManagementDAOException { public void updateDevice(Device device) throws DeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String sql =
"UPDATE DM_DEVICE SET STATUS=?, OWNER=? WHERE DEVICE_IDENTIFICATION=?";
stmt = conn.prepareStatement(sql);
stmt.setString(1, device.getStatus().toString());
stmt.setString(2, device.getOwnerId());
stmt.setString(3, device.getDeviceIdentificationId());
stmt.executeUpdate();
} catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while enrolling device " +
"'" + device.getName() + "'", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
} }
@Override @Override

Loading…
Cancel
Save