KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portlet > forums > commands > moderation > DeleteTopicCommand


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Forums JBoss Portlet *
6  * *
7  * Distributable under GPL license. *
8  * See terms of license at gnu.org. *
9  * *
10  *****************************************/

11 package org.jboss.portlet.forums.commands.moderation;
12
13
14 /**
15  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
16  * @version $Revision: 1.1.1.1 $
17  */

18 public class DeleteTopicCommand // extends AbstractCommand
19
{
20    /*
21       public Homes homes;
22       public TopicEJBLocal topic;
23       public Result execute()
24       {
25          try
26          {
27             ForumEJBLocal forum = topic.getForum();
28             int replies = topic.getReplies();
29             // cascade delete will take care of removing watches, polls, posts, links
30             topic.remove();
31             forum.setPostSize(forum.getPostSize() - 1 - replies);
32             forum.setTopicSize(forum.getTopicSize() - 1);
33             try
34             {
35                forum.setLastPost(homes.post.findLastPost(forum));
36             }
37             catch(ObjectNotFoundException e)
38             {
39                // no last post
40             }
41          }
42          catch(RemoveException e)
43          {
44             log.error("Cannot remove a topic", e);
45             return TYPE_CANNOT_REMOVE_TOPICS;
46          }
47          catch(FinderException e)
48          {
49             log.error("Cannot find the last post in the forum when during topic removal", e);
50             return TYPE_CANNOT_REMOVE_TOPICS;
51          }
52          return TYPE_TOPICS_REMOVED;
53       }
54     */

55 }
Popular Tags