1 package org.nemesis.forum.webapp.admin.action; 2 3 import javax.servlet.http.HttpServletRequest ; 4 import javax.servlet.http.HttpServletResponse ; 5 6 import org.apache.commons.logging.Log; 7 import org.apache.commons.logging.LogFactory; 8 import org.apache.struts.action.ActionError; 9 import org.apache.struts.action.ActionErrors; 10 import org.apache.struts.action.ActionForm; 11 import org.apache.struts.action.ActionForward; 12 import org.apache.struts.action.ActionMapping; 13 import org.nemesis.forum.Forum; 14 import org.nemesis.forum.ForumFactory; 15 import org.nemesis.forum.webapp.exception.UnauthorizedException; 16 17 18 23 public class DelForumFilterAction extends BaseAction { 24 25 static protected Log log =LogFactory.getLog(DelForumFilterAction.class); 26 27 28 public ActionForward execute(ActionMapping mapping, 29 ActionForm form, 30 HttpServletRequest request, 31 HttpServletResponse response) 32 throws Exception { 33 34 checkUser(request); 36 37 ActionErrors errors = new ActionErrors(); 38 39 40 try { 41 42 ForumFactory forumFactory = ForumFactory.getInstance(getAuthToken(request)); 43 Forum forum = forumFactory.getForum(Integer.parseInt(request.getParameter("id"))); 44 request.setAttribute("id", request.getParameter("id")); 45 checkPermission(request, OperationConstants.DELETE_FORUM_FILTER, forum); 47 48 forum.removeForumMessageFilter(Integer.parseInt(request.getParameter("filter"))); 49 50 } catch (UnauthorizedException ue) { 51 errors.add("general", new ActionError("delForumFilter.Unauthorized")); 52 } catch (Exception e) { 53 String eid = this.getClass().getName() + "_" + System.currentTimeMillis(); 54 log.error("eid:" + eid + "\nsessionID" + request.getSession().getId(), e); 55 errors.add("general", new ActionError("error.general", "erreur id:" + eid)); 56 } 57 58 if (!errors.isEmpty()) { 59 saveErrors(request, errors); 60 return mapping.findForward("cancel"); 61 } 62 63 return mapping.findForward("success"); 64 } 65 66 } | Popular Tags |