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.Forum; 20 import org.jboss.portlet.JBossActionRequest; 21 import org.jboss.portlet.JBossActionResponse; 22 23 28 public class OrderForumCommand 29 extends AbstractCommand 30 { 31 32 public int move; 33 34 35 public Forum forum; 36 37 38 public ForumsModule module; 39 40 public OrderForumCommand(JBossActionRequest request, JBossActionResponse response) 41 { 42 super(request, response); 43 } 44 45 50 public Result execute() 51 { 52 try 53 { 54 forum.setOrder(forum.getOrder() + move); 55 Iterator forums = module.findForumsByCategoryID(forum.getCategory().getID()).iterator(); 56 for (int index = 10; forums.hasNext(); index += 10) 57 { 58 forum = (Forum) forums.next(); 59 forum.setOrder(index); 60 } 61 62 return TYPE_FORUMS_ORDERED; 63 } 64 catch (ModuleException e) 65 { 66 log.error("", e); 67 return TYPE_CANNOT_ORDER_FORUMS; 68 } 69 } 70 } | Popular Tags |