Class GetElite
java.lang.Object
org.deltava.dao.DAO
org.deltava.dao.EliteDAO
org.deltava.dao.GetElite
A Data Access Object to load Elite status levels.
- Since:
- 9.2
- Version:
- 11.5
- Author:
- Luke
-
Field Summary
Fields inherited from class EliteDAO
_lstCache, _lvlCache, _stCacheModifier and TypeFieldDescriptionprotected static final Cache<EliteLifetimeStatus> The Elite lifetime status cache.protected static final Cache<EliteLevel> The EliteLevel cache.protected static final Cache<EliteStatus> The Elite status cache.Fields inherited from class DAO
_queryMax, _queryStart, _queryTimeout, WGS84_SRIDModifier and TypeFieldDescriptionprotected intThe maximum number of rows to return.protected intThe row number at which to start returning results.protected intThe query timeout, in seconds.protected static final intThe SRID used for geolocation queries. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAllLifetimeStatus(int pilotID, String dbName) Returns all lifetime Elite status for a particular Pilot.getAllStatus(int pilotID, int year) Loads a Pilot's Elite status updates for a particular year.Returns all Elite status levels.getLevels(int year) Returns Elite status levels for a given year.Returns all Lifetime status levels.getLifetimeStatus(int pilotID, String dbName) Returns the most recent lifetime Elite status for a particular Pilot.getLifetimeStatus(Collection<?> IDs, String dbName) Retrieves Elite lifetime program status for a number of Pilots.intgetPilotCount(EliteLevel lvl) Counts the number of Pilots who have achieved a given Elite status level.intCounts the number of Pilots who have achieved a given lifetime Elite status level.getPilots(EliteLevel lvl) Loads all Pilots who have obtained a particular Elite status in a given year.Loads all Pilots who have obtained a particular lifetime Elite status.getStatus(int pilotID, int year) Loads a Pilot's most recent Elite status for a given year.getStatus(Collection<?> IDs, int year, String dbName) Retrieves Elite program status for a number of Pilots.Methods inherited from class EliteDAO
executeLevel, executeLifetime, get, getLifetime, populateLevelsModifier and TypeMethodDescriptionprotected static List<EliteLevel> Helper method to parse Elite level result sets.protected static List<EliteLifetime> Helper method to process Elite lifetime level result sets.Returns an Elite status level for a particular year.getLifetime(String code, String dbName) Returns a lifetime Elite status level.protected voidpopulateLevels(Collection<? extends EliteLevelBean> data) Helper method to populate EliteLevel beans.Methods inherited from class DAO
commitTransaction, createTimestamp, executeIDs, executeUpdate, executeUpdate, expandDate, formatDBName, formatLocation, getNewID, getQueryCount, prepare, prepareWithoutLimits, rollbackTransaction, setQueryMax, setQueryStart, setQueryTimeout, startTransaction, toID, toID, toInstantModifier and TypeMethodDescriptionprotected voidCommits a multi-step transaction to the database.protected static TimestampNull-safe conversion of an Instant to a Timestamp.Helper method to extract database ID data from the result set.protected static intexecuteUpdate(PreparedStatement ps, int minUpdateCount) Executes an UPDATE transaction on a prepared statement, and throws aSQLExceptionif less than the expected number of rows were updated.protected static intexecuteUpdate(PreparedStatement ps, int minPerUpdate, int minTotal) Executes an batched UPDATE transaction on a prepared statement, and throws aSQLExceptionif less than the expected number of rows were updated per batch entry.protected static InstantexpandDate(Date dt) Converts a date-only JDBC value into a full timestamp.protected static StringformatDBName(String db) Formats a database name by converting to lowercase.protected static StringConverts a geographic location into a MySQL WKT formatted point.protected intgetNewID()Returns the AUTO_INC column value generated by the previous JDBC transaction.static final longReturns the total number of queries executed since the JVM was started.protected PreparedStatementInitialize the prepared statement with an arbitrary SQL statement.protected PreparedStatementInitialize the prepared statement with an abitrary SQL statement, without applying the DAO's query result limitations.protected voidRolls back a multi-step transaction before it is completed.final voidsetQueryMax(int maxRows) Sets the maximum number of rows in the returned result set.final voidsetQueryStart(int rowStart) Sets the first row of the results to return.voidsetQueryTimeout(int timeout) Sets the timeout for any SQL operations.protected voidMarks the start of a multi-step database transaction.protected static IntegerConverts a Database bean or an Integer into an Integer.protected static Collection<Integer> toID(Collection<?> ids) Converts a collection of Objects into Integer IDs.protected static InstantNull-safe conversion of a Timestamp to an Instant.
-
Constructor Details
-
GetElite
Initializes the Data Access Object.- Parameters:
c- the JDBC connection to use
-
-
Method Details
-
getLevels
Returns all Elite status levels.- Returns:
- a List of EliteLevel beans
- Throws:
DAOException- if a JDBC error occurs
-
getLevels
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
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 ofDatabaseBeanbeansdbName- 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 ofDatabaseBeanbeansyear- the plan yeardbName- 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
Returns the most recent lifetime Elite status for a particular Pilot.- Parameters:
pilotID- the Pilot database IDdbName- 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 IDdbName- the database name- Returns:
- a List of EliteLifetime beans, sorted by recency
- Throws:
DAOException- if a JDBC error occurs
-
getStatus
Loads a Pilot's most recent Elite status for a given year.- Parameters:
pilotID- the Pilot's database IDyear- the status year- Returns:
- an EliteStatus bean, or null
- Throws:
DAOException- if a JDBC error occurs
-
getAllStatus
Loads a Pilot's Elite status updates for a particular year.- Parameters:
pilotID- the Pilot's database IDyear- the year- Returns:
- a List of EliteStatus beans, ordered by acheivement date
- Throws:
DAOException- if a JDBC error occurs
-
getPilots
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
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
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
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
-