KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > efs > openreports > actions > admin > DeleteGroupAction


1 /*
2  * Copyright (C) 2003 Erik Swenson - eswenson@opensourcesoft.net
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the Free
6  * Software Foundation; either version 2 of the License, or (at your option)
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16  * Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */

19
20 package org.efs.openreports.actions.admin;
21
22 import org.efs.openreports.objects.ReportGroup;
23 import org.efs.openreports.providers.GroupProvider;
24 import org.efs.openreports.providers.GroupProviderAware;
25
26 public class DeleteGroupAction extends DeleteAction implements GroupProviderAware
27 {
28     private GroupProvider groupProvider;
29
30     public String JavaDoc execute()
31     {
32         try
33         {
34             ReportGroup reportGroup =
35                 groupProvider.getReportGroup(new Integer JavaDoc(id));
36             
37             name = reportGroup.getName();
38             description = reportGroup.getDescription();
39             
40             if (!submitDelete && !submitCancel)
41             {
42                 return INPUT;
43             }
44             
45             if (submitDelete)
46             {
47                 groupProvider.deleteReportGroup(reportGroup);
48             }
49         }
50         catch (Exception JavaDoc e)
51         {
52             addActionError(e.getMessage());
53             return INPUT;
54         }
55
56         return SUCCESS;
57     }
58
59     public void setGroupProvider(GroupProvider groupProvider)
60     {
61         this.groupProvider = groupProvider;
62     }
63 }
Popular Tags