Class AcademyHistoryHelper
java.lang.Object
org.deltava.beans.academy.AcademyHistoryHelper
A utility class to extract information from a user's Flight Academy history.
- Since:
- 1.0
- Version:
- 11.4
- Author:
- Luke
-
Constructor Summary
ConstructorsConstructorDescriptionAcademyHistoryHelper
(Pilot p, Collection<Course> courses, Collection<Certification> allCerts) Initializes the helper. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addExams
(Collection<Test> tests) Adds the Pilot's Flight Academy examinations and checkrides.void
addFlights
(Collection<FlightReport> flights) Adds the Pilot's approved flight reports.void
Adds primary equipment types for a particular equipment program.boolean
Returns if the user is eligible to take a particular Flight Academy Course.boolean
canWrite
(ExamProfile ep) Rerturns if the user is eligible to write a particular examination.getCertification
(String code) Retrieves a Certification.Returns all Certifications.getCourse
(int id) Retrieves a specific Course from the history.Returns the Pilot's courses.Returns the Course that the Pilot is currently enrolled ingetExams()
Returns the Pilot's examinations.int
getFlightTotals
(String eqProgram, boolean isHours) Returns the number of flight legs or hours flown using the primary equipment type of a particular equipment program.boolean
hasAll
(int stage) Returns whether a Pilot has completed all certifications in a particular stage.boolean
hasAny
(int stage) Returns whether a Pilot has completed a certification in a particular stage.boolean
hasCompleted
(String certName) Returns whether a Pilot has completed the requirements for a Flight Academy certifcation.boolean
Returns whether a Pilot has completed a particular certification.boolean
hasSubmitted
(String examName) Returns if a user has submitted a particular Examination.boolean
isLockedOut
(int lockoutHours) Returns if the user is locked out of the Testing Center due to a failed examination.boolean
Returns whether a Pilot has started a particular course.boolean
passedExam
(String examName) Returns whether a Pilot has passed a particular Examination.void
setAllowInactive
(boolean doInactive) Toggles whether the user can enroll in Inactive Courses.void
setDebug
(boolean isDebug) Toggles the debugging log.
-
Constructor Details
-
AcademyHistoryHelper
public AcademyHistoryHelper(Pilot p, Collection<Course> courses, Collection<Certification> allCerts) Initializes the helper.- Parameters:
p
- the Pilotcourses
- a Collection of course objects, representing this Pilot's Flight Academy historyallCerts
- all available Certifications
-
-
Method Details
-
setDebug
public void setDebug(boolean isDebug) Toggles the debugging log.- Parameters:
isDebug
- TRUE if the log is active, otherwise FALSE
-
setAllowInactive
public void setAllowInactive(boolean doInactive) Toggles whether the user can enroll in Inactive Courses.- Parameters:
doInactive
- TRUE if the usre can enroll in Inactive Courses, otherwise FALSE
-
getExams
Returns the Pilot's examinations. This method is useful when we use this class and do not wish to call theGetExam
DAO a second time.- Returns:
- a Collection of Test beans
-
getCertification
Retrieves a Certification. This method is useful when we use this class and do not wish to call theGetAcademyCertifications
DAO a second time.- Parameters:
code
- the certification name or code- Returns:
- a Certification, or null if not found
-
getCertifications
Returns all Certifications. This method is useful when we use this class and do not wish to call theGetAcademyCertifications
DAO a second time.- Returns:
- a Collection of Certification beans
-
getCourses
Returns the Pilot's courses. This method is useful when we use this class and do not wish to call theGetAcademyCourses
DAO a second time.- Returns:
- a Collection of Course beans
-
addExams
Adds the Pilot's Flight Academy examinations and checkrides. Any others will not be added.- Parameters:
tests
- a Collection of checkride/examination objects, representing this Pilot's exam history
-
addFlights
Adds the Pilot's approved flight reports. Only flights logged using a Flight Data Recorder (ACARS/XACARS/simFDR) will be added.- Parameters:
flights
- a Collection of FlightReport beans
-
addPrimaryRatings
Adds primary equipment types for a particular equipment program.- Parameters:
eq
- the EquipmentType
-
hasPassed
Returns whether a Pilot has completed a particular certification.- Parameters:
certName
- the Certification name- Returns:
- TRUE if the Certification was passed, otherwise FALSE
-
isPending
Returns whether a Pilot has started a particular course.- Parameters:
certName
- the Certification name- Returns:
- TRUE if a course entry exists and was not pased, 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
-
getCurrentCourse
Returns the Course that the Pilot is currently enrolled in- Returns:
- a Course bean, or null
-
getCourse
Retrieves a specific Course from the history.- Parameters:
id
- the Course database ID- Returns:
- a Course, or null if not found
-
hasAny
public boolean hasAny(int stage) Returns whether a Pilot has completed a certification in a particular stage.- Parameters:
stage
- the stage number- Returns:
- TRUE if any Certification was passed, otherwise FALSE
-
passedExam
Returns whether a Pilot has passed a particular Examination.- Parameters:
examName
- the Examination name- Returns:
- TRUE if the examination has been passed, otherwise FALSE
-
hasCompleted
Returns whether a Pilot has completed the requirements for a Flight Academy certifcation.- Parameters:
certName
- the Certification name- Returns:
- TRUE if the certification has been granted or can be, otherwise FALSE
-
hasAll
public boolean hasAll(int stage) Returns whether a Pilot has completed all certifications in a particular stage.- Parameters:
stage
- the stage number- Returns:
- TRUE if all Certification were passed, otherwise FALSE
-
canTake
Returns if the user is eligible to take a particular Flight Academy Course.- Parameters:
c
- the Certification to take- Returns:
- TRUE if the user can take the Course, otherwise FALSE
-
canWrite
Rerturns if the user is eligible to write a particular examination.- Parameters:
ep
- the ExamProfile bean- Returns:
- TRUE if the exam can be taken, othewise 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
-
getFlightTotals
Returns the number of flight legs or hours flown using the primary equipment type of a particular equipment program.- Parameters:
eqProgram
- the equipment type eprogramisHours
- TRUE if returning hours, otherwise flight legs- Returns:
- the number of flight legs or hours
-