Class GetFlightReports
java.lang.Object
org.deltava.dao.DAO
org.deltava.dao.GetFlightReports
- Direct Known Subclasses:
GetFlightReportACARS
A Data Access Object to load Flight Reports.
- Since:
- 1.0
- Version:
- 11.5
- Author:
- Luke
-
Field Summary
Fields inherited from class org.deltava.dao.DAO
_queryMax, _queryStart, _queryTimeout, WGS84_SRID
-
Constructor Summary
ConstructorsConstructorDescriptionInitializes the DAO with a given JDBC connection. -
Method Summary
Modifier and TypeMethodDescriptionprotected static List
<FlightReport> Helper method to load PIREP data.Returns a PIREP with a particular database ID.Returns an ACARS-logged PIREP with a particular ACARS Flight ID.getByAssignment
(int id, String dbName) Returns all Flight Reports associated with a particular Flight Assignment.getByEvent
(int id, String dbName) Returns all Flight Reports associated with a particular Online Event.getByNetwork
(OnlineNetwork net, String dbName) Returns approved Flight Reports flown on a particular Online Network.getByPilot
(int id, LogbookSearchCriteria criteria) Returns all Flight Reports for a particular Pilot, using a sort column.getByStatus
(Collection<FlightStatus> status, String orderBy) Returns all Flight Reports in particular statuses.Returns all Flight Reports associated with a particular Pilot and Flight Tour.void
getCaptEQType
(Collection<FlightReport> pireps) Populates the Equipment Types a collection of PIREPs counts towards promotion in.int
getCheckRideQueueSize
(String eqType, boolean includeAcademy) Returns the number of Flight Reports awaiting disposition.getDiversion
(Airport a, int pilotID, String db) Retrieves held/submitted Flight diversions for a particular Pilot.Loads a Draft Flight Report.getDraftReports
(int pilotID, RoutePair rp, String dbName) Returns Draft Flight Reports for a particular Pilot (with optional city pair).getElite
(int id) Returns the Elite program score for a Flight Report.getEliteFlights
(int id, int year) Returns all Flight Reports for a given Elite program year.int
Returns the number of held Flight Reports for a particular Pilot.getLogbookCalendar
(int id, String dbName, Instant startDate, int days) Loads all Flight Reports for a Pilot for a particular date range.void
getOnlineTotals
(Map<Integer, Pilot> pilots, String dbName) Returns online and ACARS legs/hours for a group of Pilots.void
getOnlineTotals
(Pilot p, String dbName) Gets online and ACARS legs/hours for a particular Pilot.getRoutePairs
(int pilotID, int days) Returns the city pairs flown by a particular Pilot.void
loadCaptEQTypes
(int pilotID, Collection<FlightReport> pireps, String dbName) Load promotion flags for a large number of Flight Reports from a single Pilot.Methods inherited from class org.deltava.dao.DAO
commitTransaction, createTimestamp, executeIDs, executeUpdate, executeUpdate, expandDate, formatDBName, formatLocation, getNewID, getQueryCount, prepare, prepareWithoutLimits, rollbackTransaction, setQueryMax, setQueryStart, setQueryTimeout, startTransaction, toID, toID, toInstant
-
Constructor Details
-
GetFlightReports
Initializes the DAO with a given JDBC connection.- Parameters:
c
- the JDBC connection to use
-
-
Method Details
-
get
Returns a PIREP with a particular database ID.- Parameters:
id
- the database IDdbName
- the database Name- Returns:
- the Flight Report, or null if not found
- Throws:
DAOException
- if a JDBC error occurs
-
getACARS
Returns an ACARS-logged PIREP with a particular ACARS Flight ID.- Parameters:
dbName
- the database NameacarsID
- the ACARS flight ID- Returns:
- the ACARSFlightReport, or null if not found
- Throws:
DAOException
- if a JDBC error occurs
-
getByStatus
public List<FlightReport> getByStatus(Collection<FlightStatus> status, String orderBy) throws DAOException Returns all Flight Reports in particular statuses.- Parameters:
status
- a Collection of Integer status codesorderBy
- the ORDER BY SQL statement- Returns:
- a List of FlightReports in the specified statuses
- Throws:
DAOException
- if a JDBC error occurs
-
getCheckRideQueueSize
Returns the number of Flight Reports awaiting disposition.- Parameters:
eqType
- the equipment type, or null if allincludeAcademy
- TRUE if Flight Academy check rides should be counted, otherwise FALSE- Returns:
- the number Check Ride Flight Reports in SUBMITTED status
- Throws:
DAOException
- if a JDBC error occurs
-
getHeld
Returns the number of held Flight Reports for a particular Pilot.- Parameters:
pilotID
- the Pilot's database IDdbName
- the database name- Returns:
- the number of Flight Reports in HOLD status
- Throws:
DAOException
- if a JDBC error occurs
-
getByAssignment
Returns all Flight Reports associated with a particular Flight Assignment.- Parameters:
id
- the Flight Assignment database IDdbName
- the database name- Returns:
- a List of FlightReports
- Throws:
DAOException
- if a JDBC error occurs
-
getByNetwork
Returns approved Flight Reports flown on a particular Online Network.- Parameters:
net
- the OnlineNetworkdbName
- the database name- Returns:
- a List of FlightReport beans
- Throws:
DAOException
- if a JDBC error occurs
-
getByEvent
Returns all Flight Reports associated with a particular Online Event.- Parameters:
id
- the Online Event database IDdbName
- the database name- Returns:
- a List of FlightReports
- Throws:
DAOException
- if a JDBC error occurs
-
getByTour
Returns all Flight Reports associated with a particular Pilot and Flight Tour.- Parameters:
pilotID
- the Pilot database IDtourID
- the Tour database IDdbName
- the database name- Returns:
- a List of Flight Reports, ordered by submission date
- Throws:
DAOException
- if a JDBC error occurs
-
getLogbookCalendar
public List<FlightReport> getLogbookCalendar(int id, String dbName, Instant startDate, int days) throws DAOException Loads all Flight Reports for a Pilot for a particular date range.- Parameters:
id
- the Pilot database IDdbName
- the database namestartDate
- the start datedays
- the number of days forward to include- Returns:
- a List of FlightReports
- Throws:
DAOException
- if a JDBC error occurs
-
getEliteFlights
Returns all Flight Reports for a given Elite program year.- Parameters:
id
- the Pilot database IDyear
- the Elite Program year- Returns:
- a List of FlightREports
- Throws:
DAOException
- if a JDBC error occurs
-
getByPilot
Returns all Flight Reports for a particular Pilot, using a sort column.- Parameters:
id
- the Pilot database IDcriteria
- the search criteria- Returns:
- a List of FlightReports
- Throws:
DAOException
- if a JDBC error occurs
-
getOnlineTotals
Gets online and ACARS legs/hours for a particular Pilot.- Parameters:
p
- the Pilot to query for (the object will be updated)dbName
- the database name- Throws:
DAOException
- if a JDBC error occurs- See Also:
-
getOnlineTotals
Returns online and ACARS legs/hours for a group of Pilots.- Parameters:
pilots
- a Map of Pilot objects to populate with resultsdbName
- the database name- Throws:
DAOException
- if a JDBC error occurs
-
getDraft
Loads a Draft Flight Report.- Parameters:
id
- the Flight Report database IDdbName
- the database name- Returns:
- a DraftFlightReport, or null if not found or the Flight Report is not in draft status
- Throws:
DAOException
- if a JDBC error occurs
-
getDraftReports
public List<FlightReport> getDraftReports(int pilotID, RoutePair rp, String dbName) throws DAOException Returns Draft Flight Reports for a particular Pilot (with optional city pair).- Parameters:
pilotID
- the Pilot's Database IDrp
- the RoutePair, or null if nonedbName
- the database Name- Returns:
- a List of Draft FlightReports matching the above criteria
- Throws:
DAOException
- if a JDBC error occurs
-
getDiversion
Retrieves held/submitted Flight diversions for a particular Pilot.- Parameters:
a
- the Airport diverted topilotID
- the Pilot's database IDdb
- the database- Returns:
- a FlightReport, or null if not found
- Throws:
DAOException
- if a JDBC error occurs
-
getRoutePairs
Returns the city pairs flown by a particular Pilot.- Parameters:
pilotID
- the Pilot database IDdays
- the number of days back to search- Returns:
- a Collection of RoutePair beans
- Throws:
DAOException
- if a JDBC error occurs
-
execute
Helper method to load PIREP data.- Parameters:
ps
- a PreparedStatement- Returns:
- a List of FlightReport beans
- Throws:
SQLException
- if an error occurs
-
getCaptEQType
Populates the Equipment Types a collection of PIREPs counts towards promotion in.- Parameters:
pireps
- a Collection of FlightReport beans- Throws:
DAOException
- if a JDBC error occurs
-
getElite
Returns the Elite program score for a Flight Report.- Parameters:
id
- the Flight Report database ID- Returns:
- a FlightEliteScore bean, or null if not found
- Throws:
DAOException
- if a JDBC error occurs
-
loadCaptEQTypes
public void loadCaptEQTypes(int pilotID, Collection<FlightReport> pireps, String dbName) throws DAOException Load promotion flags for a large number of Flight Reports from a single Pilot. This is usally more efficient than a large set query.- Parameters:
pilotID
- the Pilot's database IDpireps
- a Collection of FlightReport beansdbName
- the database name- Throws:
DAOException
- if a JDBC error occurs
-