1 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 26 public class CreateForumCommand 27 extends AbstractCommand 28 { 29 30 public String name; 31 32 33 public String description; 34 35 36 public Category category; 37 38 39 public ForumsModule module; 40 41 public CreateForumCommand(JBossActionRequest request, JBossActionResponse response) 42 { 43 super(request, response); 44 } 45 46 51 public Result execute() 52 { 53 if ("".equals(name)) 54 { 55 return TYPE_CANNOT_CREATE_FORUM_INVALID_NAME; 56 } 57 58 if (category == null) 59 { 60 return TYPE_CANNOT_CREATE_FORUM_INVALID_CATEGORY; 61 } 62 63 try 64 { 65 module.createForum(category, name, description); 66 return TYPE_FORUM_CREATED; 67 } 68 catch (ModuleException e) 69 { 70 log.error("", e); 71 return TYPE_CANNOT_CREATE_FORUM_INSERTION_FAILED; 72 } 73 } 74 } | Popular Tags |