Class TestingHistoryHelper
java.lang.Object
org.deltava.beans.testing.TestingHistoryHelper
- All Implemented Interfaces:
Serializable
,Cacheable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
Utilty class to compare check rides by equipment program only, used to limit Sets to a single ride per program.(package private) static class
Utility class to compare Examinations by checking the ID, then the scoring date if the ID is zero and they are unsaved waivers.(package private) static class
Status exception class.(package private) static class
Utility class to sort check rides by expiration date. -
Constructor Summary
ConstructorsConstructorDescriptionTestingHistoryHelper
(Pilot p, EquipmentType myEQ, Collection<Test> tests, Collection<FlightReport> pireps) Initializes the helper. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an Examination or Check Ride to the Pilot's test history.void
applyExpiration
(int days) Applies expiration dates to non-Currency check rides.cacheKey()
Returns the cache key for this object.boolean
Returns if we can promote a user to Captain within the equipment program.Returns if a user can request a Check Ride to move to a particular equipment program.boolean
Returns if a Pilot can request additional ratings in an Equipment Type.boolean
Returns if the Pilot has completed enough flight legs in their current program to request a switch or additional ratings.void
Returns if a user has met all the requirements for switching to a particular equipment program.void
canWrite
(ExamProfile ep) Checks if the user is eligible to take a particular Examination.void
Clears expiration dates from non-Currency check rides.getCheckRides
(int expirationDays) Returns the Pilots Check Rides.Returns the Pilot's equipment program.getExams()
Returns the Pilot's examinations and CheckRides.int
Returns the number of flight legs counted towards promotion in a particular Equipment Program.Returns the Pilot's Flight Reports.int
Returns the highest stage Check Ride this user has passed.int
Returns the highest stage Examination this user has passed.Returns all Equipment programs that the Pilot is fully rated for.Returns all aircraft types that the Pilot is fully rated for.getSimulators
(int days) Returns all Simulators used by a Pilot within a specified number of days.boolean
Returns if a user has passed any check ride for a particular equipment type.boolean
hasCheckRide
(EquipmentType eq, RideType rt) Returns if a user has passed a Check Ride for a particular equipment type.boolean
hasPassed
(Collection<String> examNames) Returns if a user has passed particular Examinations.boolean
hasSubmitted
(String examName) Returns if a user has submitted a particular Examination.boolean
isCaptainInStage
(int stage) Returns whether a Pilot qualifies for Captain's rank in a particular stage.boolean
isLockedOut
(int lockoutHours) Returns if the user is locked out of the Testing Center due to a failed examination.boolean
Returns whether we could have promoted the user to Captain within an equipment program.void
setEquipmentTypes
(Collection<EquipmentType> eqTypes) Initializes the collection of Equipment programs.
-
Constructor Details
-
TestingHistoryHelper
public TestingHistoryHelper(Pilot p, EquipmentType myEQ, Collection<Test> tests, Collection<FlightReport> pireps) Initializes the helper.- Parameters:
p
- the Pilot beanmyEQ
- the Pilot's Equipment programtests
- a Collection of checkride/examination objects, representing this Pilot's exam historypireps
- a Collection of FlightReport beans with the CaptEQType property populated
-
-
Method Details
-
add
Adds an Examination or Check Ride to the Pilot's test history.- Parameters:
t
- the Test
-
setEquipmentTypes
Initializes the collection of Equipment programs.- Parameters:
eqTypes
- a Collection of EquipmentType beans
-
getEquipmentType
Returns the Pilot's equipment program.- Returns:
- the EquipmentType bean
-
getExams
Returns the Pilot's examinations and CheckRides.- Returns:
- a Collection of Test beans
-
getCheckRides
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
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
Returns the Pilot's Flight Reports. This Collection is unmodifiable.- Returns:
- a Collection of FlightReports
-
getSimulators
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
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
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
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
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
Returns if we can promote a user to Captain within the equipment program. This is essentially the same call aspromotionEligible(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
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
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
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
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
Returns if a user has passed a Check Ride for a particular equipment type.- Parameters:
eq
- the Equipment Type beanrt
- 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
Returns all Equipment programs that the Pilot is fully rated for.- Returns:
- a Collection of EquipmentTypes, sorted by stage and name
-
getQualifiedRatings
Returns all aircraft types that the Pilot is fully rated for.- Returns:
- a Collection of Aircraft types
-
cacheKey
-