KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > navigation > struts > FindFavoriteAction


1 /*
2  * Copyright (c) 2001 - 2005 ivata limited.
3  * All rights reserved.
4  * -----------------------------------------------------------------------------
5  * ivata groupware may be redistributed under the GNU General Public
6  * License as published by the Free Software Foundation;
7  * version 2 of the License.
8  *
9  * These programs are free software; you can redistribute them and/or
10  * modify them under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; version 2 of the License.
12  *
13  * These programs are distributed in the hope that they will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * See the GNU General Public License in the file LICENSE.txt for more
18  * details.
19  *
20  * If you would like a copy of the GNU General Public License write to
21  *
22  * Free Software Foundation, Inc.
23  * 59 Temple Place - Suite 330
24  * Boston, MA 02111-1307, USA.
25  *
26  *
27  * To arrange commercial support and licensing, contact ivata at
28  * http://www.ivata.com/contact.jsp
29  * -----------------------------------------------------------------------------
30  * $Log: FindFavoriteAction.java,v $
31  * Revision 1.2 2005/04/09 17:19:10 colinmacleod
32  * Changed copyright text to GPL v2 explicitly.
33  *
34  * Revision 1.1.1.1 2005/03/10 17:50:36 colinmacleod
35  * Restructured ivata op around Hibernate/PicoContainer.
36  * Renamed ivata groupware.
37  *
38  * -----------------------------------------------------------------------------
39  */

40 package com.ivata.groupware.navigation.struts;
41
42 import javax.servlet.http.HttpServletRequest JavaDoc;
43 import javax.servlet.http.HttpServletResponse JavaDoc;
44 import javax.servlet.http.HttpSession JavaDoc;
45
46 import org.apache.struts.action.ActionErrors;
47 import org.apache.struts.action.ActionForm;
48 import org.apache.struts.action.ActionMapping;
49
50 import com.ivata.groupware.navigation.menu.item.MenuItemDO;
51 import com.ivata.mask.MaskFactory;
52 import com.ivata.mask.persistence.PersistenceManager;
53 import com.ivata.mask.util.SystemException;
54 import com.ivata.mask.web.struts.FindAction;
55 import com.ivata.mask.web.struts.InputMaskForm;
56 import com.ivata.mask.web.struts.MaskAction;
57 import com.ivata.mask.web.struts.MaskAuthenticator;
58
59 /**
60  * Find a favorite, given it's id.
61  *
62  * @since ivata groupware 0.10 (2005-02-14)
63  * @author Colin MacLeod
64  * <a HREF="mailto:colin.macleod@ivata.com">colin.macleod@ivata.com</a>
65  * @version $Revision: 1.2 $
66  */

67 public class FindFavoriteAction extends FindAction {
68     public FindFavoriteAction(final PersistenceManager persistenceManagerParam,
69             final MaskFactory maskFactoryParam,
70             final MaskAuthenticator authenticatorParam) {
71         super (persistenceManagerParam, maskFactoryParam, authenticatorParam);
72     }
73
74     /**
75      * This does all the hard work of locating the favorite.
76      * Refer to {@link MaskAction#execute}.
77      *
78      * @param mappingParam Refer to {@link MaskAction#execute}.
79      * @param errorsParam Refer to {@link MaskAction#execute}.
80      * @param formParam Refer to {@link MaskAction#execute}.
81      * @param requestParam Refer to {@link MaskAction#execute}.
82      * @param responseParam Refer to {@link MaskAction#execute}.
83      * @param sessionParam Refer to {@link MaskAction#execute}.
84      * @return Refer to {@link MaskAction#execute}.
85      * @throws SystemException Refer to {@link MaskAction#execute}.
86      */

87     public String JavaDoc execute(final ActionMapping mappingParam,
88             final ActionErrors errorsParam,
89             final ActionForm form,
90             final HttpServletRequest JavaDoc request,
91             final HttpServletResponse JavaDoc response,
92             final HttpSession JavaDoc session)
93             throws SystemException {
94         setBaseClassName(MenuItemDO.class.getName());
95         String JavaDoc forward =
96             super.execute(mappingParam, errorsParam, form, request,
97                 response, session);
98
99         // we don't want to warn on delete, and we don't want the new or apply
100
// buttons to show, and we want to close on ok.
101
InputMaskForm inputMaskForm = (InputMaskForm)
102             request.getAttribute(InputMaskForm.REQUEST_ATTRIBUTE);
103         assert (inputMaskForm != null);
104         // we don't want a warning for deleting favorites!
105
inputMaskForm.setDeleteWithoutWarn(true);
106         // only delete/ok/cancel buttons needed
107
inputMaskForm.setApplyButtonHidden(true);
108         inputMaskForm.setClearButtonHidden(true);
109         // close the pop-up on ok
110
inputMaskForm.setDefaultForwardDelete("utilClosePopUp");
111         inputMaskForm.setDefaultForwardOk("utilClosePopUp");
112         // path to the field labels in the application resources
113
inputMaskForm.setResourceFieldPath("navigationFavorite");
114         // refresh the pop-up opener
115
inputMaskForm.setRefreshOpener(true);
116         return forward;
117     }
118 }
119
Popular Tags