blackboard.data.discussionboard.datamanager
Interface MessageManager


public interface MessageManager

Utility class for managing Discussion Board message objects

Since:
Bb 7.0
Version:
Revision: #1 Date: 2005-4-26

Method Summary
 java.util.List collectMessagesByIds(java.lang.String ids)
          Deprecated. This loader does not load message status objects with the messages. Use collectMessagesWithStatusByStringIds( String[] messageIds, Id currentUserInContext ) instead.
 java.util.List<Message> collectMessagesByThreadId(Id threadId)
          Collect all child messages by the Id of the top-level topic message.
 java.util.List<Message> collectMessagesWithStatusByStringIds(java.lang.String[] messageIds, Id currentUserInContext, boolean loadTags)
          Collect a list of message with message statuses by their string message identifiers.
 java.util.List<Message> collectMessagesWithStatusByThreadId(Id threadId, Id currentUserIdInContext, boolean loadTags)
          Collect all child messages by the Id of the top-level topic message.
 java.util.List<Message> collectMessagesWithStatusByThreadIds(java.util.List<Id> threadIds, Id forumId, Id currentUserId, boolean loadTags)
          Collect all messages in the specified threads (including the thread messages themselves)
 java.util.List<Message> collectUnreadMessagesByUserIdAndForumId(Id userId, Id forumId, boolean loadTags)
          Collect unread messages with message status only, by user id and forum id
 java.util.List<Message> collectUnreadMessagesByUserIdAndThreadId(Id userId, Id threadId, boolean loadTags)
          Collect unread messages with message status only, by user id and thread id
 boolean containsOnlyCalculatedUserNames(java.util.Collection<Message> messages)
          Returns false if any of the Messages in the collection are using stored names that will not sort correctly by last or first names (e.g., if they are stored as Anonymous, or stored directly in the postedName field rather than calculated on the fly).
 java.lang.String getParentBody(Message message)
          Get the body of the immediate message parent.
 java.util.List loadAllByForum(Id forum_id)
          Load all messages from a forum.
 MessageAttachment loadAttachment(Id message_id)
          Load the message attachment object by its message id.
 java.util.List loadByForumIdAndLifecycle(Id forum_id, Message.MessageLifecycle ml)
          Load all messages in a given forum with a given Message.MessageLifecycle.
 Message loadById(Id message_id)
          Load a message by Id.
 Message loadTopThreadById(Id message_id)
          Load a top level topic message by Id.
 java.util.List loadUnreadByForum(Id forum_id, Id user_id)
          Load unread messages from a forum for a given user
 Message loadWithStatus(Id msg_id, Id user_id)
          Load a message, including the status, by its Id.
 void removeAttachment(Id messageAttach_id)
          Remove a message attachment by its own Id (message object remains).
 void removeMessageById(Id id)
          Remove a message with a given id.
 void save(Message message)
          Save a message.
 

Method Detail

loadById

Message loadById(Id message_id)
                 throws PersistenceException,
                        KeyNotFoundException
Load a message by Id.

Parameters:
message_id -
Returns:
a message with the pointed id
Throws:
PersistenceException
KeyNotFoundException

loadTopThreadById

Message loadTopThreadById(Id message_id)
                          throws PersistenceException,
                                 KeyNotFoundException
Load a top level topic message by Id.

Parameters:
message_id -
Returns:
a thread
Throws:
PersistenceException
KeyNotFoundException

loadWithStatus

Message loadWithStatus(Id msg_id,
                       Id user_id)
                       throws PersistenceException,
                              KeyNotFoundException
Load a message, including the status, by its Id. The user_id is needed to determine read status

Parameters:
msg_id -
user_id -
Returns:
Message list with status
Throws:
PersistenceException
KeyNotFoundException

loadByForumIdAndLifecycle

java.util.List loadByForumIdAndLifecycle(Id forum_id,
                                         Message.MessageLifecycle ml)
                                         throws PersistenceException,
                                                KeyNotFoundException
Load all messages in a given forum with a given Message.MessageLifecycle.

Parameters:
forum_id -
ml -
Returns:
a message with the pointed id
Throws:
PersistenceException
KeyNotFoundException

save

void save(Message message)
          throws ValidationException,
                 PersistenceException,
                 KeyNotFoundException
Save a message.

Parameters:
message -
Throws:
ValidationException
PersistenceException
KeyNotFoundException

removeMessageById

void removeMessageById(Id id)
                       throws PersistenceException,
                              KeyNotFoundException
Remove a message with a given id.

Parameters:
id -
Throws:
PersistenceException
KeyNotFoundException

collectMessagesByIds

java.util.List collectMessagesByIds(java.lang.String ids)
                                    throws PersistenceException,
                                           KeyNotFoundException
Deprecated. This loader does not load message status objects with the messages. Use collectMessagesWithStatusByStringIds( String[] messageIds, Id currentUserInContext ) instead.

Collect messages by an arbitrary set of Ids (comma-separated). Objects in the List are lighter weight than if called with loadById

