Class Pilot

All Implemented Interfaces:
Serializable, Cloneable, Comparable<Object>, Principal, ComboAlias, EMailAddress, FormattedEMailRecipient, IDBean, PushAddress, ViewEntry, Cacheable
Direct Known Subclasses:
Staff

public class Pilot extends Person implements PushAddress, ComboAlias, Cloneable
A class for storing Pilot information.
Since:
1.0
Version:
11.1
Author:
Luke
See Also:
  • Constructor Details

    • Pilot

      public Pilot(String firstName, String lastName)
      Creates a Pilot object with a given first and last name, converted to "proper case".
      Parameters:
      firstName - the Pilot's first name.
      lastName - the Pilot's last name.
      Throws:
      NullPointerException - if either name is null
      See Also:
  • Method Details

    • getRoles

      public Collection<String> getRoles()
      Description copied from class: Person
      Returns a list of security roles this Person belongs to.
      Specified by:
      getRoles in class Person
      Returns:
      a Collection of role names
    • getPushEndpoints

      public Collection<PushEndpoint> getPushEndpoints()
      Description copied from interface: PushAddress
      Returns the user's Push Notification endpoints.
      Specified by:
      getPushEndpoints in interface PushAddress
      Returns:
      a Collection of PushEndpoint beans
    • getEliteStatus

      public EliteStatus getEliteStatus()
      Returns the Pilot's current Elite status. This may not be populated
      Returns:
      an EliteStatus, or null if not set
      See Also:
    • getStatus

      public PilotStatus getStatus()
      Returns the Pilot's status.
      Returns:
      a PilotStatus enum
    • getRoleData

      public Collection<Role> getRoleData()
      Returns role name and persistence data.
      Returns:
      a Collection of Roles
    • getAirlineCode

      public String getAirlineCode()
      Returns the airline code for this Pilot.
      Returns:
      the airline code
    • getPilotCode

      public String getPilotCode()
      Return the Pilot Code.
      Returns:
      the pilot code eg. DVA043. If the pilot has not logged any flights this will return an empty stirng ("").
      See Also:
    • getPilotNumber

      public int getPilotNumber()
      Return the pilot number.
      Returns:
      the pilot number eg. 43. If the pilot has not logged any flights this will return 0.
      See Also:
    • getComboName

      public String getComboName()
      Description copied from interface: ComboAlias
      Returns the visible name to use in the HTML <OPTION> element.
      Specified by:
      getComboName in interface ComboAlias
      Returns:
      The visible name for this entry
    • getComboAlias

      public String getComboAlias()
      Description copied from interface: ComboAlias
      Returns the alias to use in the HTML <OPTION> element.
      Specified by:
      getComboAlias in interface ComboAlias
      Returns:
      The alias for this entry
    • getShowSignatures

      public boolean getShowSignatures()
      Returns whether the pilot will see Water Cooler signatures.
      Returns:
      TRUE if the Pilot views signature images, otherwise FALSE
      See Also:
    • getShowSSThreads

      public boolean getShowSSThreads()
      Returns whether the Pilot will see Water Cooler screen shot message threads.
      Returns:
      TRUE if the Pilot sees screen shot threads, otherwise FALSE
      See Also:
    • getShowNavBar

      public boolean getShowNavBar()
      Returns whether a navigation bar or a side menu will be rendered.
      Returns:
      TRUE if a navigation bar should be displayed, otherwise FALSE
      See Also:
    • getShowNewPosts

      public boolean getShowNewPosts()
      Returns whether new Water Cooler posts will be scrolled to.
      Returns:
      TRUE if new posts are scrolled to, otherwise FALSE
      See Also:
    • getACARSRestriction

      public Restriction getACARSRestriction()
      Returns the Pilot's ACARS restrictions.
      Returns:
      an ACARS Restriction
      See Also:
    • getACARSUpdateChannel

      public UpdateChannel getACARSUpdateChannel()
      Returns the Pilot's ACARS client update channel.
      Returns:
      an UpdateChannel
      See Also:
    • getNoTimeCompression

      public boolean getNoTimeCompression()
      Returns whether the Pilot cannot submit flight reports with Time Compression.
      Returns:
      TRUE if Time Compression disabled, otherwise FALSE
      See Also:
    • getNoExams

      public boolean getNoExams()
      Returns whether the Pilot has been locked out of the Testing Center.
      Returns:
      TRUE if the Pilot cannot take any Examinations, otherwise FALSE
      See Also:
    • getNoVoice

      public boolean getNoVoice()
      Returns whether the Pilot has been locked out of the Voice server.
      Returns:
      TRUE if the Pilot has been locked out of the Voice server, otherwise FALSE
      See Also:
    • getNoCooler

      public boolean getNoCooler()
      Returns whether the Pilot has been locked out of the Water Cooler.
      Returns:
      TRUE if the Pilot has been locked out of the Water Cooler, otherwise FALSE
      See Also:
    • getIsPermanent

      public boolean getIsPermanent()
      Returns whether this Pilot cannot be marked Inactive.
      Returns:
      TRUE if a permanent account, otherwise FALSE
      See Also:
    • getIsForgotten

      public boolean getIsForgotten()
      Returns whether the Pilot has been marked as "forgotten" for GDPR reasons.
      Returns:
      TRUE if forgotten, otherwise FALSE
      See Also:
    • getProficiencyCheckRides

      public boolean getProficiencyCheckRides()
      Returns whether this Pilot has opted for recurring check rides.
      Returns:
      TRUE if proficiency check rides are enabled, otherwise FALSE
      See Also:
    • getMotto

      public String getMotto()
      Returns the Pilot's motto
      Returns:
      the motto text
      See Also:
    • getMapType

      public MapType getMapType()
      Returns the Pilot's preferred route map type.
      Returns:
      the MapType
      See Also:
    • getRatings

      public Collection<String> getRatings()
      Return the Pilot's rated equipment Types.
      Returns:
      a sorted list of the equipment types the Pilot is rated to fly.
      See Also:
    • getCertifications

      public Collection<String> getCertifications()
      Returns the Pilot's Flight Academy certification codes.
      Returns:
      a list of certification codes
      See Also:
    • getAccomplishmentIDs

      public Collection<DatedAccomplishmentID> getAccomplishmentIDs()
      Returns the Pilot's Accomplishments.
      Returns:
      a Collection of DatedAccomplishmentIDs
      See Also:
    • getLegs

      public int getLegs()
      Return the number of legs flown by this Pilot.
      Returns:
      the number of legs flown, either from the List of FlightReport beans or directly from setFlights()
      See Also:
    • getMiles

      public long getMiles()
      Returns the number of miles flown by this Pilot
      Returns:
      the number of miles flown
      See Also:
    • getHours

      public double getHours()
      Returns the number of flight hours logged by this Pilot.
      Returns:
      the number of hours flown
      See Also:
    • getOnlineLegs

      public int getOnlineLegs()
      Returns the number of online flight legs logged by this Pilot.
      Returns:
      the number of legs flown
      See Also:
    • getOnlineHours

      public double getOnlineHours()
      Returns the number of online flight hours logged by this Pilot.
      Returns:
      the number of hours flown
      See Also:
    • getEventLegs

      public int getEventLegs()
      Returns the number of Online Event flight legs logged by this Pilot.
      Returns:
      the number of legs flown
      See Also:
    • getEventHours

      public double getEventHours()
      Returns the number of Online Event flight hours logged by this Pilot.
      Returns:
      the number of hours flown
      See Also:
    • getEventSignups

      public int getEventSignups()
      Returns the number of times this Pilot has signed up for an Online Event.
      Returns:
      the number of Events signed up for
      See Also:
    • getACARSLegs

      public int getACARSLegs()
      Returns the number of ACARS flight legs logged by this Pilot.
      Returns:
      the number of hours flown
      See Also:
    • getACARSHours

      public double getACARSHours()
      Return the number of ACARS flight hours logged by this Pilot.
      Returns:
      the number of hours flown
      See Also:
    • getTotalHours

      public double getTotalHours()
      Returns the total number of flight hours logged by this pilot across all Airlines.
      Returns:
      the total number of flight hours flown
      See Also:
    • getTotalLegs

      public int getTotalLegs()
      Returns the total number of flight legs logged by this Pilot across all Airlines.
      Returns:
      the total number of legs flown
      See Also:
    • getDispatchFlights

      public int getDispatchFlights()
      Returns the total number of flights the user has Dispatched.
      Returns:
      the number of dispatched flights
      See Also:
    • getDispatchHours

      public double getDispatchHours()
      Returns the number of hours spent providing Dispatch services.
      Returns:
      the number of hours
      See Also:
    • getLastFlight

      public Instant getLastFlight()
      Returns the date of the Pilot's last flight.
      Returns:
      the date of the latest Flight Report
      See Also:
    • hasRating

      public boolean hasRating(String eqType)
      Queries whether this Pilot is rated in a particular equipment type.
      Parameters:
      eqType - the name of the equipment type
      Returns:
      TRUE if the Pilot is rated for this equipment type, otherwise FALSE
    • getHasSignature

      public boolean getHasSignature()
      Queries if the Pilot has a signature image.
      Returns:
      TRUE if the pilot has an image, otherwise FALSE
      See Also:
    • getSignatureExtension

      public String getSignatureExtension()
      Returns the extension of the Signature Image.
      Returns:
      the extension
      See Also:
    • getSignatureModified

      public Instant getSignatureModified()
      Returns the last modification date of the Signature Image.
      Returns:
      the last modified date/time, or null if none
      See Also:
    • getHasDefaultSignature

      public boolean getHasDefaultSignature()
      Queries if the default signature image should be shown.
      Returns:
      TRUE if the default image should be shown, otherwise FALSE
      See Also:
    • getLDAPName

      public String getLDAPName()
      Returns the Pilot's LDAP uid, used for SubVersion and raw HTTP access.
      Returns:
      the LDAP uid, or null
      See Also:
    • isInRole

      public boolean isInRole(String roleName)
      Queries whether this Pilot is a member of a particular security role.
      Specified by:
      isInRole in class Person
      Parameters:
      roleName - the name of the role
      Returns:
      TRUE if the Pilot is a member of this role, otherwise FALSE
    • setStatus

      public final void setStatus(PilotStatus s)
      Update this Pilot's status.
      Parameters:
      s - a PilotStatus
    • setIsPermanent

      public void setIsPermanent(boolean isPerm)
      Marks this account as being unable to be marked Inactive.
      Parameters:
      isPerm - TRUE if permanent, otherwise FALSE
      See Also:
    • setEliteStatus

      public void setEliteStatus(EliteStatus es)
      Updates the Pilot's Elite program status.
      Parameters:
      es - an EliteStatus
      See Also:
    • setIsForgotten

      public void setIsForgotten(boolean isForgotten)
      Marks this Pilot account as Forgotten for GDPR purposes.
      Parameters:
      isForgotten - TRUE if forgotten, otherwise FALSE
      See Also:
    • setProficiencyCheckRides

      public void setProficiencyCheckRides(boolean isPCR)
      Marks this Pilot as having opted for proficiency check rides.
      Parameters:
      isPCR - TRUE if recurring check rides, otherwise FALSE
      See Also:
    • setShowSignatures

      public void setShowSignatures(boolean showSigs)
      Updates this Pilot's "Show Water Cooler signatures" flag.
      Parameters:
      showSigs - the new flag value
      See Also:
    • setShowNewPosts

      public void setShowNewPosts(boolean newPosts)
      Updates whether new Water Cooler posts will be scrolled to.
      Parameters:
      newPosts - TRUE if new posts are scrolled to, otherwise FALSE
      See Also:
    • setACARSRestriction

      public void setACARSRestriction(Restriction r)
      Updates whether the Pilot is locked out of the ACARS server.
      Parameters:
      r - an ACARS Restriction
      See Also:
    • setACARSUpdateChannel

      public void setACARSUpdateChannel(UpdateChannel ch)
      Updates the Pilot's ACARS client update channel.
      Parameters:
      ch - an UpdateChannel
      See Also:
    • setNoTimeCompression

      public void setNoTimeCompression(boolean noCompress)
      Updates whether the Pilot cannot submit flight reports with Time Compression.
      Parameters:
      noCompress - TRUE if Time Compression disabled, otherwise FALSE
      See Also:
    • setNoExams

      public void setNoExams(boolean noExams)
      Updates whether this Pilot is locked out from taking new Examinations.
      Parameters:
      noExams - TRUE if the Testing Center is locked out, otherwise FALSE
      See Also:
    • setNoVoice

      public void setNoVoice(boolean noVoice)
      Updates whether the Pilot is locked out from the Voice server.
      Parameters:
      noVoice - TRUE if the Pilot cannot access the voice server, otherwise FALSE
      See Also:
    • setNoCooler

      public void setNoCooler(boolean noCooler)
      Updates whether the Pilot is locked out from the Water Cooler.
      Parameters:
      noCooler - TRUE if the Pilot cannot access the Water Cooler, otherwise FALSE
      See Also:
    • setShowSSThreads

      public void setShowSSThreads(boolean showThreads)
      Updates whether this Pilot will see Water Cooler screen shot threads.
      Parameters:
      showThreads - TRUE if screen show threads will be displayed, otherwise FALSE
      See Also:
    • setSignatureExtension

      public void setSignatureExtension(String ext)
      Sets if this Pilot has a signature image available. This method will clear the default signature flag.
      Parameters:
      ext - the Signature extension, or null
      See Also:
    • setSignatureModified

      public void setSignatureModified(Instant dt)
      Sets the last modified date the Pilot's signature image.
      Parameters:
      dt - the last modified date/time
      See Also:
    • setHasDefaultSignature

      public void setHasDefaultSignature(boolean hasSig)
      Sets if this Pilot's signature should be the default siganture. This method has no effect if the Pilot has a signature image.
      Parameters:
      hasSig - TRUE if the default signature should be used, otherwise FALSE
      See Also:
    • setMotto

      public void setMotto(String txt)
      Updates the Pilot's motto.
      Parameters:
      txt - the motto text
      See Also:
    • setMapType

      public void setMapType(MapType mt)
      Sets the Pilot's preferred Map type.
      Parameters:
      mt - the MapType
      See Also:
    • setShowNavBar

      public void setShowNavBar(boolean showNavBar)
      Sets whether a Navigation Bar or side menu should be rendered.
      Parameters:
      showNavBar - TRUE if a navigation bar should be rendered, otherwise FALSE
      See Also:
    • setHours

      public void setHours(double hours)
      Update this Pilot's logged hours. This method will typically only be called from a DAO where we are querying the PILOTS table, and not actually loading all the PIREPs but just getting a SUM(PIREPS.HOURS).
      Parameters:
      hours - the number of hours logged by this Pilot.
      See Also:
    • setLegs

      public void setLegs(int legs)
      Update this Pilot's logged flight legs. This method will typically only be called from a DAO where we are querying the PILOTS table, and not actually loading all the PIREPs but just getting a COUNT(PIREPS.HOURS).
      Parameters:
      legs - the number of legs logged by this Pilot
      See Also:
    • setOnlineLegs

      public void setOnlineLegs(int legs)
      Update this Pilot's logged onlne flight legs. This method will typically only be called from a DAO where we are querying the PILOTS table, and not actually loading all the PIREPs but just getting a COUNT(PIREPS.HOURS) WHERE ((PIREPS.ATTR invalid input: '&' 0x0D) != 0).
      Parameters:
      legs - the number of online legs logged by this Pilot
      See Also:
    • setEventLegs

      public void setEventLegs(int legs)
      Updates the number of flight legs flown as part of an Online Event.
      Parameters:
      legs - the number of lgs
      See Also:
    • setEventSignups

      public void setEventSignups(int signups)
      Updates the number of times this Pilot has signed up for an Online Event.
      Parameters:
      signups - the number of signups
      See Also:
    • setACARSLegs

      public void setACARSLegs(int legs)
      Update this Pilot's logged ACARS flight legs. This method will typically only be called from a DAO where we are querying the PILOTS table, and not actually loading all the PIREPs but just getting a COUNT(PIREPS.HOURS) WHERE ((PIREPS.ATTR invalid input: '&' 0x10) != 0).
      Parameters:
      legs - the number of ACARS legs logged by this Pilot
      See Also:
    • setLastFlight

      public void setLastFlight(Instant dt)
      Updates this Pilot's last flight report date. This method will typically only be called from a DAO where we are querying the PILOTS table, and not actually loading all the PIREPs but just getting a MAX(PIREPS.DATE).
      Parameters:
      dt - the date of the last flight.
      See Also:
    • setOnlineHours

      public void setOnlineHours(double hours)
      Updates this Pilot's logged online hours. This method will typically only be called from a DAO where we are querying the PILOTS table, and not actually loading all the PIREPs but just getting a SUM(PIREPS.HOURS) WHERE ((PIREPS.ATTRS invalid input: '&' 0x0D) != 0).
      Parameters:
      hours - the online hours logged by this Pilot
      See Also:
    • setEventHours

      public void setEventHours(double hours)
      Updates this Pilot's logged hours as part of an Online Event.
      Parameters:
      hours - the event hours logged by this Pilot
      See Also:
    • setACARSHours

      public void setACARSHours(double hours)
      Updates this Pilot's logged ACARS hours. This method will typically only be called from a DAO where we are querying the PILOTS table, and not actually loading all the PIREPs but just getting a SUM(PIREPS.HOURS) WHERE ((PIREPS.ATTRS invalid input: '&' 0x10) != 0).
      Parameters:
      hours - the ACARS hours logged by this Pilot
      See Also:
    • setTotalHours

      public void setTotalHours(double hours)
      Updates the Pilot's total logged hours between all airlines.
      Parameters:
      hours - the total hours logged by this Pilot
      See Also:
    • setTotalLegs

      public void setTotalLegs(int legs)
      Updates the Pilot's total flight legs between all airlines.
      Parameters:
      legs - the total legs logged by the Pilot
      See Also:
    • setDispatchFlights

      public void setDispatchFlights(int legs)
      Updates the number of flights the Pilot has dispactched as a Dispatcher.
      Parameters:
      legs - the number of flights dispatched
      See Also:
    • setDispatchHours

      public void setDispatchHours(double hours)
      Updates the number of hours spent providng Dispatch services.
      Parameters:
      hours - the number of hours providing service
      See Also:
    • setMiles

      public void setMiles(long miles)
      Update this pilot's logged miles. This method will typically only be called from a DAO where we are querying the PILOTS table, and not actually loading all the PIREPs but just getting a SUM(PIREPS.DISTANCE).
      Parameters:
      miles - the number of miles logged by this pilot
      See Also:
    • setLDAPName

      public void setLDAPName(String uid)
      Updates this Pilot's LDAP uid attribute, for use by Subversion and raw HTTP access.
      Parameters:
      uid - the userid, which will be converted to lowercase
      See Also:
    • addRating

      public void addRating(String rating)
      Add a rated equipment type for this Pilot.
      Parameters:
      rating - the aircraft type to add to this Pilot's ratings.
      Throws:
      NullPointerException - if the rating is null
      See Also:
    • addRatings

      public void addRatings(Collection<String> ratings)
      Add a number of equipment type ratings for this Pilot.
      Parameters:
      ratings - a Collection of ratings to add to this Pilot's ratings
      Throws:
      NullPointerException - if ratings is null
      See Also:
    • addPushEndpoint

      public void addPushEndpoint(PushEndpoint ep)
      Adds a Push Notification endpoint for this Pilot.
      Parameters:
      ep - a PushEndpoint
      See Also:
    • removeRatings

      public void removeRatings(Collection<String> ratings)
      Remove a number of equipment type ratings for this Pilot.
      Parameters:
      ratings - a Collection of ratings to remove from this Pilot's ratings
      Throws:
      NullPointerException - if ratings is null
      See Also:
    • addRole

      public void addRole(String roleName)
      Description copied from class: Person
      Add a security role to the Person's list of roles.
      Specified by:
      addRole in class Person
      Parameters:
      roleName - the name of the role
    • addRoles

      public void addRoles(Collection<String> roles)
      Adds membership in a group of security roles to this Pilot.
      Parameters:
      roles - a Collection of role names
      See Also:
    • addAccomplishmentID

      public void addAccomplishmentID(DatedAccomplishmentID id)
      Adds an Accomplishment to this Pilot.
      Parameters:
      id - a DatedAccomplishmentID
      See Also:
    • removeRoles

      public void removeRoles(Collection<String> roles)
      Removes this Pilot's membership in a group fo security roles.
      Parameters:
      roles - a Collection of role names
      See Also:
    • addCertification

      public void addCertification(String certCode)
      Adds a Flight Academy certification code for this Pilot.
      Parameters:
      certCode - the Certification code
      See Also:
    • addCertifications

      public void addCertifications(Collection<String> certCodes)
      Adds Flight Academy certification codes for this Pilot.
      Parameters:
      certCodes - a Collection of Certification codes
      See Also:
    • setPilotNumber

      public void setPilotNumber(int pNumber)
      Updates the Pilot's seniority number.
      Parameters:
      pNumber - the new seniority number
      Throws:
      IllegalArgumentException - if pNumber is zero or negative
      See Also:
    • setPilotCode

      public void setPilotCode(CharSequence code)
      Set the pilot code for this Pilot.
      Parameters:
      code - the pilot code eg. DVA043
      Throws:
      NullPointerException - if code is null
      IllegalArgumentException - if the code does not start with the prefix, or the remainder of the code cannot be parsed to a number via DecimalFormat.parse("##000");
      See Also:
    • 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
    • cloneExceptID

      public Pilot cloneExceptID()
      Shallow-clone a Pilot by copying everything except FlightReport/StatusUpdate beans and the database ID.
      Returns:
      a copy of the current Pilot bean
      See Also:
    • clone

      public Object clone()
      Shallow-clone a Pilot by copying everything except FlightReport/StatusUpdate beans.
      Overrides:
      clone in class Object
      Returns:
      a copy of the current Pilot bean
      See Also: