Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum
Interface PrivateMessageManager

All Known Implementing Classes:
DbPrivateMessageManager, PrivateMessageManagerProxy

public interface PrivateMessageManager

Manages the private message feature. Private messages facilitate user to user communication as opposed to public messages viewable by a large group of people in a forum. Users must be given permission to be able to send and recieve private messages. A quota can be set to control the maximum number of messages a user can store between all folders (excluding Trash).

Since:
4.0
See Also:
PrivateMessage, PrivateMessageFolder

Method Summary
 PrivateMessageFolder createFolder(User user, java.lang.String name)
          Creates a new folder.
 PrivateMessage createMessage(User sender)
          Creates a new private message.
 void deleteFolder(PrivateMessageFolder folder)
          Deletes a folder.
 PrivateMessageFolder getFolder(User user, int folderID)
          Returns the specified folder for a user.
 int getFolderCount(User user)
          Returns the total number of folders the user has.
 java.util.Iterator getFolders(User user)
          Returns an Iterator of PrivateMessageFolder objects for the folders the user has.
 int getMaxMessagesPerUser()
          Returns the max number of messages each user is allowed to store in their mailbox, or -1 if there is no limit.
 PrivateMessage getMessage(long privateMessageID)
          Returns the specified private message.
 int getMessageCount(User user)
          Returns the total number of private messages a user has in their mailbox.
 RenderManager getRenderManager()
          Returns a render manager for private messages in the system.
 int getUnreadMessageCount(User user)
          Returns the total number of unread private messages a user has in their mailbox.
 boolean isPrivateMessagesEnabled()
          Returns true if the feature is enabled, false otherwise.
 void saveMessageAsDraft(PrivateMessage privateMessage)
          Saves a message as a draft by storing it in the sender's Drafts folder.
 PrivateMessage sendMessage(PrivateMessage privateMessage, User recipient, boolean copyToSentFolder)
          Sends a private message to another user.
 void setMaxMessagesPerUser(int maxMessages)
          Sets the max number of message is allowed to store in their mailbox.
 void setPrivateMessagesEnabled(boolean enabled)
          Enables or disables the private message feature.
 

Method Detail

isPrivateMessagesEnabled

boolean isPrivateMessagesEnabled()
Returns true if the feature is enabled, false otherwise.

Returns:
true if the feature is enabled, false otherwise.

setPrivateMessagesEnabled

void setPrivateMessagesEnabled(boolean enabled)
                               throws UnauthorizedException
Enables or disables the private message feature. You must have admin privileges to call this method.

Parameters:
enabled - true to enable PM's, false otherwise.
Throws:
UnauthorizedException

getRenderManager

RenderManager getRenderManager()
Returns a render manager for private messages in the system.

Returns:
the private message render manager.

getMaxMessagesPerUser

int getMaxMessagesPerUser()
Returns the max number of messages each user is allowed to store in their mailbox, or -1 if there is no limit. All messages in folders other than the Trash count towards the message total. Once the total is reached, other users will not be able to send messages to the user. However, additional system messages can continue to be sent to the user ast the total.

Returns:
the max number of messages a user is allowed to store in their mailbox, or -1 if there is no limit.

setMaxMessagesPerUser

void setMaxMessagesPerUser(int maxMessages)
                           throws UnauthorizedException
Sets the max number of message is allowed to store in their mailbox. All messages in folders other than the Trash count towards the message total. Once the total is reached, other users will not be able to send messages to the user. However, additional system messages can continue to be sent to the user ast the total.

Parameters:
maxMessages - the max number of messages a user is allowed to store in their mailbox, or -1 for no limit.
Throws:
UnauthorizedException - if not a system administrator.

getMessageCount

int getMessageCount(User user)
                    throws UnauthorizedException
Returns the total number of private messages a user has in their mailbox. This calculation does not count any messages in the user's Trash folder.

Parameters:
user - the user.
Returns:
the total number of private messages the user has.
Throws:
UnauthorizedException - if not an administrator or the user.

getUnreadMessageCount

int getUnreadMessageCount(User user)
                          throws UnauthorizedException
