1 package org.nextime.ion.backoffice.action.content; 2 3 import java.io.IOException ; 4 5 import javax.servlet.ServletException ; 6 import javax.servlet.http.HttpServletRequest ; 7 import javax.servlet.http.HttpServletResponse ; 8 import org.apache.struts.action.ActionForm; 9 import org.apache.struts.action.ActionForward; 10 import org.apache.struts.action.ActionMapping; 11 import org.nextime.ion.backoffice.action.BaseAction; 12 import org.nextime.ion.commons.PublicationSorter; 13 import org.nextime.ion.framework.business.Publication; 14 import org.nextime.ion.framework.business.Section; 15 import org.nextime.ion.framework.mapping.Mapping; 16 17 public class MovePublicationAction extends BaseAction { 18 19 public ActionForward perform( 20 ActionMapping mapping, 21 ActionForm form, 22 HttpServletRequest request, 23 HttpServletResponse response) 24 throws IOException , ServletException { 25 26 checkUser(request); 28 29 try { 31 Mapping.begin(); 32 33 Publication p = Publication.getInstance(request.getParameter("pId")); 34 Section s = Section.getInstance(request.getParameter("id")); 35 if( request.getParameter("type").equals("up") ) { 37 PublicationSorter.upPublication(p, s); 38 } else { 39 PublicationSorter.downPublication(p, s); 40 } 41 42 Mapping.commit(); 43 } catch (Exception e) { 44 Mapping.rollback(); 45 throw new ServletException (e); 46 } 47 48 return (mapping.findForward("ok")); 50 51 } 52 53 } 54 | Popular Tags |