Class GetRawSchedule
java.lang.Object
org.deltava.dao.DAO
org.deltava.dao.GetRawSchedule
A Data Access Object to load raw schedule entries.
- Since:
- 8.0
- Version:
- 11.2
- 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 TypeMethodDescriptionget(ScheduleSource src, int line) Loads an individual raw schedule entry.getAirlines(ScheduleSource src, Airport a) Returns the Airlines that service a particular Airport in a schedule source.getDays(ScheduleSource src, Airport a, boolean isDestination) Returns the days of the week an Airport has flights from a particular schedule source.Returns the mapping of Airlines to Schedule sources.getSources(boolean isLoaded, String db) Returns all raw schedule sources.list(ScheduleSource src, Airport aD, Airport aA) Lists all raw schedule entries between two Airports from a particular schedule source.load(ScheduleSource src, LocalDate ld) Loads all raw schedule entries for a particular day of the week.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
-
GetRawSchedule
Initializes the Data Access Object.- Parameters:
c- the JDBC connection to use
-
-
Method Details
-
getSources
Returns all raw schedule sources.- Parameters:
isLoaded- TRUE to only include loaded sources, otherwise FALSEdb- the database name- Returns:
- a Collection of ScheduleSourceInfo beans
- Throws:
DAOException- if a JDBC error occurs
-
getSourceAirlines
Returns the mapping of Airlines to Schedule sources.- Returns:
- a Map of Collections of Airlines, keyed by ScheduleSource
- Throws:
DAOException- if a JDBC error occurs
-
get
Loads an individual raw schedule entry.- Parameters:
src- the ScheduleSourceline- the source line number- Returns:
- a RawScheduleEntry, or null if not found
- Throws:
DAOException- if a JDBC error occurs
-
getAirlines
Returns the Airlines that service a particular Airport in a schedule source.- Parameters:
src- the ScheduleSource or null for alla- the Airport- Returns:
- a Collection of Airline beans
- Throws:
DAOException- if a JDBC error occurs
-
getDays
public Collection<DayOfWeek> getDays(ScheduleSource src, Airport a, boolean isDestination) throws DAOException Returns the days of the week an Airport has flights from a particular schedule source.- Parameters:
src- the ScheduleSource, or null for alla- the AirportisDestination- TRUE if selecting arriving flights, otherwise FALSE- Returns:
- a Collection of DayOfWeek enums
- Throws:
DAOException- if a JDBC error occurs
-
list
Lists all raw schedule entries between two Airports from a particular schedule source.- Parameters:
src- a ScheduleSourceaD- the departure Airport, or null for allaA- the arrival Airport, or null for all- Returns:
- a List of RawScheduleEntry beans
- Throws:
DAOException- if a JDBC error occurs
-
load
Loads all raw schedule entries for a particular day of the week.- Parameters:
src- the ScheduleSourceld- the schedule effective date, or null for all- Returns:
- a Collection of RawScheduleEntry beans
- Throws:
DAOException- if a JDBC error occurs
-