[jboss-svn-commits] JBL Code SVN: r12049 - labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/action.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon May 21 20:29:23 EDT 2007
Author: unibrew
Date: 2007-05-21 20:29:23 -0400 (Mon, 21 May 2007)
New Revision: 12049
Modified:
labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java
Log:
[JBFORUMS-238] Split topic problems finally solved.
Modified: labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java
===================================================================
--- labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java 2007-05-22 00:28:47 UTC (rev 12048)
+++ labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java 2007-05-22 00:29:23 UTC (rev 12049)
@@ -146,6 +146,9 @@
}
try {
+
+ getForumsModule().getHibernate().getSessionFactory().getCurrentSession().refresh(this.topic);
+
Forum destForum = getForumsModule().findForumById(new Integer(toForumId));
// Creating new topic in destination forum.
@@ -178,7 +181,18 @@
{
newTopic.addPost((Post)it.next());
}
+
+ newTopic.setReplies(newTopic.getPosts().size()-1);
newTopic.setLastPostDate(newTopic.getLastPost().getCreateDate());
+
+ Forum fromForum = topic.getForum();
+ topic.setReplies(topic.getReplies()-newTopic.getReplies()-1);
+ fromForum.setPostCount(fromForum.getPostCount()-newTopic.getReplies()-1);
+ topic.setLastPostDate(topic.getLastPost().getCreateDate());
+
+ destForum.addTopicSize();
+ destForum.setPostCount(destForum.getPostCount()+newTopic.getReplies()+1);
+
getForumsModule().getHibernate().getSessionFactory().getCurrentSession().flush();
} catch (Exception e) {
e.printStackTrace();
@@ -261,7 +275,20 @@
movedPost = getForumsModule().findPostById((Integer)selectIt.next());
newTopic.addPost(movedPost);
}
+
+ getForumsModule().getHibernate().getSessionFactory().getCurrentSession().refresh(this.topic);
+
+ Forum fromForum = topic.getForum();
+ topic.setReplies(topic.getReplies()-checkboxes.size());
+ fromForum.setPostCount(fromForum.getPostCount()-checkboxes.size());
+ topic.setLastPostDate(topic.getLastPost().getCreateDate());
+
+ newTopic.setReplies(checkboxes.size()-1);
newTopic.setLastPostDate(newTopic.getLastPost().getCreateDate());
+
+ destForum.addTopicSize();
+ destForum.setPostCount(destForum.getPostCount()+newTopic.getReplies()+1);
+
getForumsModule().getHibernate().getSessionFactory().getCurrentSession().flush();
} catch (Exception e) {
e.printStackTrace();
More information about the jboss-svn-commits
mailing list