use of org.olat.modules.fo.model.MessageLightImpl 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.MessageLightImpl 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