Class FlightReport

All Implemented Interfaces:
Serializable, Comparable<Object>, AuthoredBean, CalendarEntry, FlightData, FlightNumber, IDBean, RoutePair, ViewEntry, Cacheable
Direct Known Subclasses:
DraftFlightReport, FDRFlightReport

public class FlightReport extends Flight implements FlightData, AuthoredBean, CalendarEntry, ViewEntry
A class for dealing with PIREP data.
Since:
1.0
Version:
12.2
Author:
Luke
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • getRank

      public Rank getRank()
      Returns the Pilot's rank at the time of the Flight.
      Returns:
      the Pilot's rank
      See Also:
    • getLength

      public int getLength()
      Returns the length of the fllight in hours multiplied by ten. This is done to avoid rounding errors when using a floating point number.
      Specified by:
      getLength in class Flight
      Returns:
      the length of the flight in hours multiplied by ten
      See Also:
    • getDuration

      public Duration getDuration()
      Description copied from class: Flight
      A method to return the exact length of the flight.
      Specified by:
      getDuration in class Flight
      Returns:
      a Duration
    • getFDR

      public Recorder getFDR()
      Description copied from interface: FlightData
      Returns the Flight Data recorder used for this flight.
      Specified by:
      getFDR in interface FlightData
      Returns:
      a Recorder enum or null if none/unknown
    • getRemarks

      public String getRemarks()
      Returns the remarks for this Flight Report.
      Returns:
      the remarks
      See Also:
    • getRoute

      public String getRoute()
      Returns the filed Flight Route.
      Returns:
      the route
      See Also:
    • getComments

      public String getComments()
      Returns the disposition comments for this Flight Report.
      Returns:
      the disposition comments
      See Also:
    • getCaptEQType

      public Collection<String> getCaptEQType()
      Returns if this flight counts towards promotion in a particular equipment type program.
      Returns:
      the equipment type program name(s), or an empty Collection if this flight does not count
    • getStatusUpdates

      public Collection<FlightHistoryEntry> getStatusUpdates()
      Returns the flight status history.
      Returns:
      a Collection of FlightHistoryEntry beans
    • getDate

      public Instant getDate()
      Description copied from interface: FlightData
      Returns the date of the flight.
      Specified by:
      getDate in interface CalendarEntry
      Specified by:
      getDate in interface FlightData
      Returns:
      the date/time
    • getSubmittedOn

      public Instant getSubmittedOn()
      The date/time this Flight Report was submitted for approval.
      Returns:
      the submission date/time of this PIREP, null if never submitted.
      See Also:
    • getDisposedOn

      public Instant getDisposedOn()
      The date/time this Flight Report was disposed on. (approved or rejected)
      Returns:
      the approval/rejected date/time of this PIREP, null if not disposed of
      See Also:
    • getDatabaseID

      public int getDatabaseID(DatabaseID idType)
      Sets the database row ID of a relatied database row. This row may be present in the PILOTS, ASSIGNMENTS, ACARS_PIREPS or EVENTS table. This is typically used by a DAO
      Parameters:
      idType - the datbase row ID type
      Returns:
      the database row ID, or 0 if not found
      Throws:
      NullPointerException - if idType is null
      See Also:
    • hasDatabaseID

      public boolean hasDatabaseID(DatabaseID idType)
      Returns whether this Flight has a related database row ID.
      Parameters:
      idType - the database row ID type
      Returns:
      TRUE if the database row ID is not zero, otherwise FALSE
      Throws:
      NullPointerException - if idType is null
      See Also:
    • getAuthorID

      public int getAuthorID()
      Description copied from interface: AuthoredBean
      Returns the Author of this bean.
      Specified by:
      getAuthorID in interface AuthoredBean
      Returns:
      the author's database ID
      See Also:
    • getSimulator

      public Simulator getSimulator()
      Description copied from interface: FlightData
      Returns the Simulator used for this flight.
      Specified by:
      getSimulator in interface FlightData
      Returns:
      a Simulator
    • getAttributes

      public int getAttributes()
      Returns the attributes for this Flight Report.
      Returns:
      a bit-mask containing this Flight Report's attributes
      See Also:
    • getStatus

      public FlightStatus getStatus()
      Returns the status of this Flight Report.
      Returns:
      the status of this PIREP
      See Also:
    • getNetwork

      public OnlineNetwork getNetwork()
      Description copied from interface: FlightData
      Returns the OnlineNetwork the flight is operated on.
      Specified by:
      getNetwork in interface FlightData
      Returns:
      an OnlineNetwork or null if offline
    • getPassengers

      public int getPassengers()
      Returns the number of passengers carried on this flight.
      Returns:
      the number of passengers
      See Also:
    • getLoadFactor

      public double getLoadFactor()
      Returns the load factor for this flight.
      Returns:
      the load factor from 0 to 1
      See Also:
    • hasAttribute

      public boolean hasAttribute(Attribute a)
      Returns the presence of a particular flight Attribute.
      Parameters:
      a - the Attribute
      Returns:
      TRUE if the Attribute is present
      See Also:
    • setNetwork

      public void setNetwork(OnlineNetwork network)
      Updates the Online Network used on this Flight.
      Parameters:
      network - an OnlineNetwork enum
      See Also:
    • setRank

      public void setRank(Rank rank)
      Updates the rank of the Pilot filing this report.
      Parameters:
      rank - the rank
      See Also:
    • setRemarks

      public void setRemarks(String remarks)
      Sets the remarks for this Flight Report.
      Parameters:
      remarks - the remarks
      See Also:
    • setRoute

      public void setRoute(String rt)
      Updates the filed Flight Route.
      Parameters:
      rt - the route
      See Also:
    • setComments

      public void setComments(String comments)
      Sets the disposition comments for this Flight Report.
      Parameters:
      comments - the disposition comments
      See Also:
    • setCaptEQType

      public void setCaptEQType(Collection<String> eqTypes)
      Sets if this Flight counts towards promotion in a particular equipment program.
      Parameters:
      eqTypes - a Collection of equipment program names
      See Also:
    • setCaptEQType

      public void setCaptEQType(String eqType)
      Sets if this Flight counts towards promotion in a particular equipment program.
      Parameters:
      eqType - an equipment program names
      See Also:
    • addStatusUpdate

      public void addStatusUpdate(FlightHistoryEntry upd)
      Adds a status update to this Flight Report.
      Parameters:
      upd - a FlightHistoryEntry
    • addStatusUpdate

      public void addStatusUpdate(int authorID, HistoryType type, String msg)
      Creates a new status update and adds it to the Flight Report.
      Parameters:
      authorID - the Author's database ID
      type - the HistoryType
      msg - the status message
    • setID

      public void setID(int id)
      Updates the database ID, and the database ID of any associated status updates.
      Overrides:
      setID in class DatabaseBean
      Parameters:
      id - The primary key of the entry in the database that corresponds to this object.
      See Also:
    • setLeg

      public final void setLeg(int leg)
      Sets the Flight Leg. Overrides the superclass implementation to check for zero values.
      Overrides:
      setLeg in class Flight
      Parameters:
      leg - the Flight Leg
      See Also:
    • setLength

      public void setLength(int length)
      Sets the length of this Flight, in hours multiplied by 10.
      Parameters:
      length - the length of the flight, in hours multiplied by 10.
    • setStatus

      public void setStatus(FlightStatus status)
      Sets the status of this Flight Report.
      Parameters:
      status - the new FlightStatus for this Flight Report
      See Also:
    • setAttributes

      public void setAttributes(int attrs)
      Sets the attributes for this Flight Report.
      Parameters:
      attrs - the new attributes
      See Also:
    • setAttribute

      public void setAttribute(Attribute a, boolean isSet)
      Set/Clear a particular Attribute for this Flight Report.
      Parameters:
      a - the Attribute to set or clear
      isSet - TRUE if attribute should be set, FALSE if attribute should be cleared
      See Also:
    • setSimulator

      public void setSimulator(Simulator sim)
      Updates the Simulator used for this flight.
      Parameters:
      sim - the Simulator
      See Also:
    • setDate

      public void setDate(Instant dt)
      Updates the date that this Flight was flown on.
      Parameters:
      dt - when this flight was flown. The time component is undefined.
      See Also:
    • setSubmittedOn

      public void setSubmittedOn(Instant sd)
      Updates the date/time this Flight Report was submitted on.
      Parameters:
      sd - this Flight Report was submitted for approval.
      See Also:
    • setDisposedOn

      public void setDisposedOn(Instant dd)
      Updates the date/time this Flight Report was approved or rejected on.
      Parameters:
      dd - when this Flight Report was approved or rejected.
      See Also:
    • setPassengers

      public void setPassengers(int ps)
      Updates the number of passengers carried on this flight.
      Parameters:
      ps - the number of passengers
      See Also:
    • setLoadFactor

      public void setLoadFactor(double lf)
      Updates the load factor for this flight.
      Parameters:
      lf - the load factor
      See Also:
    • setDatabaseID

      public void setDatabaseID(DatabaseID idType, int id)
      Sets the database row ID of a relatied database row. This row may be present in the PILOTS , ASSIGNMENTS , ACARS_PIREPS or EVENTS table. This is typically used by a DAO.
      Parameters:
      idType - the row ID type
      id - the database row ID
      Throws:
      IllegalArgumentException - if the id is negative
      See Also:
    • setAuthorID

      public void setAuthorID(int id)
      Description copied from interface: AuthoredBean
      Updates the author of this bean.
      Specified by:
      setAuthorID in interface AuthoredBean
      Parameters:
      id - the author's database ID.
      See Also:
    • compareTo

      public int compareTo(Object o)
      Specified by:
      compareTo in interface Comparable<Object>
      Overrides:
      compareTo in class Flight
    • getRowClassName

      public String getRowClassName()
      Description copied from interface: ViewEntry
      Returns the CSS class for this object if rendered in a view table.
      Specified by:
      getRowClassName in interface ViewEntry
      Returns:
      the CSS class name, or NULL if none