Class Person

All Implemented Interfaces:
Serializable, Comparable<Object>, Principal, EMailAddress, FormattedEMailRecipient, IDBean, ViewEntry, Cacheable
Direct Known Subclasses:
Applicant, Pilot

public abstract class Person extends DatabaseBlobBean implements Principal, FormattedEMailRecipient, ViewEntry
An abstract class storing information about a Person.
Since:
1.0
Version:
10.3
Author:
Luke
See Also:
  • Field Details

  • Constructor Details

    • Person

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

    • addRole

      public abstract void addRole(String roleName)
      Add a security role to the Person's list of roles.
      Parameters:
      roleName - the name of the role
    • getRoles

      public abstract Collection<String> getRoles()
      Returns a list of security roles this Person belongs to.
      Returns:
      a Collection of role names
    • isInRole

      public abstract boolean isInRole(String roleName)
      Queries if a Person is a member of a particular role.
      Parameters:
      roleName - the role name
      Returns:
      TRUE if the Person is a member of this role, otherwise FALSE
    • getName

      public String getName()
      Returns this Person's Full name.
      Specified by:
      getName in interface EMailAddress
      Specified by:
      getName in interface Principal
      Returns:
      the Person's first and last names.
    • getFirstName

      public String getFirstName()
      Return this Person's First Name.
      Returns:
      Person's first (given) name.
      See Also:
    • getLastName

      public String getLastName()
      Return this Person's Last Name.
      Returns:
      Person's last (family) name.
      See Also:
    • getDN

      public String getDN()
      Return this Person's LDAP/JNDI Directory Name.
      Returns:
      Person's unique DN in the repository. If this is null then the Person does not have a JNDI entry.
      See Also:
    • getPassword

      public String getPassword()
      Return the Person's password.
      Returns:
      the unencrypted password. This will only be non-null when changing a password or registering a new Person.
      See Also:
    • getEquipmentType

      public String getEquipmentType()
      Return the Person's equipment type program. In the case of an Applicant not yet hired, this will be null.
      Returns:
      the equipment type, or null
      See Also:
    • getEmail

      public String getEmail()
      Return the Person's e-mail address.
      Specified by:
      getEmail in interface EMailAddress
      Returns:
      the e-mail address
      See Also:
    • isInvalid

      public boolean isInvalid()
      Description copied from interface: EMailAddress
      Returns whether this recipient has an invalid e-mail address.
      Specified by:
      isInvalid in interface EMailAddress
      Returns:
      TRUE if invalid, otherwise FALSE
    • getEmailAccess

      public int getEmailAccess()
      Returns the access to a Person's e-mail address.
      Returns:
      the access level
      See Also:
    • getEmailDomain

      public String getEmailDomain()
      Returns this person's e-mail domain.
      Returns:
      the domain part of the e-mail address, or null if no address.
    • getRank

      public Rank getRank()
      Return the Person's rank. In the case of an Applicant not yet hired this will be null.
      Returns:
      the rank, or null
      See Also:
    • getTZ

      public TZInfo getTZ()
      Return this Person's Time Zone.
      Specified by:
      getTZ in interface FormattedEMailRecipient
      Returns:
      the time zone where this Person is located
      See Also:
    • getLegacyHours

      public double getLegacyHours()
      Return this Person's legacy flight hours.
      Returns:
      Person's Legacy flight hours
      See Also:
    • getLocation

      public String getLocation()
      Return the Person's location.
      Returns:
      the part of the world this Person lives in
      See Also:
    • getExternalID

      public String getExternalID(ExternalID service)
      Returns the Person's external IDs.
      Parameters:
      service - the ID service name
      Returns:
      the ID, or null if not found
      Throws:
      NullPointerException - if service is null
    • getExternalIDs

      public Map<ExternalID, String> getExternalIDs()
      Returns a Map containing this Person's external IDs.
      Returns:
      the External IDs
      See Also:
    • hasID

      public boolean hasID(ExternalID svc)
      Returns whether a Person has a specific Instant Messenger handle.
      Parameters:
      svc - an IMAddress object
      Returns:
      TRUE if the Person has an address for this service, otherwise FALSE
    • getHomeAirport

      public String getHomeAirport()
      Return the Person's home airport code.
      Returns:
      the closest Airport code this this Person''s location. This is self-selected.
      See Also:
    • getNetworks

      public Collection<OnlineNetwork> getNetworks()
      Returns the Online Networks this used has provided an ID for.
      Returns:
      the networks
    • hasNetworkID

      public boolean hasNetworkID(OnlineNetwork net)
      Retuns if this Person is a memebr of an online network.
      Parameters:
      net - the OnlineNetwork
      Returns:
      TRUE if the user has a network ID, otherwise false
    • getNetworkID

      public String getNetworkID(OnlineNetwork net)
      Returns this Person's online network ID
      Parameters:
      net - the OnlineNetwork
      Returns:
      the network ID
      See Also:
    • hasNotifyOption

      public boolean hasNotifyOption(Notification notifyType)
      Return a particular e-mail notification option for this Person.
      Parameters:
      notifyType - the NotificationType, use constants if possible
      Returns:
      TRUE if this Person should be notified
      See Also:
    • getNotifyOptions

      public Collection<Notification> getNotifyOptions()
      Returns all selected notification options.
      Returns:
      a List of notification types
      See Also:
    • getNotifyCode

      public int getNotifyCode()
      Returns the aggregated notification code.
      Returns:
      the notification code.
    • getLoginCount

      public int getLoginCount()
      Return the number of times this Person has logged into the system.
      Returns:
      the number of times this person has logged in
      See Also:
    • getLoginHost

      public String getLoginHost()
      Return the hostname or IP address that this Person last logged in from.
      Returns:
      the host name or IP address
      See Also:
    • getCreatedOn

      public Instant getCreatedOn()
      Return the date/time this Person registered.
      Returns:
      the date/time the person was registered
      See Also:
    • getLastLogin

      public Instant getLastLogin()
      Return the Person's latest login date/time.
      Returns:
      the date/time this person last logged into the system
      See Also:
    • getLastLogoff

      public Instant getLastLogoff()
      Return the Person's last logoff date/time.
      Returns:
      the date/time this person last logged off the system
    • getDateFormat

      public String getDateFormat()
      Returns the Person's preferred date format pattern.
      Specified by:
      getDateFormat in interface FormattedEMailRecipient
      Returns:
      the date format pattern
      See Also:
    • getTimeFormat

      public String getTimeFormat()
      Returns the Person's preferred time format pattern.
      Specified by:
      getTimeFormat in interface FormattedEMailRecipient
      Returns:
      the time format pattern
      See Also:
    • getNumberFormat

      public String getNumberFormat()
      Returns the Person's preferred number format pattern.
      Specified by:
      getNumberFormat in interface FormattedEMailRecipient
      Returns:
      the number format pattern
      See Also:
    • getUIScheme

      public String getUIScheme()
      Returns the Person's preferred web site UI scheme.
      Returns:
      the web site UI scheme name
      See Also:
    • getViewCount

      public int getViewCount()
      Returns the Person's preferred view window size.
      Returns:
      the view size in rows
      See Also:
    • getDistanceType

      public DistanceUnit getDistanceType()
      Returns the Person's preferred distance unit.
      Specified by:
      getDistanceType in interface FormattedEMailRecipient
      Returns:
      the unit type
      See Also:
    • getWeightType

      public WeightUnit getWeightType()
      Returns the Person's preferred weight unit.
      Returns:
      the unit type
      See Also:
    • getAirportCodeType

      public Airport.Code getAirportCodeType()
      Returns the Person's preferred airport code type (IATA/ICAO).
      Specified by:
      getAirportCodeType in interface FormattedEMailRecipient
      Returns:
      the Airport Code type
      See Also:
    • setDN

      public void setDN(String dn)
      Update the Person's directory name. Setting a non-null value implies the Person is in the directory.
      Parameters:
      dn - the full directory name
      See Also:
    • setFirstName

      public void setFirstName(String name)
      Updates the Person's first (given) name.
      Parameters:
      name - the given name
      Throws:
      NullPointerException - if name is null
    • setLastName

      public void setLastName(String name)
      Updates the Person's last (family) name.
      Parameters:
      name - the family name
      Throws:
      NullPointerException - if name is null
    • setNetworkID

      public void setNetworkID(OnlineNetwork network, CharSequence id)
      Update the Person's network ID for a given online network.
      Parameters:
      network - the network
      id - the network ID
      See Also:
    • setNotifyOption

      public void setNotifyOption(Notification option, boolean notify)
      Update this Person's notification option for a given notificaiton type.
      Parameters:
      option - the notification type
      notify - TRUE if this person should be notified
      See Also:
    • setNotificationCode

      public void setNotificationCode(int code)
      Sets the notification options for a user from a single bitmap value.
      Parameters:
      code - the bitmap value
      See Also:
    • setPassword

      public void setPassword(String pwd)
      Update the Person's password.
      Parameters:
      pwd - the new password
      See Also:
    • setEquipmentType

      public void setEquipmentType(String eqType)
      Update the Person's Equipment Type.
      Parameters:
      eqType - the equipment type name, or null if not hired
      See Also:
    • setEmail

      public void setEmail(String email)
      Update the Person's e-mail address.
      Parameters:
      email - the e-mail address
      See Also:
    • setEmailInvalid

      public void setEmailInvalid(boolean isInvalid)
      Marks the email address as invalid.
      Parameters:
      isInvalid - TRUE if invalid, otherwise FALSE
      See Also:
    • setEmailAccess

      public void setEmailAccess(int accessLevel)
      Update the Person's e-mail address acess level.
      Parameters:
      accessLevel - the access level
      Throws:
      IllegalArgumentException - if the access level is negative or invalid
      See Also:
    • setRank

      public void setRank(Rank rank)
      Update the person's Rank.
      Parameters:
      rank - the new Rank, or null if not hired
      See Also:
    • setTZ

      public void setTZ(TZInfo tz)
      Sets the Time Zone for this Person.
      Parameters:
      tz - the time zone where this Person is located
      See Also:
    • setLegacyHours

      public void setLegacyHours(double legacyHours)
      Update this Person's legacy flight hours.
      Parameters:
      legacyHours - the Legacy Flight hours.
      Throws:
      IllegalArgumentException - if the new hours are negative.
      See Also:
    • setHomeAirport

      public void setHomeAirport(String aCode)
      Update this Person's home airport
      Parameters:
      aCode - this person's IATA home airport code.
      See Also:
    • setLocation

      public void setLocation(String location)
      Update this Person's location.
      Parameters:
      location - the location where this Person lives. It is up to the implementation as to what are valid choices.
      See Also:
    • setExternalID

      public void setExternalID(ExternalID svc, String handle)
      Update this Person's Instant Messaging handle. If the handle is empty, it will be cleared.
      Parameters:
      svc - the messaging service
      handle - the new handle
      See Also:
    • setLoginCount

      public void setLoginCount(int count)
      Update this person's login count
      Parameters:
      count - the new login count.
      See Also:
    • setCreatedOn

      public void setCreatedOn(Instant cd)
      Update this Person's createdOn date/time
      Parameters:
      cd - the Date/Time when the Person was created
      See Also:
    • setLastLogin

      public void setLastLogin(Instant lld)
      Update this Person's last Login date/time.
      Parameters:
      lld - the Date/Time when the Person last logged in
      Throws:
      IllegalStateException - if the timestamp is less than getCreatedOn()
      See Also:
    • setLastLogoff

      public void setLastLogoff(Instant lld)
      Update the Person's last Logoff date/time.
      Parameters:
      lld - the Date/Time when the Person last logged out or had the session invalidated
      Throws:
      IllegalStateException - if the timestamp is less than getCreatedOn()
      See Also:
    • setLoginHost

      public void setLoginHost(String hostName)
      Updates the hostname or IP address that this Person last logged in from
      Parameters:
      hostName - the hostname or IP address
      See Also:
    • setDateFormat

      public void setDateFormat(String pattern)
      Updates the Person's preferred date format.
      Parameters:
      pattern - the date format pattern
      See Also:
    • setTimeFormat

      public void setTimeFormat(String pattern)
      Updates the Person's preferred time format.
      Parameters:
      pattern - the time format pattern
      See Also:
    • setNumberFormat

      public void setNumberFormat(String pattern)
      Updates the Person's preferred number format.
      Parameters:
      pattern - the number format pattern
      See Also:
    • setUIScheme

      public void setUIScheme(String schemeName)
      Updates this Person's preferred web site UI scheme.
      Parameters:
      schemeName - the scheme name
      See Also:
    • setViewCount

      public void setViewCount(int size)
      Sets the size of the Person's preferred view window.
      Parameters:
      size - the size in rows
      See Also:
    • setDistanceType

      public void setDistanceType(DistanceUnit un)
      Updates the Person's preferred distance units.
      Parameters:
      un - the DistanceUnit
      See Also:
    • setWeightType

      public void setWeightType(WeightUnit un)
      Updates the Person's preferred weight units.
      Parameters:
      un - the WeightUnit
      See Also:
    • setAirportCodeType

      public void setAirportCodeType(Airport.Code code)
      Updates the Person's preferred airport code type (IATA/ICAO).
      Parameters:
      code - the Airport code type
      See Also:
    • toString

      public String toString()
      Returns the person's full name.
      Specified by:
      toString in interface Principal
      Overrides:
      toString in class Object