Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.proxy
Class PrivateMessageManagerProxy

java.lang.Object
  extended by com.jivesoftware.forum.proxy.PrivateMessageManagerProxy
All Implemented Interfaces:
PrivateMessageManager

public class PrivateMessageManagerProxy
extends java.lang.Object
implements PrivateMessageManager

Proxy class for PrivateMessageManager objects.


Constructor Summary
PrivateMessageManagerProxy(PrivateMessageManager manager, AuthToken authToken, Permissions permissions)
          Creates a new PrivateMessageManagerProxy to protect the supplied message with the specified permissions.
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrivateMessageManagerProxy

public PrivateMessageManagerProxy(PrivateMessageManager manager,
                                  AuthToken authToken,
                                  Permissions permissions)
Creates a new PrivateMessageManagerProxy to protect the supplied message with the specified permissions.

Method Detail

isPrivateMessagesEnabled

public boolean isPrivateMessagesEnabled()
Description copied from interface: PrivateMessageManager
Returns true if the feature is enabled, false otherwise.

Specified by:
isPrivateMessagesEnabled in interface PrivateMessageManager
Returns:
true if the feature is enabled, false otherwise.

setPrivateMessagesEnabled

public void setPrivateMessagesEnabled(boolean enabled)
                               throws UnauthorizedException
Description copied from interface: PrivateMessageManager
Enables or disables the private message feature. You must have admin privileges to call this method.

Specified by:
setPrivateMessagesEnabled in interface PrivateMessageManager
Parameters:
enabled - true to enable PM's, false otherwise.
Throws:
UnauthorizedException

getRenderManager

public RenderManager getRenderManager()
Description copied from interface: PrivateMessageManager
Returns a render manager for private messages in the system.

Specified by:
getRenderManager in interface PrivateMessageManager
Returns:
the private message render manager.

getMaxMessagesPerUser

public int getMaxMessagesPerUser()
Description copied from interface: PrivateMessageManager
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.

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

setMaxMessagesPerUser

public void setMaxMessagesPerUser(int maxMessages)
                           throws UnauthorizedException
Description copied from interface: PrivateMessageManager
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.

Specified by:
setMaxMessagesPerUser in interface PrivateMessageManager
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

public int getMessageCount(User user)
                    throws UnauthorizedException
Description copied from interface: PrivateMessageManager
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.

Specified by:
getMessageCount in interface PrivateMessageManager
Parameters:
user - the user.
Returns:
the total number of private messages the user has.
Throws:
UnauthorizedException - if not an administrator or the user.

getUnreadMessageCount

public int getUnreadMessageCount(User user)
                          throws UnauthorizedException
Description copied from interface: PrivateMessageManager
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.

Specified by:
getUnreadMessageCount in interface PrivateMessageManager
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

public int getFolderCount(User user)
                   throws UnauthorizedException
Description copied from interface: PrivateMessageManager
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.

Specified by:
getFolderCount in interface PrivateMessageManager
Parameters:
user - the user.
Returns:
the total number of folders the user has.
Throws:
UnauthorizedException - if not an administrator or the user.

getFolders

public java.util.Iterator getFolders(User user)
                              throws UnauthorizedException
Description copied from interface: PrivateMessageManager
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.

Specified by:
getFolders in interface PrivateMessageManager
Parameters:
user - the user.
Returns:
the an Iterator for the user's folders.
Throws:
UnauthorizedException - if not an administrator or the user.

getFolder

public PrivateMessageFolder getFolder(User user,
                                      int folderID)
                               throws PrivateMessageFolderNotFoundException,
                                      UnauthorizedException
Description copied from interface: PrivateMessageManager
Returns the specified folder for a user.

Specified by:
getFolder in interface PrivateMessageManager
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

public PrivateMessageFolder createFolder(User user,
                                         java.lang.String name)
                                  throws UnauthorizedException
Description copied from interface: PrivateMessageManager
Creates a new folder.

Specified by:
createFolder in interface PrivateMessageManager
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

public void deleteFolder(PrivateMessageFolder folder)
                  throws UnauthorizedException
Description copied from interface: PrivateMessageManager
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.

Specified by:
deleteFolder in interface PrivateMessageManager
Parameters:
folder - the folder to delete.
Throws:
UnauthorizedException - if not an administrator or the user.

getMessage

public PrivateMessage getMessage(long privateMessageID)
                          throws UnauthorizedException,
                                 PrivateMessageNotFoundException
Description copied from interface: PrivateMessageManager
Returns the specified private message.

Specified by:
getMessage in interface PrivateMessageManager
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

public PrivateMessage createMessage(User sender)
                             throws UnauthorizedException
Description copied from interface: PrivateMessageManager
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.

Specified by:
createMessage in interface PrivateMessageManager
Parameters:
sender - the user sending the message.
Returns:
a new message.
Throws:
UnauthorizedException - if not an administrator or the user.

saveMessageAsDraft

public void saveMessageAsDraft(PrivateMessage privateMessage)
                        throws UnauthorizedException,
                               PrivateMessageRejectedException
Description copied from interface: PrivateMessageManager
Saves a message as a draft by storing it in the sender's Drafts folder.

Specified by:
saveMessageAsDraft in interface PrivateMessageManager
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

public PrivateMessage sendMessage(PrivateMessage privateMessage,
                                  User recipient,
                                  boolean copyToSentFolder)
                           throws UnauthorizedException,
                                  PrivateMessageRejectedException
Description copied from interface: PrivateMessageManager
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.

Specified by:
sendMessage in interface PrivateMessageManager
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.