Class MessageThread
java.lang.Object
org.deltava.beans.DatabaseBean
org.deltava.beans.cooler.MessageThread
- All Implemented Interfaces:
Serializable,Comparable<Object>,AuthoredBean,IDBean,ViewEntry,Cacheable
A class to store Water Cooler message threads.
- Since:
- 1.0
- Version:
- 11.1
- Author:
- Luke
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMessageThread(String subject) Create a new thread with a particular subject. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddImageURL(String url, String desc) Adds a URL to the list of linked Image URLs for this Message Thread.voidaddImageURL(LinkedImage img) Adds a URL to the list of linked Image URLs for this Message Thread.voidaddOption(PollOption opt) Adds a single poll option to this thread.voidaddOptions(Collection<PollOption> opts) Adds poll options to this thread.voidAdds a message to this thread.voidaddReportID(int id) Adds a database ID to the list of users reporting a thread for content.voidaddUpdate(ThreadUpdate upd) Adds a thread update entry to this thread.voidaddVotes(Collection<PollVote> votes) Adds poll votes to this thread.intCompares to another thread via the last updated on date.intReturns the database ID of the first Person to post to this thread.Returns the channel name for this thread.booleanReturns whether this thread has any disabled Image Links.booleanReturns if this thread is hidden to general users.intgetImage()Returns the linked image ID for this thread.Returns all linked Image URLs for this Message Thread.Returns the last post in a message thread.Returns the date of the latest post in this thread.intReturns the database ID of the last Person to post to this thread.booleanReturns if this thread is locked (no new posts allowed).intgetNextPostID(Instant dt) Returns the post ID of the first post created after a particular date/time.Returns all poll options for this Message Thread.booleangetPoll()Returns if this thread has a poll.intReturns the number of messages in this thread.getPosts()Returns this thread's messages.intReturns the number of times this post has been reported for content.Returns the database IDs of all users reporting this thread for content.Selects a table row class based upon whether the thread is hidden or not.booleanReturns if this thread should be considered a "sticky" thread in its Channel only.Returns the date/time this thread will be "stuck" at the top of the thread list until.Returns the thread's subject.Returns this thread's update historyintgetViews()Returns the number of times this thread has been read.getVotes()Returns all poll votes for this Message Thread.booleanhasVoted(int pilotID) Returns whether a Pilot has voted in a particular Water Cooler poll.voidsetAuthorID(int id) Updates the database ID of the first Person to post to this thread.voidsetChannel(String channelName) Updates this thread's Channel.voidsetHidden(boolean hidden) Sets this thread's hidden flag.voidsetImage(int id) Updates the linked image for this thread.voidUpdates the date this thread's latest message was posted.voidsetLastUpdateID(int id) Updates the database ID of the last Person to post to this thread.voidsetLocked(boolean locked) Sets this thread's locked flag.voidsetPoll(boolean poll) Sets this thread's poll flag.voidsetPostCount(int posts) Updates the number of messages in this thread.voidsetReportCount(int count) Updates the thread's content report count.voidsetStickyInChannelOnly(boolean isSticky) Updates whether the thread will be sticky in the current channel only.voidUpdates the date/time this thread will be a "sticky" until.voidsetViews(int views) Updates the number of times this thread has been read.voidview()Increments the view counter.Methods inherited from class org.deltava.beans.DatabaseBean
cacheKey, equals, getHexID, getID, hashCode, setID, validateID, validateID
-
Constructor Details
-
MessageThread
Create a new thread with a particular subject.- Parameters:
subject- the thread subject- Throws:
NullPointerException- if subject is null- See Also:
-
-
Method Details
-
getChannel
Returns the channel name for this thread.- Returns:
- the channel name
- See Also:
-
getAuthorID
public int getAuthorID()Returns the database ID of the first Person to post to this thread.- Specified by:
getAuthorIDin interfaceAuthoredBean- Returns:
- the database ID
- See Also:
-
getLastUpdateID
public int getLastUpdateID()Returns the database ID of the last Person to post to this thread.- Returns:
- the database ID
- See Also:
-
getNextPostID
Returns the post ID of the first post created after a particular date/time.- Parameters:
dt- the date/time to check- Returns:
- the post ID, or MAX_INTEGER if none
-
getLastUpdatedOn
Returns the date of the latest post in this thread.- Returns:
- the date/time of the latest post
- See Also:
-
getReportCount
public int getReportCount()Returns the number of times this post has been reported for content.- Returns:
- the number of reports, or -1 if no further reports can be made
- See Also:
-
getStickyUntil
Returns the date/time this thread will be "stuck" at the top of the thread list until.- Returns:
- the date/time the post will be a sticky until
- See Also:
-
getStickyInChannelOnly
public boolean getStickyInChannelOnly()Returns if this thread should be considered a "sticky" thread in its Channel only.- Returns:
- TRUE if the thread is "sticky" and is sticky in the Channel, otherwise FALSE
-
getViews
public int getViews()Returns the number of times this thread has been read.- Returns:
- the number of views
- See Also:
-
getPostCount
public int getPostCount()Returns the number of messages in this thread.- Returns:
- the number of posts
- See Also:
-
getImage
public int getImage()Returns the linked image ID for this thread.- Returns:
- the linked Image ID
- See Also:
-
getSubject
-
getHidden
public boolean getHidden()Returns if this thread is hidden to general users.- Returns:
- TRUE if the thread is hidden, otherwise FALSE
- See Also:
-
getLocked
public boolean getLocked()Returns if this thread is locked (no new posts allowed).- Returns:
- TRUE if the thread is locked, otherwise FALSE
- See Also:
-
getPoll
public boolean getPoll()Returns if this thread has a poll.- Returns:
- TRUE if there is a poll, otherwise FALSE
- See Also:
-
getHasDisabledLinks
public boolean getHasDisabledLinks()Returns whether this thread has any disabled Image Links.- Returns:
- TRUE if any links are disabled, otherwise FALSE
-
getOptions
Returns all poll options for this Message Thread.- Returns:
- a Collection of PollOption beans
- See Also:
-
getVotes
Returns all poll votes for this Message Thread.- Returns:
- a Collection of PollVote beans
- See Also:
-
getImageURLs
Returns all linked Image URLs for this Message Thread.- Returns:
- a Collection of LinkedImages
- See Also:
-
getReportIDs
Returns the database IDs of all users reporting this thread for content.- Returns:
- a Collection of database IDs
- See Also:
-
hasVoted
public boolean hasVoted(int pilotID) Returns whether a Pilot has voted in a particular Water Cooler poll.- Parameters:
pilotID- the Pilot's database ID- Returns:
- TRUE if the Pilot has voted, otherwise FALSE
-
setChannel
Updates this thread's Channel.- Parameters:
channelName- the name of the channel- Throws:
NullPointerException- if channelName is null- See Also:
-
setAuthorID
public void setAuthorID(int id) Updates the database ID of the first Person to post to this thread.- Specified by:
setAuthorIDin interfaceAuthoredBean- Parameters:
id- the database ID- Throws:
IllegalArgumentException- if the ID is invalid- See Also:
-
setLastUpdateID
public void setLastUpdateID(int id) Updates the database ID of the last Person to post to this thread.- Parameters:
id- the database ID- Throws:
IllegalArgumentException- if the ID is invalid- See Also:
-
setLastUpdatedOn
Updates the date this thread's latest message was posted.- Parameters:
dt- the date/time the last message was posted
-
setStickyUntil
Updates the date/time this thread will be a "sticky" until.- Parameters:
dt- the date/time- See Also:
-
setStickyInChannelOnly
public void setStickyInChannelOnly(boolean isSticky) Updates whether the thread will be sticky in the current channel only.- Parameters:
isSticky- TRUE if the thread is stick in the current channel, otherwise FALSE- See Also:
-
setReportCount
public void setReportCount(int count) Updates the thread's content report count.- Parameters:
count- the number of times it has been reported, or -1 if no reports allowed- See Also:
-
setHidden
public void setHidden(boolean hidden) Sets this thread's hidden flag.- Parameters:
hidden- TRUE if the thread is hidden, otherwise FALSE- See Also:
-
setLocked
public void setLocked(boolean locked) Sets this thread's locked flag.- Parameters:
locked- TRUE if the thread is locked, otherwise FALSE- See Also:
-
setPoll
public void setPoll(boolean poll) Sets this thread's poll flag.- Parameters:
poll- TRUE if the thread has a poll, otherwise FALSE- See Also:
-
setImage
public void setImage(int id) Updates the linked image for this thread.- Parameters:
id- the linked image database ID- See Also:
-
setViews
public void setViews(int views) Updates the number of times this thread has been read.- Parameters:
views- the number of views- Throws:
IllegalArgumentException- if views is negative- See Also:
-
view
public void view()Increments the view counter. -
setPostCount
public void setPostCount(int posts) Updates the number of messages in this thread.- Parameters:
posts- the number of messages- Throws:
IllegalArgumentException- if posts is negativeIllegalStateException- if a message has been added via addPost()- See Also:
-
addPost
Adds a message to this thread.- Parameters:
msg- the message to add- Throws:
NullPointerException- if msg is null- See Also:
-
addUpdate
Adds a thread update entry to this thread.- Parameters:
upd- the update entry bean- See Also:
-
addReportID
public void addReportID(int id) Adds a database ID to the list of users reporting a thread for content.- Parameters:
id- the database ID- See Also:
-
addOptions
Adds poll options to this thread.- Parameters:
opts- a Colllection of PollOption beans- See Also:
-
addImageURL
-
addImageURL
Adds a URL to the list of linked Image URLs for this Message Thread.- Parameters:
img- the LinkedImage bean- See Also:
-
addOption
Adds a single poll option to this thread.- Parameters:
opt- the PollOption bean- See Also:
-
addVotes
Adds poll votes to this thread.- Parameters:
votes- a Collection of PollVote beans- See Also:
-
getPosts
-
getUpdates
Returns this thread's update history- Returns:
- a Collection of ThreadUpdate beans
- See Also:
-
getLastPost
Returns the last post in a message thread.- Returns:
- the last post, or null if no messages have been added.
- See Also:
-
compareTo
Compares to another thread via the last updated on date.- Specified by:
compareToin interfaceComparable<Object>- Overrides:
compareToin classDatabaseBean
-
getRowClassName
Selects a table row class based upon whether the thread is hidden or not.- Specified by:
getRowClassNamein interfaceViewEntry- Returns:
- the row CSS class name
-