|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ProfileMessagingLogic
An interface for dealing with messaging in Profile2
| Method Summary | |
|---|---|
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 |
boolean |
toggleMessageRead(MessageParticipant participant,
boolean status)
Toggle a single message as read/unread |
| Method Detail |
|---|
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 for
int getSentMessagesCount(String userId)
userId - uuid of the user to retrieve the count for
MessageThread getMessageThread(String threadId)
id - id of the thread
List<MessageThread> getMessageThreads(String userId)
userId - user to get the list of messages for
int getMessageThreadsCount(String userId)
userId - user to get the count of message threads for
List<Message> getMessagesInThread(String threadId)
threadId - id of the thread to get the messages for
int getMessagesInThreadCount(String threadId)
threadId - thread to get the count for
Message getMessage(String id)
id - id of the message
boolean 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 body
Message replyToThread(String threadId,
String reply,
String userId)
threadId - id of the threadreply - the messageuserId - uuid of user who is sending the message
boolean 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/unread
MessageParticipant getMessageParticipant(String messageId,
String userUuid)
messageId - message id to get the record foruserUuid - uuid to get the record for
List<String> getThreadParticipants(String threadId)
threadId - id of the thread
boolean isThreadParticipant(String threadId,
String userId)
threadId - id of the threaduserId - id of the user
String getThreadSubject(String threadId)
threadId - id of the thread
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||