KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jresearch > gossip > actions > subscription > SubscribeAction


1 /*
2  * $$Id: SubscribeAction.java,v 1.3 2005/06/07 12:32:32 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 package org.jresearch.gossip.actions.subscription;
24
25 import java.sql.SQLException JavaDoc;
26
27 import javax.servlet.http.HttpServletRequest JavaDoc;
28 import javax.servlet.http.HttpServletResponse JavaDoc;
29 import javax.servlet.http.HttpSession JavaDoc;
30
31 import org.apache.struts.action.ActionForm;
32 import org.apache.struts.action.ActionForward;
33 import org.apache.struts.action.ActionMapping;
34 import org.jresearch.gossip.IConst;
35 import org.jresearch.gossip.actions.BaseAction;
36 import org.jresearch.gossip.beans.user.User;
37 import org.jresearch.gossip.dao.ForumDAO;
38 import org.jresearch.gossip.exception.SystemException;
39 import org.jresearch.gossip.forms.ProcessTopicForm;
40
41 /**
42  * DOCUMENT ME!
43  *
44  * @author dbelov
45  */

46 public class SubscribeAction extends BaseAction {
47     /*
48      * (non-Javadoc)
49      *
50      * @see org.jresearch.gossip.actions.BaseAction#process(org.apache.struts.action.ActionMapping,
51      * org.apache.struts.action.ActionForm,
52      * javax.servlet.http.HttpServletRequest,
53      * javax.servlet.http.HttpServletResponse)
54      */

55     public ActionForward process(ActionMapping mapping, ActionForm form,
56             HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response)
57             throws SystemException {
58         HttpSession JavaDoc session = request.getSession();
59         User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
60         ProcessTopicForm ptForm = (ProcessTopicForm) form;
61         ForumDAO dao = ForumDAO.getInstance();
62         try {
63
64             dao.subscribe(ptForm.getTid(), user.getInfo().getEmail(), user
65                     .getName());
66             setStatusMessage(request, "mails.CONFIRM_SUBSCR");
67         } catch (SQLException JavaDoc sqle) {
68             getServlet().log("Connection.process", sqle);
69             throw new SystemException(sqle);
70         }
71         return (new ActionForward("/ShowThread.do?fid=" + ptForm.getFid()
72                 + "&tid=" + ptForm.getTid() + "&block=" + ptForm.getBlock(),
73                 true));
74     }
75 }
Popular Tags