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 AccountfindAccountByEmail(java.lang.String email)this function can check if the email is into the db.java.lang.StringgetAccountDocumentIdByEmail(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.booleansaveAccount(Account utente)this function save the account into the db.booleanupdatePassword(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
this function save the account into the db.- Specified by:
saveAccountin interfaceAccountDAO- 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.InterruptedExceptionThis method extracts accounts from database.- Specified by:
getAccountsin interfaceAccountDAO- Returns:
- list of the accounts
- Throws:
java.io.IOExceptionjava.util.concurrent.ExecutionExceptionjava.lang.InterruptedException
-
findAccountByEmail
public Account findAccountByEmail(java.lang.String email) throws java.io.IOException, java.util.concurrent.ExecutionException, java.lang.InterruptedExceptionthis function can check if the email is into the db.- Specified by:
findAccountByEmailin interfaceAccountDAO- Parameters:
email- is the pk to find the user into the db- Returns:
- the Account given its mail
- Throws:
java.io.IOExceptionjava.util.concurrent.ExecutionExceptionjava.lang.InterruptedException
-
updatePassword
public boolean updatePassword(java.lang.String email, java.lang.String password) throws java.io.IOException, java.util.concurrent.ExecutionException, java.lang.InterruptedExceptionThis DAO method changes the password of an account.- Specified by:
updatePasswordin interfaceAccountDAO- Parameters:
email- of the accountpassword- updated- Returns:
- true after the change has taken place
- Throws:
java.io.IOExceptionjava.util.concurrent.ExecutionExceptionjava.lang.InterruptedException
-
getAccountDocumentIdByEmail
public java.lang.String getAccountDocumentIdByEmail(java.lang.String email) throws java.io.IOException, java.util.concurrent.ExecutionException, java.lang.InterruptedExceptionThis DAO method looks for the document id of an account.- Specified by:
getAccountDocumentIdByEmailin interfaceAccountDAO- Parameters:
email- of the account- Returns:
- the document Id
- Throws:
java.io.IOExceptionjava.util.concurrent.ExecutionExceptionjava.lang.InterruptedException
-