Class AccountDAOImpl

java.lang.Object
it.unisa.c03.myPersonalTrainer.account.dao.AccountDAOImpl
All Implemented Interfaces:
AccountDAO

public class AccountDAOImpl
extends java.lang.Object
implements AccountDAO
  • Constructor Summary

    Constructors
    Constructor Description
    AccountDAOImpl()  
  • Method Summary

    Modifier and Type Method Description
    Account findAccountByEmail​(java.lang.String email)
    this function can check if the email is into the db.
    java.lang.String getAccountDocumentIdByEmail​(java.lang.String email)
    This DAO method looks for the document id of an account.
    java.util.ArrayList<Account> getAccounts()
    This method extracts accounts from database.
    boolean saveAccount​(Account utente)
    this function save the account into the db.
    boolean updatePassword​(java.lang.String email, java.lang.String password)
    This DAO method changes the password of an account.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AccountDAOImpl

      public AccountDAOImpl()
  • Method Details

    • saveAccount

      public boolean saveAccount​(Account utente) throws java.io.IOException
      this function save the account into the db.
      Specified by:
      saveAccount in interface AccountDAO
      Parameters:
      utente - the user
      Returns:
      true or false
      Throws:
      java.io.IOException
    • getAccounts

      public java.util.ArrayList<Account> getAccounts() throws java.io.IOException, java.util.concurrent.ExecutionException, java.lang.InterruptedException
      This method extracts accounts from database.
      Specified by:
      getAccounts in interface AccountDAO
      Returns:
      list of the accounts
      Throws:
      java.io.IOException
      java.util.concurrent.ExecutionException
      java.lang.InterruptedException
    • findAccountByEmail

      public Account findAccountByEmail​(java.lang.String email) throws java.io.IOException, java.util.concurrent.ExecutionException, java.lang.InterruptedException
      this function can check if the email is into the db.
      Specified by:
      findAccountByEmail in interface AccountDAO
      Parameters:
      email - is the pk to find the user into the db
      Returns:
      the Account given its mail
      Throws:
      java.io.IOException
      java.util.concurrent.ExecutionException
      java.lang.InterruptedException
    • updatePassword

      public boolean updatePassword​(java.lang.String email, java.lang.String password) throws java.io.IOException, java.util.concurrent.ExecutionException, java.lang.InterruptedException
      This DAO method changes the password of an account.
      Specified by:
      updatePassword in interface AccountDAO
      Parameters:
      email - of the account
      password - updated
      Returns:
      true after the change has taken place
      Throws:
      java.io.IOException
      java.util.concurrent.ExecutionException
      java.lang.InterruptedException
    • getAccountDocumentIdByEmail

      public java.lang.String getAccountDocumentIdByEmail​(java.lang.String email) throws java.io.IOException, java.util.concurrent.ExecutionException, java.lang.InterruptedException
      This DAO method looks for the document id of an account.
      Specified by:
      getAccountDocumentIdByEmail in interface AccountDAO
      Parameters:
      email - of the account
      Returns:
      the document Id
      Throws:
      java.io.IOException
      java.util.concurrent.ExecutionException
      java.lang.InterruptedException