Class SetFlightReport
java.lang.Object
org.deltava.dao.DAO
org.deltava.dao.SetFlightReport
A Data Access object to write Flight Reports to the database.
- Since:
- 1.0
- Version:
- 12.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 TypeMethodDescriptionvoidclearPromoEQ(int id) Clears whether a Flight Report counts towards promotion to Captain.voiddelete(int id) Deletes a Flight Report from the database.booleandeleteACARS(int id) Deletes ACARS flight data from the database.booleanDeletes Elite program Flight Report data from the database.voiddispose(String db, Person usr, FlightReport pirep, FlightStatus status) Disposes of a Flight Report, by setting its status to Approved, Rejected or Held.voidsetPromoEQ(int id, Collection<String> eqTypes) Sets whether a Flight Report counts towards promotion to Captain.voidupdateLandingScore(int pirepID, double score) Updates a Flight Report's landing score.booleanupdatePaxCount(int pirepID) Updates passenger count for a flight report in the current airline.booleanupdatePaxCount(int pirepID, UserData ud) Updates passenger count based on load factor.voidwithdraw(FlightReport fr, String db) Marks a Flight Report as widhrdawn.voidwrite(FlightReport fr) Write a Flight Report to the default database.voidwrite(FlightReport fr, String db) Writes a Flight Report to the database.voidwriteACARS(FDRFlightReport fr, String dbName) Writes an ACARS-enabled Flight Report into the database.voidUpdates Flight Report comments.voidwriteElite(FlightEliteScore sc, String dbName) Writes Elite program scores to the database.voidwriteHistory(Collection<FlightHistoryEntry> upds, String dbName) Writes a Flight Report's status updates to the database.voidWrites SimBrief dispatch data to the database.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
-
SetFlightReport
Initialize the Data Access Object.- Parameters:
c- the JDBC connection to use
-
-
Method Details
-
delete
Deletes a Flight Report from the database.- Parameters:
id- the Flight Report database ID- Throws:
DAOException- if a JDBC error occurs
-
deleteACARS
Deletes ACARS flight data from the database.- Parameters:
id- the Flight Report database ID- Returns:
- TRUE if a record was deleted, otherwise FALSE
- Throws:
DAOException- if a JDBC error occurs
-
deleteElite
Deletes Elite program Flight Report data from the database.- Parameters:
fr- the FlightReport- Returns:
- TRUE if a record was deleted, otherwise FALSE
- Throws:
DAOException- if a JDBC error occurs
-
dispose
public void dispose(String db, Person usr, FlightReport pirep, FlightStatus status) throws DAOException Disposes of a Flight Report, by setting its status to Approved, Rejected or Held.- Parameters:
db- the database nameusr- the Person updating the Flight Reportpirep- the Flight Reportstatus- the new FlightStatus- Throws:
DAOException- if a JDBC error occursNullPointerException- if pirep is null
-
withdraw
Marks a Flight Report as widhrdawn.- Parameters:
fr- the FlightReportdb- the database name- Throws:
DAOException- if a JDBC error occurs
-
clearPromoEQ
Clears whether a Flight Report counts towards promotion to Captain.- Parameters:
id- the Flight Report database ID- Throws:
DAOException- if a JDBC error occurs
-
setPromoEQ
Sets whether a Flight Report counts towards promotion to Captain.- Parameters:
id- the Flight Report database IDeqTypes-- Throws:
DAOException- if a JDBC error occurs
-
writeComments
Updates Flight Report comments.- Parameters:
fr- the FlightReport bean- Throws:
DAOException- if a JDBC error occurs
-
updateLandingScore
Updates a Flight Report's landing score.- Parameters:
pirepID- the Flight Report database IDscore- the landing score- Throws:
DAOException- if a JDBC error occurs
-
updatePaxCount
Updates passenger count for a flight report in the current airline.- Parameters:
pirepID- the Flight Report database ID- Returns:
- TRUE if the passenger count was updated, otherwise FALSE
- Throws:
DAOException- if a JDBC error occurs
-
updatePaxCount
Updates passenger count based on load factor.- Parameters:
pirepID- the Flight Report database IDud- the Pilot's UserData object- Returns:
- TRUE if the passenger count was updated, otherwise FALSE
- Throws:
DAOException- if a JDBC error occurs
-
writeSimBrief
Writes SimBrief dispatch data to the database.- Parameters:
sb- the SimBrief package- Throws:
DAOException- if a JDBC error occurs
-
writeElite
Writes Elite program scores to the database.- Parameters:
sc- the FlightEliteScoredbName- the database name- Throws:
DAOException- if a JDBC error occurs
-
write
Write a Flight Report to the default database.- Parameters:
fr- the Flight Report- Throws:
DAOException- if a JDBC error occurs
-
write
Writes a Flight Report to the database.- Parameters:
fr- the Flight Reportdb- the Database to write to- Throws:
DAOException- if a JDBC error occurs
-
writeACARS
Writes an ACARS-enabled Flight Report into the database. This can handle INSERT and UPDATE operations.- Parameters:
fr- the Flight ReportdbName- the database name- Throws:
DAOException- if a JDBC error occurs
-
writeHistory
Writes a Flight Report's status updates to the database.- Parameters:
upds- a Collection of FlightHistoryEntry beansdbName- the database name- Throws:
DAOException- if a JDBC error occurs
-