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.backoffice.tree.TreeControl; 13 import org.nextime.ion.backoffice.tree.TreeControlNode; 14 import org.nextime.ion.backoffice.exception.BackofficeSecurityException; 15 import org.nextime.ion.backoffice.security.SecurityManagerImpl; 16 17 import org.nextime.ion.framework.business.Section; 18 import org.nextime.ion.framework.business.User; 19 import org.nextime.ion.framework.mapping.Mapping; 20 21 public class MoveSectionAction extends BaseAction { 22 23 public ActionForward perform( 24 ActionMapping mapping, 25 ActionForm form, 26 HttpServletRequest request, 27 HttpServletResponse response) 28 throws IOException , ServletException { 29 30 checkUser(request); 32 33 try { 35 Mapping.begin(); 36 if (!new SecurityManagerImpl().canCreateSection(Section.getInstance(request.getParameter("id").toString()), User.getInstance(request.getSession().getAttribute("userLogin")+""))) { 37 throw new Exception (); 38 } 39 } catch (Exception e) { 40 throw new BackofficeSecurityException(); 41 } finally { 42 Mapping.rollback(); 43 } 44 45 try { 47 Mapping.begin(); 48 49 Section section = Section.getInstance(request.getParameter("id")); 50 TreeControlNode node = ((TreeControl)(request.getSession().getAttribute("treeControlTest"))).findNode(request.getParameter("id")); 51 if( request.getParameter("type").equals("up") ) { 53 section.up(); 54 node.up(); 55 } else { 56 section.down(); 57 node.down(); 58 } 59 60 Mapping.commit(); 61 } catch (Exception e) { 62 Mapping.rollback(); 63 throw new ServletException (e); 64 } 65 66 return (mapping.findForward("ok")); 68 69 } 70 71 } 72 | Popular Tags |