KickJava   Java API By Example, From Geeks To Geeks.

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


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.forms.ApplicationForm;
22 import org.jmanage.core.config.ApplicationConfigManager;
23 import org.jmanage.core.config.ApplicationConfig;
24 import org.jmanage.core.config.AlertConfig;
25 import org.jmanage.core.util.UserActivityLogger;
26 import org.jmanage.core.services.AccessController;
27 import org.jmanage.core.alert.AlertEngine;
28 import org.apache.struts.action.ActionForward;
29 import org.apache.struts.action.ActionMapping;
30 import org.apache.struts.action.ActionForm;
31
32 import javax.servlet.http.HttpServletRequest JavaDoc;
33 import javax.servlet.http.HttpServletResponse JavaDoc;
34 import java.util.Iterator JavaDoc;
35
36 /**
37  *
38  * date: Jun 27, 2004
39  * @author Rakesh Kalra, Shashank Bellary
40  */

41 public class DeleteApplicationAction extends BaseAction{
42
43     public ActionForward execute(WebContext context,
44                                  ActionMapping mapping,
45                                  ActionForm actionForm,
46                                  HttpServletRequest JavaDoc request,
47                                  HttpServletResponse JavaDoc response)
48             throws Exception JavaDoc {
49         AccessController.checkAccess(context.getServiceContext(),
50                 ACL_EDIT_APPLICATIONS);
51         ApplicationForm appForm = (ApplicationForm)actionForm;
52         ApplicationConfig config=ApplicationConfigManager.deleteApplication
53                 (appForm.getApplicationId());
54
55         /* unregister alerts for this application */
56         AlertEngine.getInstance().removeApplication(config);
57
58         UserActivityLogger.getInstance().logActivity(
59                 context.getUser().getUsername(),
60                 "Deleted application "+"\""+config.getName()+"\"");
61         return mapping.findForward(Forwards.SUCCESS);
62     }
63 }
64
Popular Tags