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.JBossActionRequest; 18 import org.jboss.portlet.JBossActionResponse; 19 20 25 public class CreateCategoryCommand 26 extends AbstractCommand 27 { 28 29 public String name; 30 31 32 public ForumsModule module; 33 34 public CreateCategoryCommand(JBossActionRequest request, JBossActionResponse response) 35 { 36 super(request, response); 37 } 38 39 44 public Result execute() 45 { 46 if (name == null) 47 { 48 return TYPE_CANNOT_CREATE_CATEGORY_INVALID_NAME; 49 } 50 51 try 52 { 53 module.createCategory(name); 54 return TYPE_CATEGORY_CREATED; 55 } 56 catch (ModuleException e) 57 { 58 log.error("", e); 59 return TYPE_CANNOT_CREATE_CATEGORY_INSERTION_FAILED; 60 } 61 } 62 } | Popular Tags |