|
Jive Forums API (5.5.20.2-oracle) Developer Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ForumThread
A ForumThread is a container for a hierarchy of ForumMessages.
Every thread has a root message, which all other messages in the thread are children of. The root message must be supplied when creating a thread.
To get a ForumThread, the Forum.getThread(long)
method is called
from a Forum object. To create a thread, use the
Forum.createThread(ForumMessage)
method. After creating
a thread, you must add it to the forum by calling Forum.addThread(ForumThread)
.
To delete a ForumThread, call the Forum.deleteThread(ForumThread)
method.
There are two options for navigating through the messages in a thread.
TreeWalker
-- provides a hierarchical view of the messages in
in the thread.
// Assume that a forum object and user object are already defined. ForumMessage rootMessage = forum.createMessage(user); rootMessage.setSubject("A subject"); rootMessage.setBody("A body"); ForumThread thread = forum.createThread(rootMessage); forum.addThread(thread);
Field Summary |
---|
Fields inherited from interface com.jivesoftware.forum.JiveContentObject |
---|
PLAIN_STRATEGY |
Method Summary | |
---|---|
void |
addMessage(ForumMessage parentMessage,
ForumMessage newMessage)
Adds a new message to this thread. |
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. |
java.util.Date |
getCreationDate()
Returns the date that this thread was created. |
Forum |
getForum()
Returns the forum this thread belongs to. |
long |
getID()
Returns the unique ID of this thread, or -1 if the thread hasn't been added to the database yet. |
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. |
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. |
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. |
ForumMessage |
getRootMessage()
Returns the root message this thread. |
TagDelegator |
getTagDelegator()
Retrieve a tag delegator to manage thread tags. |
TreeWalker |
getTreeWalker()
Returns the TreeWalker for this thread. |
boolean |
isAuthorized(long permissionType)
Returns true if the handle on the object has the permission specified. |
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. |
void |
setProperty(java.lang.String name,
java.lang.String value)
Sets an extended property of this thread. |
Methods inherited from interface com.jivesoftware.forum.JiveContentObject |
---|
getBody, getPlainBody, getPlainSubject, getSubject, getUnfilteredBody, getUnfilteredSubject, getUser |
Methods inherited from interface com.jivesoftware.base.JiveObject |
---|
getObjectType |
Method Detail |
---|
long getID()
getID
in interface JiveObject
java.lang.String getName()
getRootMessage().getSubject()
.
java.util.Date getCreationDate()
getCreationDate
in interface JiveContentObject
void setCreationDate(java.util.Date creationDate) throws UnauthorizedException
creationDate
- the date this thread was created.
UnauthorizedException
- if not an administrator.java.util.Date getModificationDate()
getModificationDate
in interface JiveContentObject
void setModificationDate(java.util.Date modificationDate) throws UnauthorizedException
modificationDate
- the date this thread was modified.
UnauthorizedException
- if not an administrator.int getModerationValue()
Forum.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.
void setModerationValue(int value, AuthToken authToken) throws UnauthorizedException
JiveConstants.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.
value
- the number of moderation points for this thread.authToken
- the AuthToken token of the user that is making the
moderation decision.
UnauthorizedException
- if not a moderator or administrator.java.lang.String getProperty(java.lang.String name)
name
- the name of the property to get.
java.util.Collection getProperties(java.lang.String parentName)
parentName
- the name of the parent property to return the children for.
void setProperty(java.lang.String name, java.lang.String value) throws UnauthorizedException
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.
name
- the name of the property to set.value
- the new value for the property.
UnauthorizedException
- if not allowed to set extended properties.void deleteProperty(java.lang.String name) throws UnauthorizedException
name
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.
name
- the name of the property to delete.
UnauthorizedException
- if not allowed to delete extended properties.java.util.Iterator getPropertyNames()
Forum getForum()
ForumMessage getMessage(long messageID) throws ForumMessageNotFoundException
messageID
- the ID of the message to get from this thread.
ForumMessageNotFoundException
ForumMessage getRootMessage()
ForumMessage getLatestMessage()
ResultFilter
, but this
method offers a simpler, more optimized way to access the data.
int getMessageCount()
int getMessageCount(ResultFilter resultFilter)
resultFilter
- a filter to limit the message count query, such as
date or moderation value range.
void addMessage(ForumMessage parentMessage, ForumMessage newMessage) throws MessageRejectedException, UnauthorizedException
When 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.
parentMessage
- 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.MessageInterceptor
void deleteMessage(ForumMessage message) throws UnauthorizedException
message
- the message to delete.
java.lang.IllegalArgumentException
- if the message does not belong to the
thread.
UnauthorizedException
- if does not have permission to delete messages.void deleteMessage(ForumMessage message, boolean deleteChildren) throws UnauthorizedException
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 |-- EIf 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 |-- ENote: because the root message has no parent messages, an IllegalArgumentException will thrown if message is the root message and deleteChildren is true.
message
- 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.
java.lang.IllegalArgumentException
- if the message does not belong to the
thread or if the message is the root message.
UnauthorizedException
- if does not have permission to delete messages.TreeWalker getTreeWalker()
java.util.Iterator getMessages()
java.util.Iterator getMessages(ResultFilter resultFilter)
resultFilter
- a ResultFilter object to perform filtering and
sorting with.
boolean isAuthorized(long permissionType)
A 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.
permissionType
- a permission type.
ForumPermissions
TagDelegator getTagDelegator()
|
Jive Forums Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |