Class FlightSubmissionHelper

java.lang.Object
org.deltava.beans.FlightSubmissionHelper

public class FlightSubmissionHelper extends Object
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 Details

    • FlightSubmissionHelper

      public FlightSubmissionHelper(Connection c, FlightReport fr, Pilot p)
      Creates the helper.
      Parameters:
      c - the JDBC Connection to use
      fr - the FlightReport
      p - the Pilot
  • Method Details

    • setACARSInfo

      public void setACARSInfo(FlightInfo inf)
      Updates the ACARS Flight Information for this flight.
      Parameters:
      inf - a FlightInfo bean
    • setAirlineInfo

      public void setAirlineInfo(String appName, String dbName)
      Sets airline-dependent context information.
      Parameters:
      appName - the virtual airline code
      dbName - the database name
    • getACARSInfo

      public FlightInfo getACARSInfo()
      Returns the ACARS Flight Information.
      Returns:
      a FlightInfo bean
    • 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

      public Collection<PositionData> getTrackData()
      Returns the Online track data.
      Returns:
      a Collection of PositionData beans
    • getOnTimeEntry

      public ScheduleEntry getOnTimeEntry()
      Returns the Flight Schedule entry for the real-time flight being tracked.
      Returns:
      a ScheduleEntry, or none if no matching flight found
    • getCourse

      public Course getCourse()
      Returns the currently enrolled Flight Academy course for Academy flight.
      Returns:
      a Course, or null if none
    • addPositions

      public void addPositions(Collection<? extends GeospaceLocation> rtEntries)
      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

      public boolean checkFlightReports() throws DAOException
      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

      public void checkOnlineNetwork() throws DAOException
      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

      public void checkOnlineEvent() throws DAOException
      Checks a Flight Report for participation in an Online Event.
      Throws:
      DAOException - if a JDBC error occurs
      See Also:
    • checkRatings

      public void checkRatings() throws DAOException
      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

      public void calculateGates() throws DAOException
      Calculates the departure and arrival Gates used for this flight.
      Throws:
      DAOException - if a JDBC error occurs
    • calculateLoadFactor

      public void calculateLoadFactor(EconomyInfo econ)
      Calculates the payload load factor for this Flight.
      Parameters:
      econ - an EconomyInfo bean for the virtual airline
    • checkSchedule

      public Duration checkSchedule() throws DAOException
      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

      public void calculateRunways() throws DAOException
      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

      public void checkTour() throws DAOException
      Checks whether this Flight should be included as part of a Flight Tour.
      Throws:
      DAOException - if a JDBC error occurs