KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jresearch > gossip > actions > admin > group > UpdateGroupAction


1 /*
2  * $$Id: UpdateGroupAction.java,v 1.3 2005/06/07 12:32:30 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 Oct 1, 2003
25  *
26  */

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

49 public class UpdateGroupAction extends ManageGroupForumAction {
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         GroupForm gForm = (GroupForm) form;
68         ActionMessages errors = new ActionMessages();
69         if (gForm.getGid().equals("")) {
70             errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
71                     "errors.required", "group ID"));
72         }
73         if (!errors.isEmpty()) {
74             saveErrors(request, errors);
75             return (mapping.getInputForward());
76         }
77         ForumDAO dao = ForumDAO.getInstance();
78         try {
79
80             dao.updateGroup(gForm);
81             log(request, "logs.LOG18", gForm.getGroup_name());
82         } catch (SQLException JavaDoc sqle) {
83             getServlet().log("Connection.process", sqle);
84             throw new SystemException(sqle);
85         }
86         return (new ActionForward("/ShowGroupList.do"));
87     }
88 }
Popular Tags