mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
* Added update device implementation
This commit is contained in:
parent
707a8c9709
commit
34a8641582
@ -79,7 +79,23 @@ public class DeviceDAOImpl implements DeviceDAO {
|
||||
|
||||
@Override
|
||||
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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user