Class GetPilotDirectory

All Implemented Interfaces:
PersonUniquenessDAO

public class GetPilotDirectory extends GetPilot implements PersonUniquenessDAO
A Data Access Object to obtain user Directory information for Pilots.
Since:
1.0
Version:
11.0
Author:
Luke
  • Constructor Details

    • GetPilotDirectory

      public GetPilotDirectory(Connection c)
      Initialize the Data Access Object.
      Parameters:
      c - the JDBC connection to use
  • Method Details

    • getByCode

      public Pilot getByCode(String pilotCode) throws DAOException
      Returns the Pilot with a particular Pilot Code.
      Parameters:
      pilotCode - the Pilot Code (eg DVA043)
      Returns:
      the Directory Name of the Pilot, or null if not found
      Throws:
      DAOException - if a JDBC error occurs
    • checkUnique

      public Collection<Integer> checkUnique(Person p, String dbName) throws DAOException
      Checks if a Person is unique, by checking the first/last names and the e-mail address.
      Specified by:
      checkUnique in interface PersonUniquenessDAO
      Parameters:
      p - the Person
      dbName - the database to search
      Returns:
      a Collection of database IDs
      Throws:
      DAOException - if a JDBC error occurs
    • checkUnique

      public Collection<Integer> checkUnique(Person p, String dbName, int days) throws DAOException
      Checks if a Person is unique, by checking the first/last names and the e-mail address.
      Specified by:
      checkUnique in interface PersonUniquenessDAO
      Parameters:
      p - the Person
      dbName - the database to search
      days - restrict uniqueness search to users created in the last number of days, or -1 for all
      Returns:
      a Collection of database IDs
      Throws:
      DAOException - if a JDBC error occurs
    • checkUniqueEMail

      public Collection<Integer> checkUniqueEMail(Person usr, String dbName) throws DAOException
      Checks whether a particular e-mail address is unique.
      Parameters:
      usr - the Person to check for
      dbName - the database to check
      Returns:
      a Collection of database IDs
      Throws:
      DAOException - if a JDBC error occurs
    • getByIMAddress

      public Pilot getByIMAddress(String addr) throws DAOException
      Returns users from the current database based on their Instant Message address.
      Parameters:
      addr - the address
      Returns:
      a Pilot, or null if not found
      Throws:
      DAOException - if a JDBC error occurs
    • getPermanent

      public Collection<Pilot> getPermanent() throws DAOException
      Returns all Pilots with permanent accounts.
      Returns:
      a Collection of Pilots
      Throws:
      DAOException - if a JDBC error occurs
    • getByRole

      public List<Pilot> getByRole(String roleName, String dbName) throws DAOException
      Returns all active Pilots who have a particular security role.
      Parameters:
      roleName - the role name
      dbName - the database name
      Returns:
      a List of Pilots
      Throws:
      DAOException - if a JDBC error occurs
    • getByRole

      public List<Pilot> getByRole(String roleName, String dbName, boolean activeOnly) throws DAOException
      Returns all Pilots who have a particular security role.
      Parameters:
      roleName - the role name
      dbName - the database name
      activeOnly - TRUE to only include active Pilots, otherwise FALSE
      Returns:
      a List of Pilots
      Throws:
      DAOException - if a JDBC error occurs
    • checkSoundex

      public Collection<Integer> checkSoundex(Person usr, String dbName) throws DAOException
      Performs a soundex search on a Person's last name to detect possible matches. The soundex implementation is dependent on the capabilities of the underlying database engine, and is not guaranteed to be consistent (or even supported) across different database servers.
      Specified by:
      checkSoundex in interface PersonUniquenessDAO
      Parameters:
      usr - the Person to check for
      dbName - the database name
      Returns:
      a Collection of Database IDs as Integers
      Throws:
      DAOException - if a JDBC error occurs