Class TestingHistoryHelper

java.lang.Object
org.deltava.beans.testing.TestingHistoryHelper
All Implemented Interfaces:
Serializable, Cacheable

public final class TestingHistoryHelper extends Object implements Cacheable
A helper class to extract information from a user's examination/check ride history.
Since:
1.0
Version:
11.1
Author:
Luke
See Also:
  • Constructor Details

    • TestingHistoryHelper

      public TestingHistoryHelper(Pilot p, EquipmentType myEQ, Collection<Test> tests, Collection<FlightReport> pireps)
      Initializes the helper.
      Parameters:
      p - the Pilot bean
      myEQ - the Pilot's Equipment program
      tests - a Collection of checkride/examination objects, representing this Pilot's exam history
      pireps - a Collection of FlightReport beans with the CaptEQType property populated
  • Method Details

    • add

      public void add(Test t)
      Adds an Examination or Check Ride to the Pilot's test history.
      Parameters:
      t - the Test
    • setEquipmentTypes

      public void setEquipmentTypes(Collection<EquipmentType> eqTypes)
      Initializes the collection of Equipment programs.
      Parameters:
      eqTypes - a Collection of EquipmentType beans
    • getEquipmentType

      public EquipmentType getEquipmentType()
      Returns the Pilot's equipment program.
      Returns:
      the EquipmentType bean
    • getExams

      public Collection<Test> getExams()
      Returns the Pilot's examinations and CheckRides.
      Returns:
      a Collection of Test beans
    • getCheckRides

      public Collection<CheckRide> getCheckRides(int expirationDays)
      Returns the Pilots Check Rides.
      Parameters:
      expirationDays - the number of days in the future each check ride will expire
      Returns:
      a Collection of CheckRide beans
    • applyExpiration

      public void applyExpiration(int days)
      Applies expiration dates to non-Currency check rides.
      Parameters:
      days - the expiration in days
    • clearExpiration

      public void clearExpiration()
      Clears expiration dates from non-Currency check rides.
    • isCaptainInStage

      public boolean isCaptainInStage(int stage)
      Returns whether a Pilot qualifies for Captain's rank in a particular stage.
      Parameters:
      stage - the stage number
      Returns:
      TRUE if the Pilot has passed the Captain's exam and flown the necessary legs in ANY equipment program in a particular stage.
    • getMaxExamStage

      public int getMaxExamStage()
      Returns the highest stage Examination this user has passed. This will return 5 if the user is a Chief Pilot or an Assistant Chief Pilot.
      Returns:
      the stage number of the highest examination, or 1 if none passed
      See Also:
    • getMaxCheckRideStage

      public int getMaxCheckRideStage()
      Returns the highest stage Check Ride this user has passed.
      Returns:
      the stage number of the highest check ride, or the current stage if none passed
      See Also:
    • getFlightLegs

      public int getFlightLegs(EquipmentType eq)
      Returns the number of flight legs counted towards promotion in a particular Equipment Program. If no Equipment Program is specified, this returns the total number of approved flight legs.
      Parameters:
      eq - the Equipment Program
      Returns:
      the number of legs
    • getFlights

      public Collection<FlightReport> getFlights()
      Returns the Pilot's Flight Reports. This Collection is unmodifiable.
      Returns:
      a Collection of FlightReports
    • getSimulators

      public Collection<Simulator> getSimulators(int days)
      Returns all Simulators used by a Pilot within a specified number of days.
      Parameters:
      days - the number of days
      Returns:
      a Collection of Simulators
    • canWrite

      public void canWrite(ExamProfile ep) throws IneligibilityException
      Checks if the user is eligible to take a particular Examination.
      Parameters:
      ep - the Examination to take
      Throws:
      IneligibilityException - if one is not eligible
    • canSwitchTo

      public void canSwitchTo(EquipmentType eq) throws IneligibilityException
      Returns if a user has met all the requirements for switching to a particular equipment program.
      Parameters:
      eq - the EquipmentType bean
      Throws:
      IneligibilityException - if the user cannot switch to the program
    • canRequestSwitch

      public boolean canRequestSwitch()
      Returns if the Pilot has completed enough flight legs in their current program to request a switch or additional ratings.
      Returns:
      TRUE if the Pilot has completed one half of the legs required for promotion to Captain, otherwise FALSE
    • canRequestCheckRide

      public RideType canRequestCheckRide(EquipmentType eq) throws IneligibilityException
      Returns if a user can request a Check Ride to move to a particular equipment program.
      Parameters:
      eq - the EquipmentType bean
      Returns:
      the RideType to request
      Throws:
      IneligibilityException - if the user cannot request a check ride
    • canRequestRatings

      public boolean canRequestRatings(EquipmentType eq)
      Returns if a Pilot can request additional ratings in an Equipment Type. This checks if the equipment type has any ratings that the Pilot does not current have.
      Parameters:
      eq - the EquipmentType bean
      Returns:
      TRUE if the user is missing any ratings, otherwise FALSE
    • canPromote

      public boolean canPromote(EquipmentType eq)
      Returns if we can promote a user to Captain within the equipment program. This is essentially the same call as promotionEligible(EquipmentType) except that we also check if we are a First Officer in the specific program.
      Parameters:
      eq - the EquipmentType bean
      Returns:
      TRUE if the user is eligible to be promoted to captain, otherwise FALSE
      See Also:
    • promotionEligible

      public boolean promotionEligible(EquipmentType eq)
      Returns whether we could have promoted the user to Captain within an equipment program.
      Parameters:
      eq - the EquipmentType bean
      Returns:
      TRUE if the user is eligible to be promoted to captain, otherwise FALSE
    • hasPassed

      public boolean hasPassed(Collection<String> examNames)
      Returns if a user has passed particular Examinations.
      Parameters:
      examNames - a Collection of Examination names
      Returns:
      TRUE if the user has passed these Examinations, otherwise FALSE
    • hasSubmitted

      public boolean hasSubmitted(String examName)
      Returns if a user has submitted a particular Examination.
      Parameters:
      examName - the Examination name
      Returns:
      TRUE if the user has submitted this Examination, otherwise FALSE
    • hasCheckRide

      public boolean hasCheckRide(EquipmentType eq)
      Returns if a user has passed any check ride for a particular equipment type.
      Parameters:
      eq - the Equipment Type bean
      Returns:
      TRUE if the user passed the check ride, otherwise FALSE
    • hasCheckRide

      public boolean hasCheckRide(EquipmentType eq, RideType rt)
      Returns if a user has passed a Check Ride for a particular equipment type.
      Parameters:
      eq - the Equipment Type bean
      rt - the Check Ride type, or null for any
      Returns:
      TRUE if the user passed the check ride, otherwise FALSE
    • isLockedOut

      public boolean isLockedOut(int lockoutHours)
      Returns if the user is locked out of the Testing Center due to a failed examination.
      Parameters:
      lockoutHours - the number of hours to remain locked out, or zero if no lockout
      Returns:
      TRUE if the user is locked out, otherwise FALSE
    • getQualifiedPrograms

      public SortedSet<EquipmentType> getQualifiedPrograms()
      Returns all Equipment programs that the Pilot is fully rated for.
      Returns:
      a Collection of EquipmentTypes, sorted by stage and name
    • getQualifiedRatings

      public Collection<String> getQualifiedRatings()
      Returns all aircraft types that the Pilot is fully rated for.
      Returns:
      a Collection of Aircraft types
    • cacheKey

      public Object cacheKey()
      Description copied from interface: Cacheable
      Returns the cache key for this object. Caches call this method when adding the object.
      Specified by:
      cacheKey in interface Cacheable
      Returns:
      the cache key for the object