Interface AccountService

All Known Implementing Classes:
AccountServiceImpl

public interface AccountService
  • Method Summary

    Modifier and Type Method Description
    boolean changePassword​(java.lang.String email, java.lang.String password)
    This service method changes the password of an account.
    boolean checkCredentials​(java.lang.String clientMail, java.lang.String newPassword)
    This function check the credentials of the client before insert into the db.
    Account getAccountByEmail​(java.lang.String email)
    This method return the account given its mail.
    boolean loginAccount​(java.lang.String email, java.lang.String password)
    This function allow to verify the credentials typed in login form.
    boolean registerAccount​(Account utente)
    This function give the possibility to register a new user into the system.
    boolean searchAccountByEmail​(java.lang.String email)
    This service method checks if an account exists in the database.
    void sendEmail​(java.lang.String account, java.lang.String pw)
    This method send an Email with new account credentials.
    boolean verifyIsAdmin​(Account account)  
    java.util.ArrayList<Account> viewInfoAccount()
    This function return the list of the accounts registered into the db.
  • Method Details

    • loginAccount

      boolean loginAccount​(java.lang.String email, java.lang.String password) throws java.io.IOException, java.util.concurrent.ExecutionException, java.lang.InterruptedException
      This function allow to verify the credentials typed in login form.
      Parameters:
      email -
      password -
      Returns:
      true if credentials are in the Database, false if the credentials aren't linked to an account stored in the Database
      Throws:
      java.io.IOException
      java.util.concurrent.ExecutionException
      java.lang.InterruptedException
    • viewInfoAccount

      java.util.ArrayList<Account> viewInfoAccount() throws java.io.IOException, java.util.concurrent.ExecutionException, java.lang.InterruptedException
      This function return the list of the accounts registered into the db.
      Returns:
      list of all accounts saved.
      Throws:
      java.io.IOException - exception
      java.util.concurrent.ExecutionException
      java.lang.InterruptedException
    • registerAccount

      boolean registerAccount​(Account utente) throws java.io.IOException, java.lang.IllegalArgumentException, java.util.concurrent.ExecutionException, java.lang.InterruptedException
      This function give the possibility to register a new user into the system.
      Parameters:
      utente - user into the db
      Returns:
      true if is possible to insert the account after check of the credentials, false when fails the check of the credentials or the email is just registered
      Throws:
      java.io.IOException - //
      java.lang.IllegalArgumentException - //
      java.util.concurrent.ExecutionException
      java.lang.InterruptedException
    • checkCredentials

      boolean checkCredentials​(java.lang.String clientMail, java.lang.String newPassword) throws java.lang.IllegalArgumentException
      This function check the credentials of the client before insert into the db.
      Parameters:
      clientMail - email of the client
      newPassword - new password to update
      Returns:
      true if the credentials follow the regular-expression, false when something is typed wrong.
      Throws:
      java.lang.IllegalArgumentException - //
    • searchAccountByEmail

      boolean searchAccountByEmail​(java.lang.String email) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.io.IOException
      This service method checks if an account exists in the database.
      Parameters:
      email - referring to the account to search for
      Returns:
      true if the account exists, false if not
      Throws:
      java.lang.InterruptedException
      java.util.concurrent.ExecutionException
      java.io.IOException
    • getAccountByEmail

      Account getAccountByEmail​(java.lang.String email) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.io.IOException
      This method return the account given its mail.
      Parameters:
      email - referring to the account to search for
      Returns:
      the Account if it exists, null if not
      Throws:
      java.lang.InterruptedException
      java.util.concurrent.ExecutionException
      java.io.IOException
    • changePassword

      boolean changePassword​(java.lang.String email, java.lang.String password) throws java.io.IOException, java.util.concurrent.ExecutionException, java.lang.InterruptedException
      This service method changes the password of an account.
      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
    • verifyIsAdmin

      boolean verifyIsAdmin​(Account account) throws java.lang.IllegalArgumentException
      Parameters:
      account - Account of user registred into the DataBase.
      Returns:
      Return true if the following account is a Personal Trainer's account.
      Throws:
      java.lang.IllegalArgumentException
    • sendEmail

      void sendEmail​(java.lang.String account, java.lang.String pw) throws org.apache.commons.mail.EmailException
      This method send an Email with new account credentials.
      Parameters:
      account -
      pw -
      Throws:
      org.apache.commons.mail.EmailException