Jive API (5.0.0.0) Core Javadocs

com.jivesoftware.community
Interface PrivateMessageManager

All Superinterfaces:
JiveManager

public interface PrivateMessageManager
extends JiveManager

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 community. 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).

See Also:
PrivateMessage, PrivateMessageFolder

Method Summary
 PrivateMessageFolder createFolder(User user, String name)
          Creates a new folder.
 PrivateMessage createMessage(User sender)
          Creates a new private message.
 void deleteFolder(PrivateMessageFolder folder)
          Deletes a folder.
 void deleteUserMessages(User user)
          Deletes a user's folders, including the four default folders.
 PrivateMessageFolder getFolder(User user, long folderID)
          Returns the specified folder for a user.
 int getFolderCount(User user)
          Returns the total number of folders the user has.
 JiveIterator<PrivateMessageFolder> getFolders(User user)
          Returns an Iterable 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 isPrivateMessageNotificationEnabled()
          Returns true if the notification feature is enabled, false otherwise.
 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.
 void sendEmailNotification(User recipient, User sender, PrivateMessage pm)
          Sends a private message notification email to the recipient.
 void 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 setPrivateMessageNotificationEnabled(boolean enabled)
          Enables or disables the private message notification feature.
 void setPrivateMessagesEnabled(boolean enabled)
          Enables or disables the private message feature.
 
Methods inherited from interface com.jivesoftware.community.JiveManager
destroy
 

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 - if not an administrator

isPrivateMessageNotificationEnabled

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

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

setPrivateMessageNotificationEnabled

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

Parameters:
enabled - true to enable PM notifications, false otherwise.
Throws:
UnauthorizedException - if not an administrator

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

JiveIterator<PrivateMessageFolder> getFolders(User user)
                                              throws UnauthorizedException
Returns an Iterable 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 Iterable for the user's folders.
Throws:
UnauthorizedException - if not an administrator or the user.

getFolder

PrivateMessageFolder getFolder(User user,
                               long 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,
                                  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.

deleteUserMessages

void deleteUserMessages(User user)
                        throws UnauthorizedException
Deletes a user's folders, including the four default folders. The messages will be moved to the Trash, then permanently deleted.

Parameters:
user - the sender or recipient of the messages being deleted.
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.
Returns:
the specified 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

void sendMessage(PrivateMessage privateMessage,
                 User recipient,
                 boolean copyToSentFolder)
                 throws UnauthorizedException,
                        PrivateMessageRejectedException,
                        RejectedException
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.
RejectedException

sendEmailNotification

void sendEmailNotification(User recipient,
                           User sender,
                           PrivateMessage pm)
Sends a private message notification email to the recipient.

Parameters:
recipient - - The user who will recieve the messate
sender - - The user sending the message
pm - - The private messatge

Jive Product Page

Copyright © 1999-2007 Jive Software.