Parameters:
ids -
Returns:
Message list
Throws:
PersistenceException
KeyNotFoundException

collectMessagesWithStatusByStringIds

java.util.List<Message> collectMessagesWithStatusByStringIds(java.lang.String[] messageIds,
                                                             Id currentUserInContext,
                                                             boolean loadTags)
                                                             throws PersistenceException,
                                                                    KeyNotFoundException
Collect a list of message with message statuses by their string message identifiers.

Parameters:
messageIds - string array of message identifiers
currentUserInContext - Id of the current user in context
Returns:
a list of messages
Throws:
PersistenceException
KeyNotFoundException
Since:
7.3

loadAttachment

MessageAttachment loadAttachment(Id message_id)
                                 throws PersistenceException,
                                        KeyNotFoundException
Load the message attachment object by its message id.

Parameters:
message_id -
Returns:
MessageAttachment
Throws:
PersistenceException
KeyNotFoundException

removeAttachment

void removeAttachment(Id messageAttach_id)
                      throws PersistenceException,
                             KeyNotFoundException
Remove a message attachment by its own Id (message object remains).

Parameters:
messageAttach_id -
Throws:
PersistenceException
KeyNotFoundException

getParentBody

java.lang.String getParentBody(Message message)
Get the body of the immediate message parent. Returns null for a top-level topic message

Parameters:
message -

collectMessagesWithStatusByThreadId

java.util.List<Message> collectMessagesWithStatusByThreadId(Id threadId,
                                                            Id currentUserIdInContext,
                                                            boolean loadTags)
                                                            throws PersistenceException,
                                                                   KeyNotFoundException
Collect all child messages by the Id of the top-level topic message. Messages are returned with message status objects, otherwise, objects in the List are lighter weight than if called with loadById

Parameters:
threadId -
currentUserIdInContext -
Returns:
Message list
Throws:
PersistenceException
KeyNotFoundException
Since:
7.3

collectMessagesWithStatusByThreadIds

java.util.List<Message> collectMessagesWithStatusByThreadIds(java.util.List<Id> threadIds,
                                                             Id forumId,
                                                             Id currentUserId,
                                                             boolean loadTags)
                                                             throws PersistenceException,
                                                                    KeyNotFoundException
Collect all messages in the specified threads (including the thread messages themselves)

Parameters:
threadIds -
forumId -
currentUserId -
loadTags -
Returns:
Message List
Throws:
PersistenceException
KeyNotFoundException
Since:
Bb 7.3

collectMessagesByThreadId

java.util.List<Message> collectMessagesByThreadId(Id threadId)
                                                  throws PersistenceException,
                                                         KeyNotFoundException
Collect all child messages by the Id of the top-level topic message. Objects in the List are lighter weight than if called with loadById

Parameters:
threadId -
Returns:
Message list
Throws:
PersistenceException
KeyNotFoundException

loadUnreadByForum

java.util.List loadUnreadByForum(Id forum_id,
                                 Id user_id)
                                 throws PersistenceException,
                                        KeyNotFoundException
Load unread messages from a forum for a given user

Parameters:
forum_id -
user_id -
Returns:
List contains all messages the user has not yet read
Throws:
PersistenceException
KeyNotFoundException

loadAllByForum

java.util.List loadAllByForum(Id forum_id)
                              throws PersistenceException,
                                     KeyNotFoundException
Load all messages from a forum.

Parameters:
forum_id -
Returns:
List contains all messages from a given forum
Throws:
PersistenceException
KeyNotFoundException

collectUnreadMessagesByUserIdAndForumId

java.util.List<Message> collectUnreadMessagesByUserIdAndForumId(Id userId,
                                                                Id forumId,
                                                                boolean loadTags)
                                                                throws PersistenceException,
                                                                       KeyNotFoundException
Collect unread messages with message status only, by user id and forum id

Parameters:
userId -
forumId -
Returns:
a list of messages that have not been marked as read by the given user in the given forum
Throws:
PersistenceException
KeyNotFoundException
Since:
7.3

collectUnreadMessagesByUserIdAndThreadId

java.util.List<Message> collectUnreadMessagesByUserIdAndThreadId(Id userId,
                                                                 Id threadId,
                                                                 boolean loadTags)
                                                                 throws PersistenceException,
                                                                        KeyNotFoundException
Collect unread messages with message status only, by user id and thread id

Parameters:
userId -
threadId -
Returns:
a list of messages that have not been marked as read by the given user in the given thread
Throws:
PersistenceException
KeyNotFoundException
Since:
7.3

containsOnlyCalculatedUserNames

boolean containsOnlyCalculatedUserNames(java.util.Collection<Message> messages)
Returns false if any of the Messages in the collection are using stored names that will not sort correctly by last or first names (e.g., if they are stored as Anonymous, or stored directly in the postedName field rather than calculated on the fly).

Parameters:
messages -
Returns:
Since:
7.3


Copyright © 2003 Blackboard, Inc. All Rights Reserved.