Class GetAirport
java.lang.Object
org.deltava.dao.DAO
org.deltava.dao.GetAirport
A Data Access Object to load Airport data.
- Since:
- 1.0
- Version:
- 10.6
- Author:
- Luke
-
Field Summary
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 TypeMethodDescriptionReturns an airport object by its IATA or ICAO code.Returns the number of Airports served by each Airline.getAll()Returns all airports.getByAirline(Airline al, String sortBy) Returns all Airports served by a particular Airline.getByPilot(int id) Returns all Airports visited by a particular Pilot.Returns all Airports with upcoming Online Events.Returns the ICAO code for a particular airport from the DAFIF database.getTourAirports(String dbName) Returns all Airports with active Flight Tours.Returns all Airports with Terminal Routes.voidsetAppCode(String code) Overrides the application code (for use by the ACARS server).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
-
GetAirport
Creates the DAO with a JDBC connection.- Parameters:
c- the JDBC connection to usea
-
-
Method Details
-
setAppCode
Overrides the application code (for use by the ACARS server).- Parameters:
code- the new application code- Throws:
NullPointerException- if code is null
-
get
Returns an airport object by its IATA or ICAO code.- Parameters:
code- the airport IATA or ICAO code- Returns:
- an Airport object matching the requested code, or null if not found
- Throws:
DAOException- if a JDBC error occursNullPointerException- if code is null
-
getByAirline
Returns all Airports served by a particular Airline.- Parameters:
al- the Airline to query withsortBy- the SORT BY column- Returns:
- a List of Airport objects
- Throws:
DAOException- if a JDBC error occursNullPointerException- if al is null
-
getByPilot
Returns all Airports visited by a particular Pilot.- Parameters:
id- the Pilot's database ID- Returns:
- a Collection of Airport beans
- Throws:
DAOException- if a JDBC error occurs
-
getEventAirports
Returns all Airports with upcoming Online Events.- Returns:
- a Collection of Airports
- Throws:
DAOException- if a JDBC error occurs
-
getTourAirports
Returns all Airports with active Flight Tours.- Parameters:
dbName- the database name- Returns:
- a Collection of Airports
- Throws:
DAOException- if a JDBC error occurs
-
getWithTerminalRoutes
Returns all Airports with Terminal Routes.- Returns:
- a Collection of Airport beans
- Throws:
DAOException- if a JDBC error occurs
-
getAll
Returns all airports.- Returns:
- a Map of Airports, keyed by IATA/ICAO codes
- Throws:
DAOException- if a JDBC error occurs
-
getICAO
Returns the ICAO code for a particular airport from the DAFIF database.- Parameters:
iata- the IATA code- Returns:
- the ICAO code, or null if not found
- Throws:
DAOException- if a JDBC error occurs
-
getAirportCounts
Returns the number of Airports served by each Airline.- Returns:
- a Map of counts, keyed by Airline
- Throws:
DAOException- if a JDBC error occurs
-