@Singleton public class MessagesManagerImpl extends Object implements MessagesManager
MessagesManager
.MessagesManager.MessageListener
Constructor and Description |
---|
MessagesManagerImpl(javax.inject.Provider<info.magnolia.cms.security.SecuritySupport> securitySupportProvider,
MessageStore messageStore) |
Modifier and Type | Method and Description |
---|---|
void |
broadcastMessage(Message message)
Sends a message to all users.
|
void |
clearMessage(String userName,
String messageId)
Marks a message as cleared.
|
List<Message> |
getMessageBatch(String userName,
List<MessageType> types,
Map<String,Boolean> sortCriteria,
int limit,
int offset)
More efficient way to query message objects - the amount of return payload is limited, pre-sorted and filtered by type.
|
Message |
getMessageById(String userName,
String messageId)
Returns a message.
|
long |
getMessagesAmount(String userName,
List<MessageType> types)
Get amount of messages of certain types.
|
List<Message> |
getMessagesForUser(String userName)
Returns all messages kept for a specific user.
|
int |
getNumberOfUnclearedMessagesForUser(String userName)
Returns the number of uncleared (unread) messages for this user.
|
int |
getNumberOfUnclearedMessagesForUserAndByType(String userName,
MessageType type)
Returns the number of uncleared (unread) messages for this user and for the specific message type.
|
void |
registerMessagesListener(String userName,
MessagesManager.MessageListener listener)
Beware: this method is for registering message listeners and should only be used by the entry point of our application AdmincentralUI where we register a dispatcher.
|
void |
removeMessage(String userName,
String messageId) |
void |
saveMessage(String userName,
Message message) |
void |
sendGroupMessage(String groupName,
Message message)
Send message to a specific group.
|
void |
sendLocalMessage(Message message)
Send message to the current user.
|
void |
sendMessage(String userName,
Message message)
Send message to a specific user.
|
void |
sendRoleMessage(String roleName,
Message message)
Send message to all users with specific role.
|
void |
unregisterMessagesListener(String userName,
MessagesManager.MessageListener listener) |
@Inject public MessagesManagerImpl(javax.inject.Provider<info.magnolia.cms.security.SecuritySupport> securitySupportProvider, MessageStore messageStore)
public void broadcastMessage(Message message)
MessagesManager
broadcastMessage
in interface MessagesManager
message
- message to sendpublic void sendMessage(String userName, Message message)
MessagesManager
sendMessage
in interface MessagesManager
userName
- name of the user to receive the messagemessage
- message to sendpublic void sendGroupMessage(String groupName, Message message)
MessagesManager
sendGroupMessage
in interface MessagesManager
groupName
- name of the group to receive the messagemessage
- message to sendpublic void sendRoleMessage(String roleName, Message message)
MessagesManager
sendRoleMessage
in interface MessagesManager
roleName
- name of the role to receive the messagemessage
- message to sendpublic void sendLocalMessage(Message message)
MessagesManager
sendLocalMessage
in interface MessagesManager
message
- message to sendpublic void clearMessage(String userName, String messageId)
MessagesManager
clearMessage
in interface MessagesManager
userName
- name of the user the message belongs tomessageId
- id of messagepublic int getNumberOfUnclearedMessagesForUser(String userName)
MessagesManager
getNumberOfUnclearedMessagesForUser
in interface MessagesManager
userName
- name of the userpublic List<Message> getMessagesForUser(String userName)
MessagesManager
getMessagesForUser
in interface MessagesManager
userName
- name of the userpublic List<Message> getMessageBatch(String userName, List<MessageType> types, Map<String,Boolean> sortCriteria, int limit, int offset)
MessagesManager
getMessageBatch
in interface MessagesManager
types
- message types to include in the batchsortCriteria
- properties to order by (true if ascending)limit
- max amount of entries to inclde in the batchoffset
- first entry index to queryN = limit
Message
's starting from index = offset
public long getMessagesAmount(String userName, List<MessageType> types)
MessagesManager
getMessagesAmount
in interface MessagesManager
types
- types of messages to take in accountpublic Message getMessageById(String userName, String messageId)
MessagesManager
getMessageById
in interface MessagesManager
userName
- name of the userpublic void registerMessagesListener(String userName, MessagesManager.MessageListener listener)
MessagesManager
registerMessagesListener
in interface MessagesManager
public void unregisterMessagesListener(String userName, MessagesManager.MessageListener listener)
unregisterMessagesListener
in interface MessagesManager
public void removeMessage(String userName, String messageId)
removeMessage
in interface MessagesManager
public int getNumberOfUnclearedMessagesForUserAndByType(String userName, MessageType type)
MessagesManager
getNumberOfUnclearedMessagesForUserAndByType
in interface MessagesManager
public void saveMessage(String userName, Message message)
saveMessage
in interface MessagesManager
Copyright © 2020 Magnolia International Ltd.. All rights reserved.