Class Accomplishment

java.lang.Object
org.deltava.beans.DatabaseBean
org.deltava.beans.stats.Accomplishment
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Object>, Auditable, ComboAlias, IDBean, RGBColor, ViewEntry, Cacheable
Direct Known Subclasses:
DatedAccomplishment

public class Accomplishment extends DatabaseBean implements RGBColor, ComboAlias, Auditable, ViewEntry
A bean to define Pilot Accomplishments.
Since:
3.2
Version:
11.4
Author:
Luke
See Also:
  • Constructor Details

    • Accomplishment

      public Accomplishment(String name)
      Creates the bean.
      Parameters:
      name - the accomplishment name
      See Also:
    • Accomplishment

      public Accomplishment(DatedAccomplishment da)
      Creates an Accomplishment from a DatedAccomplishment
      Parameters:
      da - the DatedAccomplishment
  • Method Details

    • getName

      public String getName()
      Returns the Accomplishment name.
      Returns:
      the name
      See Also:
    • getUnit

      public AccomplishUnit getUnit()
      Returns the Accomplishment unit.
      Returns:
      the unit
      See Also:
    • getValue

      public int getValue()
      Returns the Accomplishment value.
      Returns:
      the value
      See Also:
    • getColor

      public int getColor()
      Description copied from interface: RGBColor
      Returns the RGB color.
      Specified by:
      getColor in interface RGBColor
      Returns:
      a 24-bit RGB color value
    • getActive

      public boolean getActive()
      Returns whether this Accomplishment is active.
      Returns:
      TRUE if active, otherwise FALSE
      See Also:
    • getAlwaysDisplay

      public boolean getAlwaysDisplay()
      Returns whether the Accomplishment should always display, even if the Pilot has achieved an accomplishment with the same Unit and a higher count.
      Returns:
      TRUE if the accomplishment should always be displayed if achieved, otherwise FALSE
    • getPilots

      public int getPilots()
      Returns the number of Pilots who have achieved this Accomplishment.
      Returns:
      the number of Pilots
      See Also:
    • getChoices

      public Collection<String> getChoices()
      Returns the choices for this Accomplishment. This limits the possible values used to count towards this Accomplishment.
      Returns:
      a Collection of Strings
    • getOwner

      public AirlineInformation getOwner()
      Returns the owning Airline of this Accomplishment.
      Returns:
      the AirlineInformation bean for the owner Airline
      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
    • setName

      public void setName(String name)
      Updates the accomplishment name.
      Parameters:
      name - the accomplishment name
      Throws:
      NullPointerException - if name is null
      See Also:
    • setUnit

      public void setUnit(AccomplishUnit u)
      Updates the unit of measurement.
      Parameters:
      u - the AccomplishUnit
      See Also:
    • setValue

      public void setValue(int value)
      Updates the number of units required for this Accomplishment.
      Parameters:
      value - the number of units
      See Also:
    • setColor

      public void setColor(int c)
      Updates the color used to display this Accomplishment.
      Parameters:
      c - the RGB code
      See Also:
    • setActive

      public void setActive(boolean isActive)
      Updates whether this Accomplishment is active.
      Parameters:
      isActive - TRUE if active, otherwise FALSE
      See Also:
    • setAlwaysDisplay

      public void setAlwaysDisplay(boolean show)
      Sets the Accomplishment to always display, even if the Pilot has achieved an accomplishment with the same Unit and a higher count.
      Parameters:
      show - TRUE if the accomplishment should always be displayed if achieved, otherwise FALSE
    • setOwner

      public void setOwner(AirlineInformation info)
      Updates the Owner of this Accomplishment.
      Parameters:
      info - the AirlineInformation bean for the owner airline
      See Also:
    • setPilots

      public void setPilots(int cnt)
      Updates the number of Pilots that have achieved this Accomplishment.
      Parameters:
      cnt - the number of Pilots
      See Also:
    • setChoices

      public void setChoices(Collection<String> choices)
      Updates the choices for this Accomplishment.
      Parameters:
      choices - a Collection of strings
    • renameChoice

      public boolean renameChoice(String oc, String nc)
      Renames one of the Accomplishment choices.
      Parameters:
      oc - the old name
      nc - the new name
      Returns:
      TRUE if the choice was present and renamed, otherwise FALSE
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class DatabaseBean
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class DatabaseBean
    • 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
    • compareTo

      public int compareTo(Object o)
      Specified by:
      compareTo in interface Comparable<Object>
      Overrides:
      compareTo in class DatabaseBean
    • isCrossApp

      public boolean isCrossApp()
      Description copied from interface: Auditable
      Returns whether this object is within multiple web applications. Objects where this is false will need additional data appended to the audit ID to prevent information leakage across applications where the audit IDs are identical between apps.
      Specified by:
      isCrossApp in interface Auditable
      Returns:
      TRUE if cross-application, otherwise FALSE
    • getAuditID

      public String getAuditID()
      Description copied from interface: Auditable
      Returns the object ID for this auditable object.
      Specified by:
      getAuditID in interface Auditable
      Returns:
      the ID