@Singleton public class MessageStore extends Object
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.Modifier and Type | Field and Description |
---|---|
protected static String |
ASCENDING_KEYWORD |
protected static String |
DESCENDING_KEYWORD |
protected static String |
ORDER_BY |
Constructor and Description |
---|
MessageStore() |
Modifier and Type | Method and Description |
---|---|
protected String |
buildQueryMessageStatement(String userName,
List<MessageType> messageTypeList,
Map<String,Boolean> sortCriteria) |
protected String |
buildWhereTypesClause(MessageType[] messageTypes) |
protected javax.jcr.query.QueryResult |
executeQuery(String statement,
String language,
int limit,
int offset) |
List<Message> |
findAllMessagesForUser(String userName) |
Message |
findMessageById(String userName,
String messageId) |
long |
getMessageAmount(String userName,
List<MessageType> types) |
List<Message> |
getMessages(String userName,
List<MessageType> types,
Map<String,Boolean> sortCriteria,
int limit,
int offset) |
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.
|
protected static final String ORDER_BY
protected static final String ASCENDING_KEYWORD
protected static final String DESCENDING_KEYWORD
public boolean saveMessage(String userName, Message message)
userName
- user to save the message formessage
- message to savepublic int getNumberOfUnclearedMessagesForUser(String userName)
public List<Message> getMessages(String userName, List<MessageType> types, Map<String,Boolean> sortCriteria, int limit, int offset)
public long getMessageAmount(String userName, List<MessageType> types)
protected String buildQueryMessageStatement(String userName, List<MessageType> messageTypeList, Map<String,Boolean> sortCriteria)
protected String buildWhereTypesClause(MessageType[] messageTypes)
protected javax.jcr.query.QueryResult executeQuery(String statement, String language, int limit, int offset) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public int getNumberOfUnclearedMessagesForUserAndByType(String userName, MessageType type)
Copyright © 2020 Magnolia International Ltd.. All rights reserved.