Class FlightSubmissionHelper
java.lang.Object
org.deltava.beans.FlightSubmissionHelper
This is an ugly class that needs a proper home.
Flight submission is handled by an ACARS Command, a Web Command and two Services, all of which extend different parent classes. This is a poor
attempt to encapsulate common Flight Report validation and hydration behavior to avoid code duplication.
- Since:
- 10.0
- Version:
- 11.5
- Author:
- Luke
-
Constructor Summary
ConstructorsConstructorDescriptionFlightSubmissionHelper
(Connection c, FlightReport fr, Pilot p) Creates the helper. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPositions
(Collection<? extends GeospaceLocation> rtEntries) Adds position/track data to the helper.void
Calculates the departure and arrival Gates used for this flight.void
Calculates the payload load factor for this Flight.void
Calculates runways used and flags any runway length/surface violations.void
Checks the Aircraft used and sets any range/weight warnings.void
Checks this Flight for ETOPS and prohibited airspace violations.boolean
Checks for existing draft Flight Reports matching this Airport pair, and whether a predetrmined number of flight reports have been held.void
Checks a Flight Report for participation in an Online Event.void
Checks a Flight Report's Online Network flag.void
Checks whether the Pilot is rated in the Aircraft, and whether the flight counts for promotion to Captain.void
Checks this Flight for in-flight refueling.Checks the Flight Schedule to ensure the flight is valid, and sets any optional diversion/Flight Academy flags.void
Checks whether this Flight should be included as part of a Flight Tour.Returns the ACARS Flight Information.Returns the currently enrolled Flight Academy course for Academy flight.Returns the Flight Schedule entry for the real-time flight being tracked.Returns the Online track data.int
Returns the Online track ID.boolean
Returns whether the flight position data has been populated.boolean
Returns whether Online track data has been populated.void
setACARSInfo
(FlightInfo inf) Updates the ACARS Flight Information for this flight.void
setAirlineInfo
(String appName, String dbName) Sets airline-dependent context information.
-
Constructor Details
-
FlightSubmissionHelper
Creates the helper.- Parameters:
c
- the JDBC Connection to usefr
- the FlightReportp
- the Pilot
-
-
Method Details
-
setACARSInfo
Updates the ACARS Flight Information for this flight.- Parameters:
inf
- a FlightInfo bean
-
setAirlineInfo
-
getACARSInfo
-
hasPositionData
public boolean hasPositionData()Returns whether the flight position data has been populated.- Returns:
- TRUE if position data is present, otherwise FALSE
-
hasTrackData
public boolean hasTrackData()Returns whether Online track data has been populated.- Returns:
- TRUE if track data is present with a non-zero track ID, otherwise FALSE
-
getTrackID
public int getTrackID()Returns the Online track ID.- Returns:
- the ID
-
getTrackData
Returns the Online track data.- Returns:
- a Collection of PositionData beans
-
getOnTimeEntry
Returns the Flight Schedule entry for the real-time flight being tracked.- Returns:
- a ScheduleEntry, or none if no matching flight found
-
getCourse
Returns the currently enrolled Flight Academy course for Academy flight.- Returns:
- a Course, or null if none
-
addPositions
Adds position/track data to the helper. This usually is, but is not required to be, ACARSRouteEntry beans. Non-ACARS or XACARS flight reports may subsitiute other beans that are guaranteed to be GeospaceLocation beans, but nothing more.- Parameters:
rtEntries
- a Collection of GeospaceLocation beans
-
checkFlightReports
Checks for existing draft Flight Reports matching this Airport pair, and whether a predetrmined number of flight reports have been held.- Returns:
- TRUE if an existing flight report should be deleted, otherwise FALSE
- Throws:
DAOException
- if a JDBC error occurs
-
checkOnlineNetwork
Checks a Flight Report's Online Network flag. If online track data is found, it is loaded- Throws:
DAOException
- if a JDBC error occurs- See Also:
-
checkOnlineEvent
Checks a Flight Report for participation in an Online Event.- Throws:
DAOException
- if a JDBC error occurs- See Also:
-
checkRatings
Checks whether the Pilot is rated in the Aircraft, and whether the flight counts for promotion to Captain.- Throws:
DAOException
- if a JDBC error occurs
-
checkAircraft
public void checkAircraft()Checks the Aircraft used and sets any range/weight warnings. -
checkRefuel
public void checkRefuel()Checks this Flight for in-flight refueling. -
calculateGates
Calculates the departure and arrival Gates used for this flight.- Throws:
DAOException
- if a JDBC error occurs
-
calculateLoadFactor
Calculates the payload load factor for this Flight.- Parameters:
econ
- an EconomyInfo bean for the virtual airline
-
checkSchedule
Checks the Flight Schedule to ensure the flight is valid, and sets any optional diversion/Flight Academy flags.- Returns:
- the average flight time as a Duration
- Throws:
DAOException
- if a JDBC error occurs
-
calculateRunways
Calculates runways used and flags any runway length/surface violations.- Throws:
DAOException
- if a JDBC error occurs
-
checkAirspace
public void checkAirspace()Checks this Flight for ETOPS and prohibited airspace violations. -
checkTour
Checks whether this Flight should be included as part of a Flight Tour.- Throws:
DAOException
- if a JDBC error occurs
-