Class GetPilot

Direct Known Subclasses:
GetPilotDirectory, GetPilotNotify, GetPilotRecognition

public class GetPilot extends PilotReadDAO
A Data Access Object to get Pilots from the database, for use in roster operations.
Since:
1.0
Version:
11.1
Author:
Luke
  • Constructor Details

    • GetPilot

      public GetPilot(Connection c)
      Creates the DAO from a JDBC connection.
      Parameters:
      c - the JDBC connection to use
  • Method Details

    • getNewestPilots

      public List<Pilot> getNewestPilots() throws DAOException
      Gets the newest pilots (with the highest pilot IDs).
      Returns:
      a List of Pilots
      Throws:
      DAOException - if a JDBC error occurs
    • getCurrencyPilots

      public Collection<Pilot> getCurrencyPilots() throws DAOException
      Returns pilots who have enabled currency-based Check Rides.
      Returns:
      a List of Pilots
      Throws:
      DAOException - if a JDBC error occurs
    • getByEMail

      public Pilot getByEMail(String eMail) throws DAOException
      Gets a Pilot based on e-mail address.
      Parameters:
      eMail - the e-mail address
      Returns:
      a Pilot, or null if not found
      Throws:
      DAOException - if a JDBC error occurs
    • getPilotByCode

      public Pilot getPilotByCode(int pilotCode, String dbName) throws DAOException
      Gets a Pilot based on a pilot code. This populates ratings and roles.
      Parameters:
      pilotCode - the pilot code to search for (eg. 123 for DVA123).
      dbName - the database name
      Returns:
      the Pilot object, or null if the pilot code was not found
      Throws:
      DAOException - if a JDBC error occurs
    • getActivePilots

      public List<Integer> getActivePilots(String orderBy) throws DAOException
      Returns all Active and On Leave Pilots.
      Parameters:
      orderBy - the database column to sort the results by
      Returns:
      a List of all active/on leave Pilots
      Throws:
      DAOException - if a JDBC error occurs
    • getPilotsByEQ

      public List<Pilot> getPilotsByEQ(EquipmentType eq, String sortBy, boolean showActive, Rank rank) throws DAOException
      Returns all active Pilots with a particular rank in a particular equipment program.
      Parameters:
      eq - the EquipmentType bean
      sortBy - an optional sort SQL snippet
      showActive - TRUE if only active pilots should be displayed, otherwise FALSE
      rank - the Rank
      Returns:
      a List of Pilots in a particular equipment type
      Throws:
      DAOException - if a JDBC error occurs
    • getPilotsByRank

      public List<Pilot> getPilotsByRank(Rank rank) throws DAOException
      Returns all Active pilots with a particular rank.
      Parameters:
      rank - the rank
      Returns:
      a List of active Pilots with a particular rank
      Throws:
      DAOException - if a JDBC error occurs
    • getPilotsByLetter

      public List<Pilot> getPilotsByLetter(String letter) throws DAOException
      Returns Pilots whose last name begins with a particular letter.
      Parameters:
      letter - the first Letter of the last name
      Returns:
      a List of Pilots
      Throws:
      DAOException - if a JDBC error occurs
      IllegalArgumentException - if letter isn't a letter according to Character.isLetter(char)
      NullPointerException - if letter is null
    • getPilotsByStatus

      public List<Pilot> getPilotsByStatus(PilotStatus status) throws DAOException
      Returns Pilots based upon their status.
      Parameters:
      status - a PilotStatus
      Returns:
      a List of Pilots
      Throws:
      DAOException - if a JDBC error occurs
    • getPilots

      public List<Pilot> getPilots() throws DAOException
      Returns all Pilots.
      Returns:
      a List of Pilots
      Throws:
      DAOException - if a JDBC error occurs
    • search

      public List<Pilot> search(String dbName, String fName, String lName) throws DAOException
      Searches for Pilots matching certain name criteria, using a SQL LIKE search.
      Parameters:
      dbName - the database name
      fName - the Pilot's First Name, containing wildcards accepted by the JDBC implementation's LIKE operator
      lName - the Pilot's Last Name, containing wildcards accepted by the JDBC implementation's LIKE operator
      Returns:
      a List of Pilots
      Throws:
      DAOException - if a JDBC error occurs
    • search

      public List<Pilot> search(String dbName, String fName, String lName, String eMail, Collection<String> ratings) throws DAOException
      Searches for Pilots matching certain search criteria, using a SQL LIKE search.
      Parameters:
      dbName - the database name
      fName - the Pilot's First Name, containing wildcards accepted by the JDBC implementation's LIKE operator
      lName - the Pilot's Last Name, containing wildcards accepted by the JDBC implementation's LIKE operator
      eMail - the Pilot's e-mail Address, , containing wildcards accepted by the JDBC implementation's LIKE operator
      ratings - a Collection of Ratings which the Pilots need to have
      Returns:
      a List of Pilots
      Throws:
      DAOException - if a JDBC error occurs