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 TypeMethodDescriptionvoid
addImageURL
(String url, String desc) Adds a URL to the list of linked Image URLs for this Message Thread.void
addImageURL
(LinkedImage img) Adds a URL to the list of linked Image URLs for this Message Thread.void
addOption
(PollOption opt) Adds a single poll option to this thread.void
addOptions
(Collection<PollOption> opts) Adds poll options to this thread.void
Adds a message to this thread.void
addReportID
(int id) Adds a database ID to the list of users reporting a thread for content.void
addUpdate
(ThreadUpdate upd) Adds a thread update entry to this thread.void
addVotes
(Collection<PollVote> votes) Adds poll votes to this thread.int
Compares to another thread via the last updated on date.int
Returns the database ID of the first Person to post to this thread.Returns the channel name for this thread.boolean
Returns whether this thread has any disabled Image Links.boolean
Returns if this thread is hidden to general users.int
getImage()
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.int
Returns the database ID of the last Person to post to this thread.boolean
Returns if this thread is locked (no new posts allowed).int
getNextPostID
(Instant dt) Returns the post ID of the first post created after a particular date/time.Returns all poll options for this Message Thread.boolean
getPoll()
Returns if this thread has a poll.int
Returns the number of messages in this thread.getPosts()
Returns this thread's messages.int
Returns 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.boolean
Returns 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 historyint
getViews()
Returns the number of times this thread has been read.getVotes()
Returns all poll votes for this Message Thread.boolean
hasVoted
(int pilotID) Returns whether a Pilot has voted in a particular Water Cooler poll.void
setAuthorID
(int id) Updates the database ID of the first Person to post to this thread.void
setChannel
(String channelName) Updates this thread's Channel.void
setHidden
(boolean hidden) Sets this thread's hidden flag.void
setImage
(int id) Updates the linked image for this thread.void
Updates the date this thread's latest message was posted.void
setLastUpdateID
(int id) Updates the database ID of the last Person to post to this thread.void
setLocked
(boolean locked) Sets this thread's locked flag.void
setPoll
(boolean poll) Sets this thread's poll flag.void
setPostCount
(int posts) Updates the number of messages in this thread.void
setReportCount
(int count) Updates the thread's content report count.void
setStickyInChannelOnly
(boolean isSticky) Updates whether the thread will be sticky in the current channel only.void
Updates the date/time this thread will be a "sticky" until.void
setViews
(int views) Updates the number of times this thread has been read.void
view()
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:
getAuthorID
in 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:
setAuthorID
in 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:
compareTo
in interfaceComparable<Object>
- Overrides:
compareTo
in classDatabaseBean
-
getRowClassName
Selects a table row class based upon whether the thread is hidden or not.- Specified by:
getRowClassName
in interfaceViewEntry
- Returns:
- the row CSS class name
-