Clearspace API (1.7.0) Core Javadocs

com.jivesoftware.community
Interface ForumManager

All Superinterfaces:
JiveManager

public interface ForumManager
extends JiveManager

This manager provides methods to load forum threads, user messages and to retrieve popular forum threads.

See Also:
JiveContext, Community

Method Summary
 void deleteThread(ForumThread thread)
          Deletes a thread and all of its messages.
 ForumThread getForumThread(long threadID)
          Returns the thread with the specified threadID.
 ForumMessage getMessage(long messageID)
          Returns the forum message with the specified messageID.
 long getMessageID(long communityID, int communityIndex)
          Returns the message ID with the specified communityID and communityIndex, or -1 if the communityIndex does not map to a message.
 JiveIterator<ForumThread> getPopularThreads()
          Returns an Iterable for the most threads in the system as ForumThread objects.
 int getUserMessageCount(User user)
          Returns the total number of messages a user has posted in all communities.
 int getUserMessageCount(User user, ThreadResultFilter resultFilter)
          Returns the total number of messages a user has posted in all communities that obey the parameters set by the specificed ResultFilter.
 JiveIterator<ForumMessage> getUserMessages(User user)
          Returns an iterable for all messages posted by a user.
 JiveIterator<ForumMessage> getUserMessages(User user, ThreadResultFilter resultFilter)
          Returns an iterable for all messages posted by a user that obey the parameters set by the specified ResultFilter.
 boolean isModerationEnabled()
          Returns true if moderation has been enabled by setting the Jive property "database.moderationEnabled" to true.
 void moveThread(ForumThread thread, Community newCommunity)
          Moves a thread from one community to another.
 
Methods inherited from interface com.jivesoftware.community.JiveManager
destroy, initialize
 

Method Detail

getForumThread

ForumThread getForumThread(long threadID)
                           throws ForumThreadNotFoundException,
                                  UnauthorizedException
Returns the thread with the specified threadID.

Parameters:
threadID - the id of the thread to return.
Returns:
the ForumThread specified by threadID.
Throws:
UnauthorizedException - if not allowed to read the thread.
ForumThreadNotFoundException - if the requested thread does not exist.

getMessage

ForumMessage getMessage(long messageID)
                        throws ForumMessageNotFoundException,
                               UnauthorizedException
Returns the forum message with the specified messageID.

Parameters:
messageID - the id of the message to return.
Returns:
the ForumMessage specified by messageID.
Throws:
UnauthorizedException - if not allowed to read the message.
ForumMessageNotFoundException - if the requested message does not exist.

getMessageID

long getMessageID(long communityID,
                  int communityIndex)
Returns the message ID with the specified communityID and communityIndex, or -1 if the communityIndex does not map to a message.

Parameters:
communityID - the id of the community to retrieve the messageID for
communityIndex - the community index value of the message.
Returns:
the message ID, or -1 if the specified communityIndex is invalid.

getPopularThreads

JiveIterator<ForumThread> getPopularThreads()
Returns an Iterable for the most threads in the system as ForumThread objects. Popular threads are defined as those that have the most new messages over a period of time (e.g. the last 24 hours). A number of configurable Jive properties control how the popular threads feature works:

Returns:
an Iterable of ForumThread objects for the most popular threads.

moveThread

void moveThread(ForumThread thread,
                Community newCommunity)
                throws UnauthorizedException
Moves a thread from one community to another. For this to work, the user calling this method must have admin or moderator permissions for the community the thread currently belongs to and the newCommunity.

The main purpose of this method is to allow admins to move non-topical threads into a more appropriate community.

Parameters:
thread - the thread to move to another community.
newCommunity - the new community to move the thread to
Throws:
UnauthorizedException - if does not have admin or moderator permissions for the thread's current community and the newCommunity.

deleteThread

void deleteThread(ForumThread thread)
                  throws UnauthorizedException
Deletes a thread and all of its messages. Once a thread is deleted, the thread object should no longer be used. The search index and other resources that referenced the thread and its messages will also be updated appropriately.

Parameters:
thread - the thread to delete.
Throws:
UnauthorizedException - if not an admin or moderator of the thread's community

getUserMessageCount

int getUserMessageCount(User user)
Returns the total number of messages a user has posted in all communities. Warning: communities that the current user doesn't have read access for will also be included in the total, so you should use caution if that information should be private.

In order to get a count of user messages in an individual communities, use the ContentRetrieval.getMessageCount(ThreadResultFilter) method.

Parameters:
user - the user to tally results for.
Returns:
the number of messages the user has posted.

getUserMessageCount

int getUserMessageCount(User user,
                        ThreadResultFilter resultFilter)
Returns the total number of messages a user has posted in all communities that obey the parameters set by the specificed ResultFilter. Warning: communities that the current user doesn't have read access for will also be included in the total, so you should use caution if that information should be private.

In order to get a count of user messages in an individual community, use the ContentRetrieval.getMessageCount(ThreadResultFilter) method.

Parameters:
user - the user to tally results for.
resultFilter - a resultFilter to limit the query on.
Returns:
the number of messages the user has posted.

getUserMessages

JiveIterator<ForumMessage> getUserMessages(User user)
Returns an iterable for all messages posted by a user. Only messages that the caller of this method has permission to read will be returned. Therefore, it's possible that the number of messages returned in this iterable will be less than the number returned by userMessageCount(user).

Parameters:
user - the user to get messages for.
Returns:
an iterable for all messages posted by a user

getUserMessages

JiveIterator<ForumMessage> getUserMessages(User user,
                                           ThreadResultFilter resultFilter)
Returns an iterable for all messages posted by a user that obey the parameters set by the specified ResultFilter. Only messages that the caller of this method has permission to read will be returned. Therefore, it's possible that the number of messages returned in this iterable will be less than the number returned by userMessageCount(user).

Parameters:
user - the user to get messages for.
resultFilter - a resultFilter to limit the query on.
Returns:
an Iterable for all messages posted by a user in the specified range.

isModerationEnabled

boolean isModerationEnabled()
Returns true if moderation has been enabled by setting the Jive property "database.moderationEnabled" to true. When true, moderation is enabled at the database query level. This is useful for sites that don't use message/thread approval moderation and that have extreme amounts of traffic such that the moderation check in database queries causes significant slowdowns. Unless your community have over 500K page views per day, you can probably ignore this setting.

Returns:
true if moderation should be enabled at the database query level.

Clearspace Project Page

Copyright © 1999-2007 Jive Software.