KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portlet > forums > commands > admin > DeleteMoveCategoryCommand


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.admin;
12
13 import org.jboss.portal.common.command.result.Result;
14 import org.jboss.portal.core.modules.ModuleException;
15 import org.jboss.portlet.forums.ForumsModule;
16 import org.jboss.portlet.forums.commands.AbstractCommand;
17 import org.jboss.portlet.forums.model.Category;
18 import org.jboss.portlet.JBossActionRequest;
19 import org.jboss.portlet.JBossActionResponse;
20
21 /**
22  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
23  * @author <a HREF="mailto:theute@jboss.org">Thomas Heute</a>
24  * @version $Revision: 1.3 $
25  */

26 public class DeleteMoveCategoryCommand
27    extends AbstractCommand
28 {
29    /** DOCUMENT_ME */
30    public Category source;
31
32    /** DOCUMENT_ME */
33    public Category target;
34
35    /** DOCUMENT_ME */
36    public ForumsModule module;
37
38    public DeleteMoveCategoryCommand(JBossActionRequest request, JBossActionResponse response)
39    {
40       super(request, response);
41    }
42
43    /**
44     * DOCUMENT_ME
45     *
46     * @return DOCUMENT_ME
47     */

48    public Result execute()
49    {
50       if ((source != null) && (target != null) && !source.getID().equals(target.getID()))
51       {
52          module.addAllForums(source, target);
53       }
54
55       try
56       {
57          module.removeCategory(source);
58          return TYPE_CATEGORY_REMOVED;
59       }
60       catch (ModuleException e)
61       {
62          log.error("", e);
63          return TYPE_CANNOT_REMOVE_CATEGORY;
64       }
65    }
66 }
Popular Tags