Package es.bsc.dataclay.logic.accountmgr
Class AccountManagerDB
- java.lang.Object
-
- es.bsc.dataclay.logic.accountmgr.AccountManagerDB
-
public final class AccountManagerDB extends Object
Data base connection.
-
-
Constructor Summary
Constructors Constructor Description AccountManagerDB(SQLiteDataSource dataSource)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close DB.void
createTables()
Create tables of MDS.void
dropTables()
Delete the tables of MDS.boolean
existsAccountByID(AccountID accountID)
Check if there is an account with ID providedboolean
existsAccountByName(String accountName)
Check if there is an account with name providedList<Account>
getAllNormalAccounts()
Get all normal accountsAccount
getByID(AccountID accountID)
Get Account by IDAccount
getByName(String accountName)
Get Account by namevoid
store(Account account)
Store Account into databasevoid
store(PasswordCredential passwordCredential)
Store credential into database
-
-
-
Constructor Detail
-
AccountManagerDB
public AccountManagerDB(SQLiteDataSource dataSource)
Constructor.- Parameters:
dataSource
- Data base source.
-
-
Method Detail
-
createTables
public void createTables()
Create tables of MDS.
-
dropTables
public void dropTables()
Delete the tables of MDS. Just the other way around of createTables --much simpler.
-
store
public void store(PasswordCredential passwordCredential)
Store credential into database- Parameters:
passwordCredential
- Password credential
-
store
public void store(Account account)
Store Account into database- Parameters:
account
- The account
-
getByID
public Account getByID(AccountID accountID)
Get Account by ID- Parameters:
accountID
- ID of the Account- Returns:
- The Account
-
getByName
public Account getByName(String accountName)
Get Account by name- Parameters:
accountName
- Name of the Account- Returns:
- The Account
-
existsAccountByName
public boolean existsAccountByName(String accountName)
Check if there is an account with name provided- Parameters:
accountName
- Name of the account- Returns:
- TRUE if exists. FALSE otherwise
-
existsAccountByID
public boolean existsAccountByID(AccountID accountID)
Check if there is an account with ID provided- Parameters:
accountID
- ID of the account- Returns:
- TRUE if exists. FALSE otherwise
-
getAllNormalAccounts
public List<Account> getAllNormalAccounts()
Get all normal accounts- Returns:
- The accounts with normal role.
-
close
public void close()
Close DB.
-
-