use of SQLDatabase.SQLDatabaseEntities.WorkersTable in project SmartCity-Market by TechnionYP5777.
the class SQLDatabaseConnection method setPasswordWorker.
@Override
public void setPasswordWorker(String username, String newPassword) throws CriticalError, ClientNotExist {
log.debug("SQL Public setPasswordWorker: Worker: " + username + " sets password.");
if (!isWorkerExist(username)) {
log.debug("SQL Public setPasswordWorker: no such worker with username: " + username);
throw new ClientNotExist();
}
try {
// START transaction
connectionStartTransaction();
//Write part of transaction
//updating password
assignPasswordToRegisteredClient(new WorkersTable(), username, newPassword);
log.debug("SQL Public setPasswordWorker: Success setting password for username: " + username);
// END transaction
connectionCommitTransaction();
} catch (SQLDatabaseException e) {
connectionRollbackTransaction();
throw e;
} finally {
connectionEndTransaction();
}
}
Aggregations