1 11 package org.jboss.portlet.forums.commands.admin; 12 13 import java.util.Iterator ; 14 15 import org.jboss.portal.common.command.result.Result; 16 import org.jboss.portal.core.modules.ModuleException; 17 import org.jboss.portlet.forums.ForumsModule; 18 import org.jboss.portlet.forums.commands.AbstractCommand; 19 import org.jboss.portlet.forums.model.Category; 20 import org.jboss.portlet.JBossActionRequest; 21 import org.jboss.portlet.JBossActionResponse; 22 23 27 public class OrderCategoryCommand 28 extends AbstractCommand 29 { 30 31 public int move; 32 33 34 public Category category; 35 36 37 public ForumsModule module; 38 39 public OrderCategoryCommand(JBossActionRequest request, JBossActionResponse response) 40 { 41 super(request, response); 42 } 43 44 49 public Result execute() 50 { 51 try 52 { 53 category.setOrder(category.getOrder() + move); 54 Iterator categories = module.findCategories().iterator(); 55 for (int index = 10; categories.hasNext(); index += 10) 56 { 57 category = (Category) categories.next(); 58 category.setOrder(index); 59 } 60 61 return TYPE_CATEGORIES_ORDERED; 62 } 63 catch (ModuleException e) 64 { 65 log.error("", e); 66 return TYPE_CANNOT_ORDER_CATEGORIES; 67 } 68 } 69 } | Popular Tags |