KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jmanage > webui > actions > config > RemoveAlertAction


1 /**
2  * Copyright 2004-2005 jManage.org
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.jmanage.webui.actions.config;
17
18 import org.jmanage.webui.actions.BaseAction;
19 import org.jmanage.webui.util.WebContext;
20 import org.jmanage.webui.util.Forwards;
21 import org.jmanage.webui.util.RequestParams;
22 import org.jmanage.webui.util.Utils;
23 import org.jmanage.webui.forms.AlertForm;
24 import org.jmanage.core.config.ApplicationConfig;
25 import org.jmanage.core.config.ApplicationConfigManager;
26 import org.jmanage.core.config.AlertConfig;
27 import org.jmanage.core.alert.AlertEngine;
28 import org.jmanage.core.services.AccessController;
29 import org.apache.struts.action.ActionForward;
30 import org.apache.struts.action.ActionMapping;
31 import org.apache.struts.action.ActionForm;
32
33 import javax.servlet.http.HttpServletRequest JavaDoc;
34 import javax.servlet.http.HttpServletResponse JavaDoc;
35
36 /**
37  * Date: Jun 21, 2005 12:16:23 PM
38  * @author Bhavana
39  */

40 public class RemoveAlertAction extends BaseAction{
41
42     public ActionForward execute(WebContext context, ActionMapping mapping,
43                                  ActionForm form, HttpServletRequest JavaDoc request,
44                                  HttpServletResponse JavaDoc response)
45         throws Exception JavaDoc {
46         AccessController.checkAccess(Utils.getServiceContext(context),ACL_EDIT_ALERT);
47         ApplicationConfig appConfig = context.getApplicationConfig();
48         AlertConfig alertConfig = appConfig.removeAlert(
49                 request.getParameter(RequestParams.ALERT_ID));
50         if(alertConfig != null){
51             ApplicationConfigManager.updateApplication(appConfig);
52             AlertEngine.getInstance().removeAlertConfig(alertConfig);
53         }
54         return mapping.findForward(Forwards.SUCCESS);
55     }
56 }
57
Popular Tags