info.magnolia.ui.framework.message
Class MessageStore

java.lang.Object
  extended by info.magnolia.ui.framework.message.MessageStore

@Singleton
public class MessageStore
extends Object

Stores messages on behalf of MessagesManager in the repository, every user in the system has its own set of messages that have ids unique in combination with their userid. Ids are generated by taking the largest id in use and incrementing it by 1.


Constructor Summary
MessageStore()
           
 
Method Summary
 List<Message> findAllMessagesForUser(String userName)
           
 Message findMessageById(String userName, String messageId)
           
 int getNumberOfUnclearedMessagesForUser(String userName)
           
 int getNumberOfUnclearedMessagesForUserAndByType(String userName, MessageType type)
           
 void removeMessageById(String userName, String messageId)
           
 boolean saveMessage(String userName, Message message)
          Stores a new message or overwrites an existing one depending on whether there's an id set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageStore

public MessageStore()
Method Detail

saveMessage

public boolean saveMessage(String userName,
                           Message message)
Stores a new message or overwrites an existing one depending on whether there's an id set. That is, the id of the message is respected if present otherwise a new unique one is used. When the method returns the message has been updated with a new id.

Parameters:
userName - user to save the message for
message - message to save
Returns:
true if saving was successful or false if it failed

getNumberOfUnclearedMessagesForUser

public int getNumberOfUnclearedMessagesForUser(String userName)

findAllMessagesForUser

public List<Message> findAllMessagesForUser(String userName)

findMessageById

public Message findMessageById(String userName,
                               String messageId)

removeMessageById

public void removeMessageById(String userName,
                              String messageId)

getNumberOfUnclearedMessagesForUserAndByType

public int getNumberOfUnclearedMessagesForUserAndByType(String userName,
                                                        MessageType type)


Copyright © 2013 Magnolia International Ltd.. All Rights Reserved.