|
Jive Forums API (5.5.8) Developer Javadocs | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jivesoftware.forum.database.DbForumThread
public class DbForumThread
Database implementation of the ForumThread interface. It stores thread data in the jiveThread table, and thread properties in jiveThreadProp.
ForumThread,
Serialized Form| Field Summary | |
|---|---|
protected long |
forumID
|
protected int |
moderationValue
|
protected long |
rootMessageID
|
| Fields inherited from interface com.jivesoftware.forum.JiveContentObject |
|---|
PLAIN_STRATEGY |
| Constructor Summary | |
|---|---|
|
DbForumThread()
Constructor for internal use only. |
protected |
DbForumThread(Forum forum,
ForumMessage rootMessage)
Creates a new DbForumThread. |
protected |
DbForumThread(long id)
Loads a DbForumThread from the database based on its id. |
| Method Summary | |
|---|---|
void |
addMessage(ForumMessage parentMessage,
ForumMessage newMessage)
Adds a new message to this thread. |
protected void |
clearCache()
Clears caches related to the object. |
protected void |
deleteMessage(DbForumMessage message,
java.sql.Connection con,
boolean recursiveDelete)
Delete message method that accepts a Connection as argument -- useful for transactions. |
void |
deleteMessage(ForumMessage message)
Deletes a message in this thread. |
void |
deleteMessage(ForumMessage message,
boolean deleteChildren)
Deletes a message in this thread, optionally recusively deleting child messages. |
void |
deleteProperty(java.lang.String name)
Deletes an extended property. |
boolean |
equals(java.lang.Object object)
|
java.lang.String |
getBody()
Return a summary of the jive object content. |
int |
getCachedSize()
Returns the approximate size of the Object in bytes. |
java.util.Date |
getCreationDate()
Returns the date that this thread was created. |
Forum |
getForum()
Returns the forum this thread belongs to. |
long |
getID()
Retrieve the unique identifier for the jive object. |
ForumMessage |
getLatestMessage()
Returns the most recently created messages in this thread. |
ForumMessage |
getMessage(long messageID)
Returns a message from this thread based on its id. |
int |
getMessageCount()
Returns the number of messages in the thread. |
int |
getMessageCount(ResultFilter resultFilter)
Returns the number of messages in this thread based on the specified result filter. |
protected CachedPreparedStatement |
getMessageListSQL(ResultFilter resultFilter,
boolean countQuery)
Returns the SQL statement corresponding to a ResultFilter for messages. |
java.util.Iterator |
getMessages()
Return an Iterator for all the messages in this thread. |
java.util.Iterator |
getMessages(ResultFilter resultFilter)
Returns a Iterator for all the messages in the thread that match the criteria specified by the ResultFilter. |
int |
getModerationValue()
Returns the number of moderation points this thread has. |
java.util.Date |
getModificationDate()
Returns the date that this thread was last modified. |
java.lang.String |
getName()
Returns the subject of the root message of this thread. |
int |
getObjectType()
Return the object type of the jive object. |
java.lang.String |
getPlainBody()
Returns the body of the jive object content with no markup applied. |
java.lang.String |
getPlainSubject()
Returns the title of the jive object content with no markup applied |
java.util.Collection |
getProperties(java.lang.String parentName)
Return all immediate children property values of a parent property as an unmodifiable Collection of String values. |
java.lang.String |
getProperty(java.lang.String name)
Returns an extended property of this thread. |
java.util.Iterator |
getPropertyNames()
Returns an Iterator for the names of this thread's properties. |
protected int |
getRewardPoints()
Returns the number of reward points for the thread. |
ForumMessage |
getRootMessage()
Returns the root message this thread. |
java.lang.String |
getSubject()
Return the title of the jive object content |
TagDelegator |
getTagDelegator()
Retrieve a tag delegator to manage thread tags. |
TreeWalker |
getTreeWalker()
Returns the TreeWalker for this thread. |
java.lang.String |
getUnfilteredBody()
Returns the body, bypassing any active filters. |
java.lang.String |
getUnfilteredSubject()
Returns the subject, bypassing any active filters. |
User |
getUser()
Returns the user who authored of the jive object. |
int |
hashCode()
|
protected void |
insertIntoDb(DbForum forum,
java.sql.Connection con)
Inserts a new thread into the database. |
boolean |
isAuthorized(long type)
Returns true if the handle on the object has the permission specified. |
protected void |
prepareInsertIntoDb(DbForum forum)
Prepares the message to be inserted into the database. |
void |
readExternal(java.io.DataInput in)
|
void |
setCreationDate(java.util.Date creationDate)
Sets the creation date of this thread. |
void |
setModerationValue(int value,
AuthToken authToken)
Sets the number of moderation points this thread has. |
void |
setModificationDate(java.util.Date modificationDate)
Sets the date this thread was last modified. |
protected void |
setModValue(int value,
AuthToken authToken)
|
void |
setProperty(java.lang.String name,
java.lang.String value)
Sets an extended property of this thread. |
protected void |
setRewardPoints(int rewardPoints,
java.sql.Connection con)
Sets the number of reward points for the thread. |
java.lang.String |
toString()
Converts the object to a String by returning the name of the thread. |
protected void |
updateModifiedDate(long date,
java.sql.Connection con)
Updates the modified date. |
void |
writeExternal(java.io.DataOutput out)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected long rootMessageID
protected long forumID
protected int moderationValue
| Constructor Detail |
|---|
protected DbForumThread(Forum forum,
ForumMessage rootMessage)
rootMessage - the root message of the thread.
protected DbForumThread(long id)
throws ForumThreadNotFoundException
id - in unique id of the ForumThread to load.
ForumThreadNotFoundExceptionpublic DbForumThread()
| Method Detail |
|---|
public java.lang.String getSubject()
JiveContentObject
getSubject in interface JiveContentObjectpublic java.lang.String getPlainSubject()
JiveContentObject
getPlainSubject in interface JiveContentObjectpublic java.lang.String getBody()
JiveContentObject
getBody in interface JiveContentObjectpublic java.lang.String getPlainBody()
JiveContentObject
getPlainBody in interface JiveContentObjectpublic User getUser()
JiveContentObject
getUser in interface JiveContentObjectpublic java.lang.String getUnfilteredSubject()
JiveContentObjectUnfiltered content is necessary for a few reasons. One is when saving Jive content to another persistence mechanism such as an XML format.
getUnfilteredSubject in interface JiveContentObjectpublic java.lang.String getUnfilteredBody()
JiveContentObjectUnfiltered content is necessary for a few reasons. One is when saving Jive content to another persistence mechanism such as an XML format.
getUnfilteredBody in interface JiveContentObjectpublic long getID()
JiveObject
getID in interface JiveObjectgetID in interface ForumThreadpublic java.lang.String getName()
ForumThreadgetRootMessage().getSubject().
getName in interface ForumThreadpublic java.util.Date getCreationDate()
ForumThread
getCreationDate in interface ForumThreadgetCreationDate in interface JiveContentObjectpublic void setCreationDate(java.util.Date creationDate)
ForumThread
setCreationDate in interface ForumThreadcreationDate - the date this thread was created.public java.util.Date getModificationDate()
ForumThread
getModificationDate in interface ForumThreadgetModificationDate in interface JiveContentObjectpublic void setModificationDate(java.util.Date modificationDate)
ForumThread
setModificationDate in interface ForumThreadmodificationDate - the date this thread was modified.public int getModerationValue()
ForumThreadForum.getModerationDefaultThreadValue()
If the moderation value is less than JiveConstants.FORUM_MODERATION_VISIBLE
then the thread will not be displayed by default. Because a thread and
its root message are intrinsically bound together, their moderation values
are linked and are always the same. This means that setting the moderation
value on the thread or setting the moderation value of a root message will
always affect both objects.
getModerationValue in interface ForumThread
public void setModerationValue(int value,
AuthToken authToken)
ForumThreadJiveConstants.FORUM_MODERATION_VISIBLE
then the thread will not be displayed by default. Because a thread and its
root message must always go together, their moderation values are linked
and are always the same. This means that setting the moderation value on
the thread or setting the moderation value of a root message will always
affect both objects.The authToken token of the user must be passed into this method as a paramater for auditing purposes.
setModerationValue in interface ForumThreadvalue - the number of moderation points for this thread.authToken - the AuthToken token of the user that is making the
moderation decision.public java.lang.String getProperty(java.lang.String name)
ForumThread
getProperty in interface ForumThreadname - the name of the property to get.
public java.util.Collection getProperties(java.lang.String parentName)
ForumThread
getProperties in interface ForumThreadparentName - the name of the parent property to return the children for.
public void setProperty(java.lang.String name,
java.lang.String value)
ForumThreadThe user that created the thread (author of rootMessage), or system or forum admins can always call this method. Additionally, anyone (including anonymous users) can call this method before the thread has been added to a Forum.
setProperty in interface ForumThreadname - the name of the property to set.value - the new value for the property.public void deleteProperty(java.lang.String name)
ForumThreadname does not exist, this method will do nothing.The user that created the thread (author of rootMessage), or system or forum admins can always call this method. Additionally, anyone (including anonymous users) can call this method before the thread has been added to a Forum.
deleteProperty in interface ForumThreadname - the name of the property to delete.public java.util.Iterator getPropertyNames()
ForumThread
getPropertyNames in interface ForumThreadpublic Forum getForum()
ForumThread
getForum in interface ForumThread
public ForumMessage getMessage(long messageID)
throws ForumMessageNotFoundException
ForumThread
getMessage in interface ForumThreadmessageID - the ID of the message to get from this thread.
ForumMessageNotFoundExceptionpublic ForumMessage getLatestMessage()
ForumThreadResultFilter, but this
method offers a simpler, more optimized way to access the data.
getLatestMessage in interface ForumThreadpublic ForumMessage getRootMessage()
ForumThread
getRootMessage in interface ForumThreadpublic int getMessageCount()
ForumThread
getMessageCount in interface ForumThreadpublic int getMessageCount(ResultFilter resultFilter)
ForumThread
getMessageCount in interface ForumThreadresultFilter - a filter to limit the message count query, such as
date or moderation value range.
public void addMessage(ForumMessage parentMessage,
ForumMessage newMessage)
throws MessageRejectedException,
UnauthorizedException
ForumThreadWhen a message is being added, it is first run through all message interceptors that are installed. Each interceptor has the option to reject the message by throwing a MessageRejectedException. For example, an interceptor might reject all messages coming from a certain IP.
addMessage in interface ForumThreadparentMessage - some message in this thread that will be parent.newMessage - message to add to this thread under the parent.
MessageRejectedException - if one of the installed interceptors prevents the
message from being posted.
UnauthorizedException - if does not have CREATE_MESSAGE permissions.MessageInterceptorpublic void deleteMessage(ForumMessage message)
ForumThread
deleteMessage in interface ForumThreadmessage - the message to delete.
public void deleteMessage(ForumMessage message,
boolean deleteChildren)
ForumThreadForumThread.deleteMessage(ForumMessage) method since it will recursively delete all
child messages of the message. If deleteChildren is false,
then child messages will not be deleted. Instead, they will be made children of
the message's parent message. As an example, consider the following thread:
A
|-- B
|-- C
|-- D
|-- E
If message B is deleted with deleteChildren set to true,
then messages C, D, and E will also be deleted. If deleteChildren
is set to false, then the new message structure will be:
A
|-- C
|-- D
|-- E
Note: because the root message has no parent messages, an IllegalArgumentException
will thrown if message is the root message and deleteChildren is
true.
deleteMessage in interface ForumThreadmessage - the message to delete.deleteChildren - true if child messages should be deleted, false if child
messages should be moved to be children of the message's parent.public TreeWalker getTreeWalker()
ForumThread
getTreeWalker in interface ForumThreadpublic java.util.Iterator getMessages()
ForumThread
getMessages in interface ForumThreadpublic java.util.Iterator getMessages(ResultFilter resultFilter)
ForumThread
getMessages in interface ForumThreadresultFilter - a ResultFilter object to perform filtering and
sorting with.
public boolean isAuthorized(long type)
ForumThreadA list of possible permissions can be found in the ForumPermissions class. Certain methods of this class are restricted to certain permissions as specified in the method comments.
isAuthorized in interface ForumThreadtype - a permission type.
ForumPermissionspublic TagDelegator getTagDelegator()
ForumThread
getTagDelegator in interface ForumThreadpublic int getObjectType()
JiveObject
getObjectType in interface JiveObjectpublic int getCachedSize()
Cacheable
getCachedSize in interface Cacheable
public void readExternal(java.io.DataInput in)
throws java.io.IOException
readExternal in interface com.tangosol.io.ExternalizableLitejava.io.IOException
public void writeExternal(java.io.DataOutput out)
throws java.io.IOException
writeExternal in interface com.tangosol.io.ExternalizableLitejava.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object object)
equals in class java.lang.Object
protected void updateModifiedDate(long date,
java.sql.Connection con)
throws java.sql.SQLException
java.sql.SQLException
protected void setModValue(int value,
AuthToken authToken)
protected void deleteMessage(DbForumMessage message,
java.sql.Connection con,
boolean recursiveDelete)
throws java.sql.SQLException,
ForumMessageNotFoundException
java.sql.SQLException
ForumMessageNotFoundExceptionprotected int getRewardPoints()
protected void setRewardPoints(int rewardPoints,
java.sql.Connection con)
throws java.sql.SQLException
java.sql.SQLException
protected CachedPreparedStatement getMessageListSQL(ResultFilter resultFilter,
boolean countQuery)
protected void clearCache()
protected void prepareInsertIntoDb(DbForum forum)
throws java.sql.SQLException,
UnauthorizedException
insertIntoDb(com.jivesoftware.forum.database.DbForum, java.sql.Connection) method would require more than one open database connection otherwise,
which can lead to deadlocks.
forum - the forum the thread is being inserted into.
java.sql.SQLException - if an error occurs.
UnauthorizedException - if not allowed to call this method.
protected void insertIntoDb(DbForum forum,
java.sql.Connection con)
throws java.sql.SQLException,
UnauthorizedException
con - an open Connection used to insert the thread to the db.
java.sql.SQLException
UnauthorizedException
|
Jive Forums Project Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||