public class UserDB extends ObjectDB
Constructor and Description |
---|
UserDB()
Class constructor that fetches the connection to the production database.
|
UserDB(DatabaseConnection databaseConnection)
Class constructor that stores the given database connection for later use.
|
Modifier and Type | Method and Description |
---|---|
void |
addUser(User user)
Inserts a new entry in the database.
|
User |
getUserByName(java.lang.String userName)
Return the User with the given user name.
|
void |
updatePassword(java.lang.String userName,
java.lang.String newHashedPassword)
Allows updating the password of a user in the database.
|
void |
updateUserName(java.lang.String oldUserName,
java.lang.String newUserName)
Allows updating the profile in the database by giving a new user name to an
account.
|
emptyAllTables, getDatabaseConnection
public UserDB() throws DatabaseConnectionException
DatabaseConnectionException
public UserDB(DatabaseConnection databaseConnection)
databaseConnection
- public void updateUserName(java.lang.String oldUserName, java.lang.String newUserName) throws UserNameTakenException
oldUserName
- newUserName
- UserNameTakenException
public void updatePassword(java.lang.String userName, java.lang.String newHashedPassword) throws DatabaseException
userName
- newHashedPassword
- DatabaseException
public User getUserByName(java.lang.String userName) throws DatabaseException, NoSuchUserFoundException
userName
- DatabaseException
NoSuchUserFoundException
public void addUser(User user) throws UserNameTakenException
user
- UserNameTakenException