KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jmanage > webui > actions > config > alert > ShowSelectNotificationAction


1 /**
2 * Copyright (c) 2004-2005 jManage.org
3 *
4 * This is a free software; you can redistribute it and/or
5 * modify it under the terms of the license at
6 * http://www.jmanage.org.
7 *
8 * Unless required by applicable law or agreed to in writing, software
9 * distributed under the License is distributed on an "AS IS" BASIS,
10 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 * See the License for the specific language governing permissions and
12 * limitations under the License.
13 */

14 package org.jmanage.webui.actions.config.alert;
15
16 import org.jmanage.webui.actions.BaseAction;
17 import org.jmanage.webui.util.WebContext;
18 import org.jmanage.webui.util.Forwards;
19 import org.jmanage.webui.util.RequestAttributes;
20 import org.jmanage.webui.util.RequestParams;
21 import org.jmanage.core.services.MBeanService;
22 import org.jmanage.core.services.ServiceFactory;
23 import org.apache.struts.action.ActionForm;
24 import org.apache.struts.action.ActionMapping;
25 import org.apache.struts.action.ActionForward;
26
27 import javax.servlet.http.HttpServletResponse JavaDoc;
28 import javax.servlet.http.HttpServletRequest JavaDoc;
29 import java.util.Map JavaDoc;
30 import java.util.HashMap JavaDoc;
31
32 /**
33  *
34  * <p>
35  * Date: Aug 3, 2005
36  * @author Rakesh Kalra
37  */

38 public class ShowSelectNotificationAction extends BaseAction{
39
40     public ActionForward execute(WebContext context,
41                                  ActionMapping mapping,
42                                  ActionForm actionForm,
43                                  HttpServletRequest JavaDoc request,
44                                  HttpServletResponse JavaDoc response)
45             throws Exception JavaDoc {
46         String JavaDoc objName = request.getParameter(RequestParams.OBJECT_NAME);
47         /* find mbeans that have notifications */
48         MBeanService mbeanService = ServiceFactory.getMBeanService();
49         Map JavaDoc mbeanToNotificationsMap = new HashMap JavaDoc();
50         Map JavaDoc mbeansToNotificationsMap =
51                 mbeanService.queryMBeansWithNotifications(context.getServiceContext());
52         if(objName != null){
53             mbeanToNotificationsMap.put(objName, mbeansToNotificationsMap.get(objName));
54             request.setAttribute("mbeanToNotificationsMap", mbeanToNotificationsMap);
55         }else{
56             request.setAttribute("mbeanToNotificationsMap", mbeansToNotificationsMap);
57         }
58         /*set current page for navigation*/
59         request.setAttribute(RequestAttributes.NAV_CURRENT_PAGE, "Add Alert");
60         return mapping.findForward(Forwards.SUCCESS);
61     }
62 }
63
Popular Tags