Class AssignmentInfo

java.lang.Object
org.deltava.beans.DatabaseBean
org.deltava.beans.assign.AssignmentInfo
All Implemented Interfaces:
Serializable, Comparable<Object>, IDBean, ViewEntry, Cacheable

public class AssignmentInfo extends DatabaseBean implements ViewEntry
A class to store Flight Assignments.
Since:
1.0
Version:
11.0
Author:
Luke
See Also:
  • Constructor Details

    • AssignmentInfo

      public AssignmentInfo(String eqType)
      Creates a new Flight Assignment for a particular Equipment Type.
      Parameters:
      eqType - the equipment type code
      Throws:
      NullPointerException - if eqType is null
  • Method Details

    • getAssignments

      public Collection<AssignmentLeg> getAssignments()
      Returns the individual Legs for this Assignment.
      Returns:
      a List of AssignmentInfo beans
      See Also:
    • getFlights

      public Collection<FlightReport> getFlights()
      Returns the Flight Reports linked to this Assignment.
      Returns:
      a List of FlightReport beans
      See Also:
    • getEquipmentType

      public String getEquipmentType()
      Returns the equipment type for this assignment.
      Returns:
      the equipment type
    • getEventID

      public int getEventID()
      Returns the ID of the associated Online Event.
      Returns:
      the Database ID of the associated Event, or zero if not linked to an event
      See Also:
    • getPilotID

      public int getPilotID()
      Returns the Pilot Database ID for this Flight Assignment.
      Returns:
      the Database ID of the Assigned Pilot, or zero if unassigned
      See Also:
    • getStatus

      public AssignmentStatus getStatus()
      Returns the status of this Assignment.
      Returns:
      the AssignmentStatus
      See Also:
    • getAssignDate

      public Instant getAssignDate()
      Returns the date/time this Assignment was assigned to the Pilot.
      Returns:
      the date/time assignment was made
      See Also:
    • getCompletionDate

      public Instant getCompletionDate()
      Returns the date/time this Assignment was completed by the Pilot.
      Returns:
      the date/time assignment was completed
      See Also:
    • isComplete

      public boolean isComplete()
      Determines if all flights in this assignment are complete.
      Returns:
      TRUE if all assignment flights are complete, otherwise FALS
    • isRandom

      public boolean isRandom()
      Returns if this Assignment was randomly generated.
      Returns:
      TRUE if the assignment was randomly created, otherwise FALSE
      See Also:
    • isRepeating

      public boolean isRepeating()
      Returns if this Assignment should be made available again when complete.
      Returns:
      TRUE if the assignment is auto-repeating, otherwise FALSE
      See Also:
    • isPurgeable

      public boolean isPurgeable()
      Returns if this Assignment should be automatically purged on a Schedule reload.
      Returns:
      TRUE if the assignment should be purged, otherwise FALSE
      See Also:
    • size

      public int size()
      Returns the number of flight legs in this Assignment.
      Returns:
      the number of legs
    • addAssignment

      public void addAssignment(AssignmentLeg a)
      Adds an Assigned Flight to this Assignment.
      Parameters:
      a - the assigned flight
    • addFlight

      public void addFlight(FlightReport fr)
      Adds a Flight Report to this Assignment. This will update the Pilot ID for this Assignment if not set.
      Parameters:
      fr - the flight report
    • setEventID

      public void setEventID(int id)
      Sets the associated Online Event for this Assignment.
      Parameters:
      id - the Event Database ID
      Throws:
      IllegalArgumentException - if id is negative
    • setPilotID

      public void setPilotID(int id)
      Updates the associated Pilot for this Assignment.
      Parameters:
      id - the Pilot Database ID
      Throws:
      IllegalArgumentException - if id is negative
      See Also:
    • setStatus

      public void setStatus(AssignmentStatus status)
      Updates the status of this Flight Assignment.
      Parameters:
      status - the AssignmentStatus
      See Also:
    • setRandom

      public void setRandom(boolean random)
      Marks this Assignment as randomly generated.
      Parameters:
      random - TRUE if generated from Find a Flight, otherwise FALSE
      See Also:
    • setRepeating

      public void setRepeating(boolean repeating)
      Marks this Assignment as repeating (automatically regenerated when completed).
      Parameters:
      repeating - TRUE if automatically repeating, otherwise FALSE
      See Also:
    • setPurgeable

      public void setPurgeable(boolean canPurge)
      Marks this Assignment as purgeable when the Schedule database is updated.
      Parameters:
      canPurge - TRUE if the Assignment should be purged on a Schedule update.
      See Also:
    • setAssignDate

      public void setAssignDate(Instant dt)
      Updates the Date this Assignment was assigned to a Pilot.
      Parameters:
      dt - the date/time this Assignment was assigned
      See Also:
    • setCompletionDate

      public void setCompletionDate(Instant dt)
      Updates the Date this Assignment was completed.
      Parameters:
      dt - the date/time this Assignment was completed
      See Also:
    • remove

      public void remove(RoutePair rp)
      Removes an unflown leg from this assignment.
      Parameters:
      rp - the RoutePair to remove
    • 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