[jboss-svn-commits] JBL Code SVN: r12052 - labs/jbossforums/branches/forums22/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:31:24 EDT 2007
Author: unibrew
Date: 2007-05-21 20:31:24 -0400 (Mon, 21 May 2007)
New Revision: 12052
Modified:
labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java
Log:
[JBFORUMS-238] Split topic problems finally solved.
Modified: labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java
===================================================================
--- labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java 2007-05-22 00:30:59 UTC (rev 12051)
+++ labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java 2007-05-22 00:31:24 UTC (rev 12052)
@@ -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