use of org.olat.modules.fo.model.MessageImpl in project OpenOLAT by OpenOLAT.
the class ForumManager method createMessage.
/**
* creates (in RAM only) a new Message<br>
* fill the values and use saveMessage to make it persistent
*
* @return the message
* @see ForumManager#saveMessage(Message)
*/
public Message createMessage(Forum forum, Identity creator, boolean guest) {
MessageImpl message = new MessageImpl();
message.setForum(forum);
if (guest) {
message.setGuest(guest);
} else {
message.setCreator(creator);
}
return message;
}
use of org.olat.modules.fo.model.MessageImpl in project OpenOLAT by OpenOLAT.
the class ForumManager method persistMessageInAnotherLocation.
/**
* Persist message in another location.
*/
private Message persistMessageInAnotherLocation(Message oldMessage, Forum forum, Message top, Message parent) {
// 1) take the new top messages forum to create a new child
Message message = createMessage(forum, oldMessage.getCreator(), oldMessage.isGuest());
((MessageImpl) message).setCreationDate(oldMessage.getCreationDate());
message.setLastModified(oldMessage.getLastModified());
message.setModifier(oldMessage.getModifier());
message.setTitle(oldMessage.getTitle());
message.setBody(oldMessage.getBody());
message.setPseudonym(oldMessage.getPseudonym());
// 2) set the thread top to the new top message
message.setThreadtop(top);
// 3) maintain the hierarchy, parent and top message can be equal
message.setParent(parent);
Status status = Status.getStatus(oldMessage.getStatusCode());
if (status != null) {
status.setMoved(true);
message.setStatusCode(Status.getStatusCode(status));
}
// 4) save the new massage in the new destination
message = saveMessage(message);
return message;
}
use of org.olat.modules.fo.model.MessageImpl in project openolat by klemens.
the class ForumManager method createMessage.
/**
* creates (in RAM only) a new Message<br>
* fill the values and use saveMessage to make it persistent
*
* @return the message
* @see ForumManager#saveMessage(Message)
*/
public Message createMessage(Forum forum, Identity creator, boolean guest) {
MessageImpl message = new MessageImpl();
message.setForum(forum);
if (guest) {
message.setGuest(guest);
} else {
message.setCreator(creator);
}
return message;
}
use of org.olat.modules.fo.model.MessageImpl in project openolat by klemens.
the class ForumManager method persistMessageInAnotherLocation.
/**
* Persist message in another location.
*/
private Message persistMessageInAnotherLocation(Message oldMessage, Forum forum, Message top, Message parent) {
// 1) take the new top messages forum to create a new child
Message message = createMessage(forum, oldMessage.getCreator(), oldMessage.isGuest());
((MessageImpl) message).setCreationDate(oldMessage.getCreationDate());
message.setLastModified(oldMessage.getLastModified());
message.setModifier(oldMessage.getModifier());
message.setTitle(oldMessage.getTitle());
message.setBody(oldMessage.getBody());
message.setPseudonym(oldMessage.getPseudonym());
// 2) set the thread top to the new top message
message.setThreadtop(top);
// 3) maintain the hierarchy, parent and top message can be equal
message.setParent(parent);
Status status = Status.getStatus(oldMessage.getStatusCode());
if (status != null) {
status.setMoved(true);
message.setStatusCode(Status.getStatusCode(status));
}
// 4) save the new massage in the new destination
message = saveMessage(message);
return message;
}
Aggregations