KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jresearch > gossip > actions > admin > user > AddModAction


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

24 /*
25  * Created on Oct 9, 2003
26  *
27  */

28 package org.jresearch.gossip.actions.admin.user;
29
30 import java.sql.SQLException JavaDoc;
31
32 import javax.servlet.http.HttpServletRequest JavaDoc;
33 import javax.servlet.http.HttpServletResponse 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.constants.UserStatus;
39 import org.jresearch.gossip.dao.ForumDAO;
40 import org.jresearch.gossip.dao.UserDAO;
41 import org.jresearch.gossip.exception.SystemException;
42 import org.jresearch.gossip.forms.ProcessModForm;
43
44 /**
45  * DOCUMENT ME!
46  *
47  * @author Bel
48  */

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

64     public ActionForward process(ActionMapping mapping, ActionForm form,
65             HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response)
66             throws SystemException {
67         ForumDAO dao = ForumDAO.getInstance();
68         UserDAO userdao = UserDAO.getInstance();
69         ProcessModForm pmForm = (ProcessModForm) form;
70         try {
71             dao.addMod(pmForm.getFid(), pmForm.getName());
72             userdao.setUserStatus(pmForm.getName(), UserStatus.MOD);
73             setUpdatedLogin(pmForm.getName());
74         } catch (SQLException JavaDoc sqle) {
75             getServlet().log("Connection.process", sqle);
76             throw new SystemException(sqle);
77         }
78         return (new ActionForward("ShowUser.do?uid=" + pmForm.getName(), true));
79     }
80 }
Popular Tags