public interface ProfileMessagingLogic
| Modifier and Type | Method and Description |
|---|---|
int |
getAllUnreadMessagesCount(String userId)
Get the number of all unread messages for this user, across all all message threads.
|
Message |
getMessage(String id)
Gets a Message from the database
|
MessageParticipant |
getMessageParticipant(String messageId,
String userUuid)
Get a MessageParticipant record
|
List<Message> |
getMessagesInThread(String threadId)
Gets a list of the messages contained in this thread, sorted by date posted.
|
int |
getMessagesInThreadCount(String threadId)
Gets the count of the messages in a thread
|
MessageThread |
getMessageThread(String threadId)
Gets a MessageThread, first gets the item, then injects the latest Message into it before returning
TODO This needs to be optimised to get the latest message property in the same query.
|
List<MessageThread> |
getMessageThreads(String userId)
Gets a list of MessageThreads with messages to a given user, each containing the most recent messages in each thread
TODO This needs to be optimised to get the latest message property in the same query.
|
int |
getMessageThreadsCount(String userId)
Gets the count of the message threads for a user
|
int |
getSentMessagesCount(String userId)
Get the number of all messages sent from this user
|
List<String> |
getThreadParticipants(String threadId)
Get a list of all participants in a thread
|
String |
getThreadSubject(String threadId)
Get the subject of a thread
|
int |
getThreadsWithUnreadMessagesCount(String userId)
Get the number of threads with unread messages.
|
boolean |
isThreadParticipant(String threadId,
String userId)
Is the user a participant in this thread?
|
Message |
replyToThread(String threadId,
String reply,
String userId)
Sends a reply to a thread, returns the Message just sent
|
boolean |
sendNewMessage(String uuidTo,
String uuidFrom,
String threadId,
String subject,
String messageStr)
Send a message
TODO this should be optimised for foreign key constraints
|
boolean |
toggleMessageRead(MessageParticipant participant,
boolean status)
Toggle a single message as read/unread
|
int getAllUnreadMessagesCount(String userId)
userId - uuid of the user to retrieve the count forint getThreadsWithUnreadMessagesCount(String userId)
For instance, if a user has two message threads, each with one unread message in each thread, this will return 2, as expected.
However, if a user has two message threads, each with 5 unread messages in each thread, this will return 2, not 10.
This is because we are interested in the number of threads with unread messages not the total unread messages. See ProfileLogic#getAllUnreadMessagesCount(String) if you want that instead.
userId - uuid of the user to retrieve the count forint getSentMessagesCount(String userId)
userId - uuid of the user to retrieve the count forMessageThread getMessageThread(String threadId)
id - id of the threadList<MessageThread> getMessageThreads(String userId)
userId - user to get the list of messages forint getMessageThreadsCount(String userId)
userId - user to get the count of message threads forList<Message> getMessagesInThread(String threadId)
threadId - id of the thread to get the messages forint getMessagesInThreadCount(String threadId)
threadId - thread to get the count forMessage getMessage(String id)
id - id of the messageboolean sendNewMessage(String uuidTo, String uuidFrom, String threadId, String subject, String messageStr)
TODO this should be optimised for foreign key constraints
uuidTo - uuid of recipientuuidFrom - uuid of senderthreadId - threadId, a uuid that should be generated via ProfileUtils.generateUuid()subject - message subjectmessageStr - message bodyMessage replyToThread(String threadId, String reply, String userId)
threadId - id of the threadreply - the messageuserId - uuid of user who is sending the messageboolean toggleMessageRead(MessageParticipant participant, boolean status)
participant - the MessageParticipant record as this is the item that stores read/unread statusstatus - boolean if to be toggled as read/unreadMessageParticipant getMessageParticipant(String messageId, String userUuid)
messageId - message id to get the record foruserUuid - uuid to get the record forList<String> getThreadParticipants(String threadId)
threadId - id of the threadboolean isThreadParticipant(String threadId, String userId)
threadId - id of the threaduserId - id of the userCopyright © 2008–2020 The Sakai Foundation. All rights reserved.