use of org.olat.core.commons.persistence.SortKey in project openolat by klemens.
the class SelectThreadStepForm method displayAsNewThread.
private void displayAsNewThread(UserRequest ureq) {
Message messageToMove = (Message) getFromRunContext(SendMailStepForm.MESSAGE_TO_MOVE);
String creatorFullname = userManager.getUserDisplayName(messageToMove.getCreator());
Date lastModified = messageToMove.getLastModified();
int numOfPosts = forumManager.countMessageChildren(messageToMove.getKey()) + 1;
ForumThread row = new ForumThread(messageToMove, creatorFullname, lastModified, numOfPosts);
List<ForumThread> threads = threadTableModel.getObjects();
if (containsMessage(row)) {
showWarning("thread.already.exits");
} else {
threads.add(row);
addToRunContext(SendMailStepForm.NEW_THREAD, Boolean.TRUE);
threadTableModel.setObjects(threads);
threadTableModel.sort(new SortKey(ThreadListCols.thread.name(), true));
threadTable.reloadData();
threadTable.reset();
// move on to next wizard step directly
fireEvent(ureq, StepsEvent.ACTIVATE_NEXT);
}
}
use of org.olat.core.commons.persistence.SortKey in project openolat by klemens.
the class SelectThreadStepForm method loadModel.
private void loadModel() {
Identity identity = guestOnly ? null : getIdentity();
Message messageToMove = (Message) getFromRunContext(SendMailStepForm.MESSAGE_TO_MOVE);
messageToMove = messageToMove.getThreadtop() == null ? messageToMove : messageToMove.getThreadtop();
List<ForumThread> threads = forumManager.getForumThreads(forum, identity);
if (!foCallback.mayEditMessageAsModerator()) {
for (Iterator<ForumThread> threadIt = threads.iterator(); threadIt.hasNext(); ) {
ForumThread next = threadIt.next();
if (Status.getStatus(next.getStatusCode()).isHidden()) {
threadIt.remove();
} else if (messageToMove.getKey().equals(next.getKey())) {
threadIt.remove();
}
}
}
threadTableModel.setObjects(threads);
threadTableModel.sort(new SortKey(ThreadListCols.thread.name(), true));
threadTable.reloadData();
threadTable.reset();
}
Aggregations