|
Clearspace API (2.5.29) Core 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
ForumManager.getForumThread(long) method is called from the ForumManager. To create
a thread, use the ForumManager.createThread(JiveContainer,ForumMessage) method. After creating a thread, you
must add it to the community by calling ForumManager.addThread(JiveContainer,ForumThread). To delete a
ForumThread, call the ForumManager.deleteThread(ForumThread)
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 community object and user object are already defined.
ForumMessage rootMessage = forumManager.createMessage(community, user);
rootMessage.setSubject("A subject");
rootMessage.setBody("A body");
ForumThread thread = forummManager.createThread(community, rootMessage);
forumManager.addThread(community, thread);
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.jivesoftware.community.JiveContentObject |
|---|
JiveContentObject.Field, JiveContentObject.Status |
| 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. |
long |
getBranchedParentThreadID()
Returns the ID of the thread this was branched from, if any, else null. |
long |
getBranchedThreadID()
Returns the ID of a brached thread, or null if no thread is branched from this one. |
long |
getContainerID()
Returns the id of the container object of the thread. |
int |
getContainerType()
Returns the type of the container object of the thread. |
Date |
getCreationDate()
Returns the date that this thread was created. |
long |
getID()
Returns the unique ID of this thread, or -1 if the thread hasn't been added to the database yet. |
JiveContainer |
getJiveContainer()
Returns the container object of the thread. |
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(ThreadResultFilter resultFilter)
Returns the number of messages in this thread based on the specified result filter. |
JiveIterator<ForumMessage> |
getMessages()
Return an Iterable for all the messages in this thread. |
JiveIterator<ForumMessage> |
getMessages(ThreadResultFilter resultFilter)
Returns a Iterable 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. |
Date |
getModificationDate()
Returns the date that this thread was last modified. |
String |
getName()
Returns the subject of the root message of this thread. |
Map<String,String> |
getProperties()
Retrieve a map of all the extended properties for the thread. |
Question |
getQuestion()
Returns the question associated with a thread or null if the question does not exist. |
com.jivesoftware.community.RatingDelegator |
getRatingDelegator()
Retrieve a rating delegator to manage thread ratings. |
ForumMessage |
getRootMessage()
Returns the root message this thread. |
com.jivesoftware.community.TagDelegator |
getTagDelegator()
Retrieve a tag delegator to manage thread tags. |
com.jivesoftware.community.TrackbackDelegator |
getTrackbackDelegator()
Retrieve a trackback delegator to manage thread trackbacks. |
TreeWalker |
getTreeWalker()
Returns the TreeWalker for this thread. |
int |
getViewCount()
Returns the number of times this thread has been viewed. |
boolean |
hasQuestion()
Returns true if this thread has been marked as a question. |
boolean |
isAuthorized(long permissionType)
Returns true if the handle on the object has the permission specified. |
boolean |
isRead(User user)
Returns true if this thread has been read by the user, false otherwise. |
boolean |
isUnread(User user)
Returns true if this thread has not been read by the user, false otherwise. |
boolean |
isUpdated(User user)
Returns true if this thread has been updated since read by the user, false otherwise. |
void |
refreshMessageCount()
Forces a message count refresh from the database. |
void |
setCreationDate(Date creationDate)
Sets the creation date of this thread. |
void |
setModerationValue(int value)
Sets the number of moderation points this thread has. |
void |
setModificationDate(Date modificationDate)
Sets the date this thread was last modified. |
void |
setStatus(JiveContentObject.Status status)
Sets the status of this message |
| Methods inherited from interface com.jivesoftware.community.JiveContentObject |
|---|
getBody, getIndexContent, getPlainBody, getPlainSubject, getStatus, getSubject, getUnfilteredSubject, getUser |
| Methods inherited from interface com.jivesoftware.community.JiveObject |
|---|
getObjectType |
| Method Detail |
|---|
long getID()
getID in interface JiveObjectString getName()
getRootMessage().getSubject().
Date getCreationDate()
getCreationDate in interface JiveContentObject
void setCreationDate(Date creationDate)
throws UnauthorizedException
creationDate - the date this thread was created.
UnauthorizedException - if not an administrator.Date getModificationDate()
getModificationDate in interface JiveContentObject
void setModificationDate(Date modificationDate)
throws UnauthorizedException
modificationDate - the date this thread was modified.
UnauthorizedException - if not an administrator.int getModerationValue()
Community.getModerationDefaultThreadValue()If the moderation value is less than
JiveConstants.MESSAGE_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)
throws UnauthorizedException
JiveConstants.MESSAGE_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.
UnauthorizedException - if not a moderator or administrator.boolean hasQuestion()
Question getQuestion()
Map<String,String> getProperties()
If the user is not authorized to modify the thread any method which modifies the map will fail with a UnsupportedOperationException;
ForumMessage getMessage(long messageID)
throws ForumMessageNotFoundException
messageID - the ID of the message to get from this thread.
ForumMessageNotFoundExceptionForumMessage getRootMessage()
ForumMessage getLatestMessage()
ThreadResultFilter, but this method offers a simpler, more optimized way to access the data.
int getMessageCount()
void refreshMessageCount()
int getMessageCount(ThreadResultFilter resultFilter)
resultFilter - a filter to limit the message count query, such as date or moderation value range.
void addMessage(ForumMessage parentMessage,
ForumMessage newMessage)
throws RejectedException,
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 RejectedException. 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.
RejectedException - if one of the installed interceptors prevents the message from being posted.
UnauthorizedException - if does not have CREATE_MESSAGE permissions.JiveInterceptor
void deleteMessage(ForumMessage message)
throws UnauthorizedException
message - the message to delete.
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
|-- 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.
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.
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()
JiveIterator<ForumMessage> getMessages()
JiveIterator<ForumMessage> getMessages(ThreadResultFilter 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 Permissions class. Certain methods of this class are restricted to certain permissions as specified in the method comments.
permissionType - a permission type.
Permissionsboolean isRead(User user)
user - the user to check read stats for this thread
boolean isUnread(User user)
user - the user to check read stats for this thread
boolean isUpdated(User user)
user - the user to check read stats for this thread
int getViewCount()
long getBranchedParentThreadID()
long getBranchedThreadID()
com.jivesoftware.community.TagDelegator getTagDelegator()
com.jivesoftware.community.TrackbackDelegator getTrackbackDelegator()
com.jivesoftware.community.RatingDelegator getRatingDelegator()
int getContainerType()
getContainerType in interface com.jivesoftware.community.ContainerAwaregetContainerType in interface JiveContentObjectlong getContainerID()
getContainerID in interface com.jivesoftware.community.ContainerAwaregetContainerID in interface JiveContentObjectJiveContainer getJiveContainer()
void setStatus(JiveContentObject.Status status)
throws UnauthorizedException
status - the status of the message.
UnauthorizedException - if the caller does not have ADMIN, MODERATE_MESSAGES or MODERATOR permissions.
|
Clearspace Project Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||