Class AccountManagerDB


  • public final class AccountManagerDB
    extends Object
    Data base connection.
    • 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.