use of org.olat.modules.fo.model.ReadMessageImpl in project OpenOLAT by OpenOLAT.
the class ForumManager method markNewMessageAsRead.
/**
* Optimized method to mark newly created messages as read.
*
* @param identity
* @param forum
* @param msg
*/
public void markNewMessageAsRead(Identity identity, Forum forum, Message msg) {
// Check if the message was not already deleted
ReadMessageImpl readMessage = new ReadMessageImpl();
readMessage.setIdentity(identity);
readMessage.setMessage(msg);
readMessage.setForum(forum);
dbInstance.getCurrentEntityManager().persist(readMessage);
}
use of org.olat.modules.fo.model.ReadMessageImpl in project OpenOLAT by OpenOLAT.
the class ForumManager method markAsRead.
/**
* Implementation with one entry per forum message.
* Adds a new entry into the ReadMessage for the input message and identity.
* @param msg
* @param identity
*/
public void markAsRead(Identity identity, Forum forum, MessageLight msg) {
// Check if the message was not already deleted
Message retrievedMessage = loadMessage(msg.getKey());
if (retrievedMessage != null) {
ReadMessageImpl readMessage = new ReadMessageImpl();
readMessage.setIdentity(identity);
if (msg instanceof MessageLightImpl) {
readMessage.setMessage(msg);
} else {
msg = dbInstance.getCurrentEntityManager().getReference(MessageLightImpl.class, msg.getKey());
readMessage.setMessage(msg);
}
readMessage.setForum(forum);
dbInstance.getCurrentEntityManager().persist(readMessage);
}
}
use of org.olat.modules.fo.model.ReadMessageImpl in project openolat by klemens.
the class ForumManager method markNewMessageAsRead.
/**
* Optimized method to mark newly created messages as read.
*
* @param identity
* @param forum
* @param msg
*/
public void markNewMessageAsRead(Identity identity, Forum forum, Message msg) {
// Check if the message was not already deleted
ReadMessageImpl readMessage = new ReadMessageImpl();
readMessage.setIdentity(identity);
readMessage.setMessage(msg);
readMessage.setForum(forum);
dbInstance.getCurrentEntityManager().persist(readMessage);
}
use of org.olat.modules.fo.model.ReadMessageImpl in project openolat by klemens.
the class ForumManager method markAsRead.
/**
* Implementation with one entry per forum message.
* Adds a new entry into the ReadMessage for the input message and identity.
* @param msg
* @param identity
*/
public void markAsRead(Identity identity, Forum forum, MessageLight msg) {
// Check if the message was not already deleted
Message retrievedMessage = loadMessage(msg.getKey());
if (retrievedMessage != null) {
ReadMessageImpl readMessage = new ReadMessageImpl();
readMessage.setIdentity(identity);
if (msg instanceof MessageLightImpl) {
readMessage.setMessage(msg);
} else {
msg = dbInstance.getCurrentEntityManager().getReference(MessageLightImpl.class, msg.getKey());
readMessage.setMessage(msg);
}
readMessage.setForum(forum);
dbInstance.getCurrentEntityManager().persist(readMessage);
}
}
Aggregations