[prev in list] [next in list] [prev in thread] [next in thread]
List: jboss-cvs-commits
Subject: [jboss-cvs] jboss-portal/forums/src/main/org/jboss/portlet/forums/commands/post ...
From: Bolesaw Dawidowicz <bdaw () o2 ! pl>
Date: 2005-07-31 14:07:07
Message-ID: E1DzET5-0000MQ-1q () committer01 ! frg ! pub ! inap ! atl ! jboss ! com
[Download RAW message or body]
User: bdaw
Date: 05/07/31 10:07:07
Modified: forums/src/main/org/jboss/portlet/forums/commands/post
Tag: JBoss_Portal_Branch_2_0 DeletePostCommand.java
EditPostCommand.java NewTopicCommand.java
Log:
Problem with delete post in topic corrected.
Revision Changes Path
No revision
No revision
1.5.2.1 +21 -4 \
jboss-portal/forums/src/main/org/jboss/portlet/forums/commands/post/DeletePostCommand.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: DeletePostCommand.java
===================================================================
RCS file: /cvsroot/jboss/jboss-portal/forums/src/main/org/jboss/portlet/forums/commands/post/DeletePostCommand.java,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -b -r1.5 -r1.5.2.1
--- DeletePostCommand.java 3 May 2005 14:17:47 -0000 1.5
+++ DeletePostCommand.java 31 Jul 2005 14:07:07 -0000 1.5.2.1
@@ -17,12 +17,14 @@
import org.jboss.portlet.forums.commands.ValidationException;
import org.jboss.portlet.forums.model.Post;
import org.jboss.portlet.forums.model.AuthType;
+import org.jboss.portlet.forums.model.Topic;
import org.jboss.portlet.JBossActionRequest;
import org.jboss.portlet.JBossActionResponse;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.5 $
+ * @author <a href="mailto:">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.5.2.1 $
*/
public class DeletePostCommand
extends PostCommand
@@ -67,10 +69,10 @@
{
throw new ValidationException(TYPE_CANNOT_DELETE_REPLIED);
}
-*/
- pd_first_post = topic.getFirstPost().getID() == post.getID();
- pd_last_post = topic.getLastPost().getID() == post.getID();
+*/
+ pd_first_post = topic.getFirstPost().getID().intValue() == \
post.getID().intValue(); + pd_last_post = \
topic.getLastPost().getID().intValue() == post.getID().intValue(); }
/**
@@ -90,6 +92,12 @@
// the watches
// the poll
// the links
+
+
+ topic.setFirstPost(null);
+ topic.setLastPost(null);
+ forum.setLastPost(null);
+ forumsModule.removePost(post);
forumsModule.removeTopic(post.getTopic());
forum.setPostCount(forum.getPostCount() - 1);
forum.setTopicCount(forum.getTopicCount() - 1);
@@ -97,6 +105,15 @@
}
else
{
+ if(pd_last_post)
+ {
+ topic.setLastPost(null);
+ forum.setLastPost(null);
+ }
+ if(pd_first_post)
+ {
+ topic.setFirstPost(null);
+ }
forumsModule.removePost(post);
topic.setReplies(topic.getReplies() - 1);
forum.setPostCount(forum.getPostCount() - 1);
1.4.2.1 +18 -1 \
jboss-portal/forums/src/main/org/jboss/portlet/forums/commands/post/EditPostCommand.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: EditPostCommand.java
===================================================================
RCS file: /cvsroot/jboss/jboss-portal/forums/src/main/org/jboss/portlet/forums/commands/post/EditPostCommand.java,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -b -r1.4 -r1.4.2.1
--- EditPostCommand.java 3 May 2005 14:17:47 -0000 1.4
+++ EditPostCommand.java 31 Jul 2005 14:07:07 -0000 1.4.2.1
@@ -13,6 +13,7 @@
import java.util.Date;
import org.jboss.portal.common.command.result.Result;
+import org.jboss.portal.core.modules.ModuleException;
import org.jboss.portlet.forums.commands.ValidationException;
import org.jboss.portlet.forums.model.AuthType;
import org.jboss.portlet.JBossActionRequest;
@@ -21,7 +22,8 @@
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @author <a href="mailto:theute@users.sourceforge.net">Thomas Heute</a>
- * @version $Revision: 1.4 $
+ * @author <a href="mailto:">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.4.2.1 $
*/
public class EditPostCommand
extends PostCommand
@@ -124,6 +126,21 @@
}
// post.setPosterUserName(poster.getUsername());
+ try
+ {
+ post = forumsModule.findPostByID(new Integer(postId));
+ }
+ catch (ModuleException e)
+ {
+ System.out.println("Probably post not found...");
+ e.printStackTrace();
+ }
+ if (post == null){
+ System.out.println("Critical Error - this shouldn't happened - post to \
edit is null"); + return TYPE_NO_SUCH_POST;
+ }
+
+
post.setMessage(message);
/*
1.7.2.1 +3 -1 \
jboss-portal/forums/src/main/org/jboss/portlet/forums/commands/post/NewTopicCommand.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: NewTopicCommand.java
===================================================================
RCS file: /cvsroot/jboss/jboss-portal/forums/src/main/org/jboss/portlet/forums/commands/post/NewTopicCommand.java,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -b -r1.7 -r1.7.2.1
--- NewTopicCommand.java 3 May 2005 14:17:47 -0000 1.7
+++ NewTopicCommand.java 31 Jul 2005 14:07:07 -0000 1.7.2.1
@@ -23,7 +23,8 @@
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @author <a href="mailto:theute@users.sourceforge.net">Thomas Heute</a>
- * @version $Revision: 1.7 $
+ * @author <a href="mailto:">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.7.2.1 $
*/
public final class NewTopicCommand
extends ForumCommand
@@ -90,6 +91,7 @@
message,
new Date(),
poster,
+ poll,
topic_type);
forumsModule.createWatch(poster, post.getTopic());
poster.incrementPostCount();
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
jboss-cvs-commits mailing list
jboss-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-cvs-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic