Class UserData

All Implemented Interfaces:
Serializable, Comparable<Object>, IDBean, Cacheable

public class UserData extends DatabaseBean
A class to store cross-Airline User data. This is used to track locations of users in parts of the application (Water Cooler, Online Events) that allow users from other airlines to write database entries.
Since:
1.0
Version:
9.0
Author:
Luke
See Also:
  • Constructor Details

    • UserData

      public UserData(String dbName, String table, String domain)
      Creates a new UserData bean when a User is created.
      Parameters:
      dbName -
      table -
      domain -
    • UserData

      public UserData(int id)
      Creates a new User Data bean for the specified User.
      Parameters:
      id - the User's database ID
    • UserData

      public UserData(Person p)
      Creates a new User Data bean for the specified Person.
      Parameters:
      p - the Person bean
  • Method Details

    • getDB

      public String getDB()
      Returns the name of the database containing the User.
      Returns:
      the database name
      See Also:
    • getDBTable

      public String getDBTable()
      Returns the fully qualified table name.
      Returns:
      the the database and table names as db.TABLENAME
    • getAirlineCode

      public String getAirlineCode()
      Returns the User's airline code.
      Returns:
      the airline code
      See Also:
    • getTable

      public String getTable()
      Returns the name of the table containing the User.
      Returns:
      the database table name
      See Also:
    • getDomain

      public String getDomain()
      Returns the domain name of the web site containing the User's profile.
      Returns:
      the domain name
      See Also:
    • getIDs

      public Collection<Integer> getIDs()
      Returns the database IDs of this user's profiles in other Airlines.
      Returns:
      a Collection of Database IDs
      See Also:
    • hasID

      public boolean hasID(int id)
      Returns whether this User has a particular database ID in an application.
      Parameters:
      id - the database ID
      Returns:
      TRUE if this User has this ID in an application, otherwise FALSE
    • isApplicant

      public boolean isApplicant()
      Returns if the User is an Applicant or a Pilot.
      Returns:
      TRUE if the user is an Applicant, otherwise FALSE
    • setDB

      public void setDB(String dbName)
      Updates the database name. This will be converted to lowercase.
      Parameters:
      dbName - the name of the database containing this User
      Throws:
      NullPointerException - if dbName is null
      See Also:
    • setAirlineCode

      public void setAirlineCode(String aCode)
      Updates the User's airline code. This will be converted to uppercase.
      Parameters:
      aCode - the Airline code
      Throws:
      NullPointerException - if aCode is null
      See Also:
    • setTable

      public void setTable(String tableName)
      Updates the table name. This will be converted to uppercase.
      Parameters:
      tableName - the name of the table containing this User
      Throws:
      NullPointerException - if tableName is null
      See Also:
    • setDomain

      public void setDomain(String domainName)
      Sets the domain name of the database used to view the User's profile. This will be converted to lowercase.
      Parameters:
      domainName - the domain of the web site containing this user's Profile
      Throws:
      NullPointerException - if domainName is null
      See Also:
    • setID

      public void setID(int id)
      Description copied from class: DatabaseBean
      Update the database row ID of this bean. This typically will only be called by a DAO
      Overrides:
      setID in class DatabaseBean
      Parameters:
      id - The primary key of the entry in the database that corresponds to this object.
      See Also:
    • addID

      public void addID(int id)
      Adds the database ID for the user's profile in another airline.
      Parameters:
      id - the new ID
      Throws:
      IllegalArgumentException - if id is zero or negative
    • isPilotTable

      public static boolean isPilotTable(String tableName)
      Utility method to query whether a table is a Pilot or Applicant table.
      Parameters:
      tableName - the table name, in either TABLE or DB.TABLE format
      Returns:
      TRUE if the table should be queried by a Pilot DAO, otherwise FALSE
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class DatabaseBean
    • 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
      Overrides:
      cacheKey in class DatabaseBean
      Returns:
      the cache key for the object