KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jresearch > gossip > actions > admin > topic > LockTopicAction


1 /*
2  * $$Id: LockTopicAction.java,v 1.3 2005/06/07 12:31:53 bel70 Exp $$
3  *
4  * ***** BEGIN LICENSE BLOCK ***** The contents of this file are subject to the
5  * Mozilla Public License Version 1.1 (the "License"); you may not use this file
6  * except in compliance with the License. You may obtain a copy of the License
7  * at http://www.mozilla.org/MPL/
8  *
9  * Software distributed under the License is distributed on an "AS IS" basis,
10  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
11  * the specific language governing rights and limitations under the License.
12  *
13  * The Original Code is JGossip forum code.
14  *
15  * The Initial Developer of the Original Code is the JResearch, Org. Portions
16  * created by the Initial Developer are Copyright (C) 2004 the Initial
17  * Developer. All Rights Reserved.
18  *
19  * Contributor(s): Dmitry Belov <bel@jresearch.org>
20  *
21  * ***** END LICENSE BLOCK *****
22  */

23 /*
24  * Created on Sep 27, 2003
25  *
26  */

27 package org.jresearch.gossip.actions.admin.topic;
28
29 import java.sql.SQLException JavaDoc;
30
31 import javax.servlet.http.HttpServletRequest JavaDoc;
32 import javax.servlet.http.HttpServletResponse JavaDoc;
33 import javax.servlet.http.HttpSession JavaDoc;
34
35 import org.apache.struts.action.ActionForm;
36 import org.apache.struts.action.ActionForward;
37 import org.apache.struts.action.ActionMapping;
38 import org.jresearch.gossip.IConst;
39 import org.jresearch.gossip.actions.BaseAction;
40 import org.jresearch.gossip.beans.user.User;
41 import org.jresearch.gossip.dao.ForumDAO;
42 import org.jresearch.gossip.exception.SystemException;
43 import org.jresearch.gossip.forms.ProcessTopicForm;
44
45 /**
46  * DOCUMENT ME!
47  *
48  * @author Bel
49  */

50 public class LockTopicAction extends BaseAction {
51     /**
52      * DOCUMENT ME!
53      *
54      * @param mapping
55      * DOCUMENT ME!
56      * @param form
57      * DOCUMENT ME!
58      * @param request
59      * DOCUMENT ME!
60      * @param response
61      * DOCUMENT ME!
62      *
63      * @return DOCUMENT ME!
64      */

65     public ActionForward process(ActionMapping mapping, ActionForm form,
66             HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response)
67             throws SystemException {
68         HttpSession JavaDoc session = request.getSession();
69         User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
70         ProcessTopicForm ptForm = (ProcessTopicForm) form;
71         ForumDAO dao = ForumDAO.getInstance();
72         try {
73             if (!dao.checkMod(Integer.parseInt(ptForm.getFid()), user)) {
74                 return (mapping.findForward(IConst.TOKEN.DENIED));
75             }
76
77             dao.lockThread(ptForm.getTid());
78             log(request, "logs.LOG21", ptForm.getTid());
79         } catch (SQLException JavaDoc sqle) {
80             getServlet().log("Connection.process", sqle);
81             throw new SystemException(sqle);
82         }
83         return (new ActionForward("/ShowForum.do?fid=" + ptForm.getFid(), true));
84     }
85 }
Popular Tags