Class GetElite


public class GetElite extends EliteDAO
A Data Access Object to load Elite status levels.
Since:
9.2
Version:
11.5
Author:
Luke
  • Constructor Details

    • GetElite

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

    • getLevels

      public List<EliteLevel> getLevels() throws DAOException
      Returns all Elite status levels.
      Returns:
      a List of EliteLevel beans
      Throws:
      DAOException - if a JDBC error occurs
    • getLevels

      public TreeSet<EliteLevel> getLevels(int year) throws DAOException
      Returns Elite status levels for a given year.
      Parameters:
      year - the program year
      Returns:
      a TreeSet of EliteLevel beans, in ascending order
      Throws:
      DAOException - if a JDBC error occurs
    • getLifetimeLevels

      public TreeSet<EliteLifetime> getLifetimeLevels() throws DAOException
      Returns all Lifetime status levels.
      Returns:
      a TreeSet of EliteLifetime beans, in asecnding order
      Throws:
      DAOException - if a JDBC error occurs
    • getLifetimeStatus

      public Map<Integer, EliteLifetimeStatus> getLifetimeStatus(Collection<?> IDs, String dbName) throws DAOException
      Retrieves Elite lifetime program status for a number of Pilots.
      Parameters:
      IDs - a Collection of pilot IDs. This can either be a Collection of Integers, a Collection of DatabaseBean beans
      dbName - the database name
      Returns:
      a Map of EliteLifetimeStatus beans for the specified year, keyed by Pilot database ID
      Throws:
      DAOException - if a JDBC error occurs
    • getStatus

      public Map<Integer, EliteStatus> getStatus(Collection<?> IDs, int year, String dbName) throws DAOException
      Retrieves Elite program status for a number of Pilots.
      Parameters:
      IDs - a Collection of pilot IDs. This can either be a Collection of Integers, a Collection of DatabaseBean beans
      year - the plan year
      dbName - the database name
      Returns:
      a Map of EliteStatus beans for the specified year, keyed by Pilot database ID
      Throws:
      DAOException - if a JDBC error occurs
    • getLifetimeStatus

      public EliteLifetimeStatus getLifetimeStatus(int pilotID, String dbName) throws DAOException
      Returns the most recent lifetime Elite status for a particular Pilot.
      Parameters:
      pilotID - the Pilot database ID
      dbName - the database name
      Returns:
      an EliteLifetime bean, or null if no status
      Throws:
      DAOException - if a JDBC error occurs
    • getAllLifetimeStatus

      public List<EliteLifetimeStatus> getAllLifetimeStatus(int pilotID, String dbName) throws DAOException
      Returns all lifetime Elite status for a particular Pilot.
      Parameters:
      pilotID - the Pilot database ID
      dbName - the database name
      Returns:
      a List of EliteLifetime beans, sorted by recency
      Throws:
      DAOException - if a JDBC error occurs
    • getStatus

      public EliteStatus getStatus(int pilotID, int year) throws DAOException
      Loads a Pilot's most recent Elite status for a given year.
      Parameters:
      pilotID - the Pilot's database ID
      year - the status year
      Returns:
      an EliteStatus bean, or null
      Throws:
      DAOException - if a JDBC error occurs
    • getAllStatus

      public List<EliteStatus> getAllStatus(int pilotID, int year) throws DAOException
      Loads a Pilot's Elite status updates for a particular year.
      Parameters:
      pilotID - the Pilot's database ID
      year - the year
      Returns:
      a List of EliteStatus beans, ordered by acheivement date
      Throws:
      DAOException - if a JDBC error occurs
    • getPilots

      public Collection<Integer> getPilots(EliteLevel lvl) throws DAOException
      Loads all Pilots who have obtained a particular Elite status in a given year.
      Parameters:
      lvl - the EliteLevel
      Returns:
      a Collection of Pilot database IDs
      Throws:
      DAOException - if a JDBC error occurs
    • getPilots

      public Collection<Integer> getPilots(EliteLifetime el) throws DAOException
      Loads all Pilots who have obtained a particular lifetime Elite status.
      Parameters:
      el - the EliteLifetime
      Returns:
      a Collection of Pilot database IDs
      Throws:
      DAOException - if a JDBC error occurs
    • getPilotCount

      public int getPilotCount(EliteLevel lvl) throws DAOException
      Counts the number of Pilots who have achieved a given Elite status level.
      Parameters:
      lvl - the EliteLevel
      Returns:
      the number of Pilots
      Throws:
      DAOException - if a JDBC error occurs
    • getPilotCount

      public int getPilotCount(EliteLifetime el) throws DAOException
      Counts the number of Pilots who have achieved a given lifetime Elite status level.
      Parameters:
      el - the EliteLifetime
      Returns:
      the number of Pilots
      Throws:
      DAOException - if a JDBC error occurs