Returns the total number of unread private messages a user has in their mailbox. This calculation does not count any messages in the user's Trash folder.

Parameters:
user - the user.
Returns:
the total number of unread private messages the user has.
Throws:
UnauthorizedException - if not an administrator or the user.

getFolderCount

int getFolderCount(User user)
                   throws UnauthorizedException
Returns the total number of folders the user has. Every user always has at least the four built-in folders, plus any additional custom folders.

Parameters:
user - the user.
Returns:
the total number of folders the user has.
Throws:
UnauthorizedException - if not an administrator or the user.

getFolders

java.util.Iterator getFolders(User user)
                              throws UnauthorizedException
Returns an Iterator of PrivateMessageFolder objects for the folders the user has. The four built-in folders (Inbox, Sent, Drafts, Trash) are returned first, followed by custom folders in alphabetical order.

Parameters:
user - the user.
Returns:
the an Iterator for the user's folders.
Throws:
UnauthorizedException - if not an administrator or the user.

getFolder

PrivateMessageFolder getFolder(User user,
                               int folderID)
                               throws PrivateMessageFolderNotFoundException,
                                      UnauthorizedException
Returns the specified folder for a user.

Parameters:
user - the user.
folderID - the folder ID.
Returns:
the user's folder.
Throws:
PrivateMessageFolderNotFoundException - if the folder could not be loaded.
UnauthorizedException - if not an administrator or the user.

createFolder

PrivateMessageFolder createFolder(User user,
                                  java.lang.String name)
                                  throws UnauthorizedException
Creates a new folder.

Parameters:
user - the user to create the folder for.
name - the name of the folder.
Returns:
the new folder.
Throws:
UnauthorizedException - if not an administrator or the user.

deleteFolder

void deleteFolder(PrivateMessageFolder folder)
                  throws UnauthorizedException
Deletes a folder. All messages in the folder will be moved to the user's Trash folder. Attempting to delete one of the four default folders will move all messages in the folder to Trash but won't delete the folder itself. If the folder is the Trash folder, all messages in the folder will be permanently deleted.

Parameters:
folder - the folder to delete.
Throws:
UnauthorizedException - if not an administrator or the user.

getMessage

PrivateMessage getMessage(long privateMessageID)
                          throws UnauthorizedException,
                                 PrivateMessageNotFoundException
Returns the specified private message.

Parameters:
privateMessageID - the ID of the private message.
Throws:
UnauthorizedException - if not an administrator or the user.
PrivateMessageNotFoundException - if the message could not be loaded.

createMessage

PrivateMessage createMessage(User sender)
                             throws UnauthorizedException
Creates a new private message. The message must be either saved as a draft or sent to another user in order to be stored permanently.

Parameters:
sender - the user sending the message.
Returns:
a new message.
Throws:
UnauthorizedException - if not an administrator or the user.

saveMessageAsDraft

void saveMessageAsDraft(PrivateMessage privateMessage)
                        throws UnauthorizedException,
                               PrivateMessageRejectedException
Saves a message as a draft by storing it in the sender's Drafts folder.

Parameters:
privateMessage - the message to save.
Throws:
UnauthorizedException - if not an administrator or the user.
PrivateMessageRejectedException - if the message could not be saved as a draft.

sendMessage

PrivateMessage sendMessage(PrivateMessage privateMessage,
                           User recipient,
                           boolean copyToSentFolder)
                           throws UnauthorizedException,
                                  PrivateMessageRejectedException
Sends a private message to another user. The message will be delivered to the recipient's Inbox. Optionally, a copy of the message will be put in the sender's Sent folder.

If the recipient's mailbox is full, a PrivateMessageRejectedException will be thrown. The exception will also be thrown if the recipient is not allowed to receive private messages or if the user has elected to save a copy of the message in their Sent folder, but doesn't have room to do so.

Parameters:
privateMessage - the message to send.
recipient - the user to send the message to.
copyToSentFolder - true if the message should be copied to the Sent folder.
Throws:
UnauthorizedException - if not allowed to send the message.
PrivateMessageRejectedException - if the message could not be delivered.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.