Class Channel

java.lang.Object
org.deltava.beans.cooler.Channel
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Channel>, Auditable, ComboAlias, ViewEntry, Cacheable
Direct Known Subclasses:
Channel.AllChannel

public class Channel extends Object implements Comparable<Channel>, Auditable, Cacheable, ComboAlias, ViewEntry
A class containing Water Cooler channel data.
Since:
1.0
Version:
11.0
Author:
Luke
See Also:
  • Field Details

    • ALL

      public static final Channel ALL
    • SHOTS

      public static final Channel SHOTS
  • Constructor Details

    • Channel

      public Channel(String name)
      Creates a new Channel object with a given Channel name.
      Parameters:
      name - the Channel name
      Throws:
      NullPointerException - if name is null
      See Also:
  • Method Details

    • getName

      public String getName()
      Returns the Channel name.
      Returns:
      the channel name
    • 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
    • getDescription

      public String getDescription()
      Returns the Channel description.
      Returns:
      the channel description
      See Also:
    • getReadRoles

      public Collection<String> getReadRoles()
      Returns the roles authorized to access this Channel.
      Returns:
      a Collection of roles authorized to view this Channel
      See Also:
    • getWriteRoles

      public Collection<String> getWriteRoles()
      Returns the roles authorized to post in this Channel.
      Returns:
      a Collection of roles authorized to view this Channel
      See Also:
    • getNotifyRoles

      public Collection<String> getNotifyRoles()
      Returns the roles notified when a new post is created in this Channel.
      Returns:
      a Collection of roles
      See Also:
    • getViewCount

      public int getViewCount()
      Returns the total number of thread views for Threads in this Channel.
      Returns:
      the number of views
      See Also:
    • getThreadCount

      public int getThreadCount()
      Returns the total number of message threads in this Channel.
      Returns:
      the number of threads
      See Also:
    • getPostCount

      public int getPostCount()
      Returns the number of posts in this Channel.
      Returns:
      the number of posts
      See Also:
    • getAirlines

      public Collection<String> getAirlines()
      Returns the airlines associated with this Channel.
      Returns:
      a sorted Set of Airline codes for this Channel
      See Also:
    • getLastSubject

      public String getLastSubject()
      Returns the title of the latest post in this Channel.
      Returns:
      the post title
      See Also:
    • getLastThreadID

      public int getLastThreadID()
      Returns ID of the last Message Thread in this Channel.
      Returns:
      the database ID of the latest post
      See Also:
    • getActive

      public boolean getActive()
      Queries if the Channel is active.
      Returns:
      TRUE if the Channel is active, otherwise FALSE
      See Also:
    • getAllowNewPosts

      public boolean getAllowNewPosts()
      Queries if new Threads or Replies are allowed.
      Returns:
      TRUE if new threads/replies are allowed, otherwise FALSE
      See Also:
    • hasAirline

      public boolean hasAirline(String aCode)
      Queries if the Channel supports a particular airline.
      Parameters:
      aCode - the Airline Code
      Returns:
      TRUE if the Channel is supported by an airline, FALSE otherwisse
      See Also:
    • addAirline

      public void addAirline(String aCode)
      Add an Airline to the list of enabled airlines.
      Parameters:
      aCode - the Airline code to add
      Throws:
      NullPointerException - if the airline code is null
      See Also:
    • setAirlines

      public void setAirlines(Collection<String> aCodes)
      Updates the enabled airlines.
      Parameters:
      aCodes - the Airline codes to enable
      Throws:
      NullPointerException - if aCodes is null
      See Also:
    • addRole

      public void addRole(Channel.InfoType type, String roleName)
      Add a security role to this Channel.
      Parameters:
      type - the role type
      roleName - the name of the role to add to this Channel's access list
      See Also:
    • setRoles

      public void setRoles(Channel.InfoType type, Collection<String> roles)
      Updates the security roles for this Channel.
      Parameters:
      type - the role type
      roles - the roles to add to this Channel's access list
      See Also:
    • setDescription

      public void setDescription(String desc)
      Update the Channel description.
      Parameters:
      desc - the Channel description
      See Also:
    • setActive

      public void setActive(boolean active)
      Set the channel active/inactive.
      Parameters:
      active - TRUE if the Channel is active, otherwise FALSE
      See Also:
    • setAllowNewPosts

      public void setAllowNewPosts(boolean allow)
      Updates whether new Threads or Replies are allowed.
      Parameters:
      allow - TRUE if new posts allowed, otherwise FALSE
      See Also:
    • setLastSubject

      public void setLastSubject(String subj)
      Updates the last subject posted to in this Channel.
      Parameters:
      subj - the thread subject
      See Also:
    • setLastThreadID

      public void setLastThreadID(int id)
      Updates the ID of the last Message Thread in this Channel.
      Parameters:
      id - the database ID
      Throws:
      IllegalArgumentException - if id is negative
      See Also:
    • setThreadCount

      public void setThreadCount(int count)
      Updates the number of Message Threads in this Channel.
      Parameters:
      count - the number of threads
      See Also:
    • setPostCount

      public void setPostCount(int count)
      Updates the number of posts in this Channel.
      Parameters:
      count - the number of posts
      See Also:
    • setViewCount

      public void setViewCount(int count)
      Updates the number of times all Threads in this Channel have been viewed.
      Parameters:
      count - the number of thread views
      See Also:
    • 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
      Returns:
      the cache key for the object
    • equals

      public boolean equals(Object o2)
      Compares the channel to another object.
      Overrides:
      equals in class Object
      Returns:
      TRUE if o2 is a channel with the same name, or a String with the same name
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(Channel c2)
      Specified by:
      compareTo in interface Comparable<Channel>
    • 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
    • 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