Class Message

java.lang.Object
org.deltava.beans.DatabaseBean
org.deltava.beans.cooler.Message
All Implemented Interfaces:
Serializable, Comparable<Object>, AuthoredBean, IDBean, RemoteAddressBean, Cacheable
Direct Known Subclasses:
GetCoolerChannels.LastPostMessage

public class Message extends DatabaseBean implements AuthoredBean, RemoteAddressBean
A class to store Water Cooler posts.
Since:
1.0
Version:
10.2
Author:
Luke
See Also:
  • Constructor Details

    • Message

      public Message(int authorID)
      Create a new message object from a particular author.
      Parameters:
      authorID - the database ID for the author
      Throws:
      IllegalArgumentException - if authorID is zero or negative
      See Also:
  • Method Details

    • getThreadID

      public int getThreadID()
      Get the message thread ID. This is typically called by a DAO
      Returns:
      the entry corresponding to the primary key in the COOLER_THREADS table in the database.
      See Also:
    • getCreatedOn

      public Instant getCreatedOn()
      Returns the date and time this post was written.
      Returns:
      the date/time this post was written
      See Also:
    • getAuthorID

      public int getAuthorID()
      Returns the author of this message.
      Specified by:
      getAuthorID in interface AuthoredBean
      Returns:
      the database ID of the Pilot object for this message's author.
      See Also:
    • getBody

      public String getBody()
      Returns the message body.
      Returns:
      the message body
      See Also:
    • getRemoteAddr

      public String getRemoteAddr()
      Description copied from interface: RemoteAddressBean
      Returns the remote IP address.
      Specified by:
      getRemoteAddr in interface RemoteAddressBean
      Returns:
      an IPv4 or IPv6 address
    • getRemoteHost

      public String getRemoteHost()
      Description copied from interface: RemoteAddressBean
      Returns the remote host name.
      Specified by:
      getRemoteHost in interface RemoteAddressBean
      Returns:
      the host name, or address if unresolved
    • getContentWarning

      public boolean getContentWarning()
      Returns whether this message contains questionable content.
      Returns:
      TRUE if there is questionable content, otherwise FALSE
      See Also:
    • setCreatedOn

      public void setCreatedOn(Instant dt)
      Updates the date/time the message was written.
      Parameters:
      dt - the date invalid input: '&' time this message was created
      See Also:
    • setBody

      public void setBody(String body)
      Updates this message's content.
      Parameters:
      body - the new content of the message
    • setThreadID

      public void setThreadID(int id)
      Updates the thread ID of this message. This is typically called by a DAO
      Parameters:
      id - the entry corresponding to the primary key in the COOLER_THREADS table in the database.
      Throws:
      IllegalArgumentException - if id is zero or negative
      See Also:
    • setRemoteAddr

      public void setRemoteAddr(String addr)
      Updates the IP address from where this message was posted.
      Parameters:
      addr - the IP address
      See Also:
    • setRemoteHost

      public void setRemoteHost(String hostName)
      Updates the host name from where this message was posted.
      Parameters:
      hostName - the host name
      See Also:
    • setContentWarning

      public void setContentWarning(boolean isWarn)
      Toggles the content warning flag for this message.
      Parameters:
      isWarn - TRUE if the message contains questionable content, otherwise FALSE
      See Also:
    • setAuthorID

      public void setAuthorID(int id)
      Updates the author of this Message.
      Specified by:
      setAuthorID in interface AuthoredBean
      Parameters:
      id - the author's database ID
      Throws:
      IllegalArgumentException - if id is zero or negative
      See Also:
    • compareTo

      public int compareTo(Object o2)
      Implements default sort ordering by comparing the creation dates.
      Specified by:
      compareTo in interface Comparable<Object>
      Overrides:
      compareTo in class DatabaseBean
      Throws:
      ClassCastException - if o2 isn't a Message
      See Also: