KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > applications > managementtool > actions > CreateRoleAction


1 /* ===============================================================================
2  *
3  * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4  *
5  * ===============================================================================
6  *
7  * Copyright (C)
8  *
9  * This program is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License version 2, as published by the
11  * Free Software Foundation. See the file LICENSE.html for more information.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along with
18  * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19  * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20  *
21  * ===============================================================================
22  */

23
24 package org.infoglue.cms.applications.managementtool.actions;
25
26 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction;
27 import org.infoglue.cms.controllers.kernel.impl.simple.RoleControllerProxy;
28 import org.infoglue.cms.entities.management.RoleVO;
29 import org.infoglue.cms.security.InfoGlueRole;
30 import org.infoglue.cms.util.ConstraintExceptionBuffer;
31
32
33 /**
34  * @author mgu
35  *
36  * To change this generated comment edit the template variable "typecomment":
37  * Window>Preferences>Java>Templates.
38  * To enable and disable the creation of type comments go to
39  * Window>Preferences>Java>Code Generation.
40  */

41
42
43 public class CreateRoleAction extends InfoGlueAbstractAction
44 {
45     private static final long serialVersionUID = 1L;
46     
47     private RoleVO roleVO;
48     private InfoGlueRole infoGlueRole;
49     private ConstraintExceptionBuffer ceb;
50
51     public CreateRoleAction()
52     {
53         this(new RoleVO());
54     }
55
56     public CreateRoleAction(RoleVO RoleVO)
57     {
58         this.roleVO = RoleVO;
59         this.ceb = new ConstraintExceptionBuffer();
60     }
61         
62     public String JavaDoc doInput() throws Exception JavaDoc
63     {
64         return "input";
65     }
66     
67     protected String JavaDoc doExecute() throws Exception JavaDoc
68     {
69         ceb.add(this.roleVO.validate());
70         ceb.throwIfNotEmpty();
71                     
72         this.infoGlueRole = RoleControllerProxy.getController().createRole(this.roleVO);
73         
74         return "success";
75     }
76     
77     public void setRoleName(String JavaDoc roleName)
78     {
79         this.roleVO.setRoleName(roleName);
80     }
81
82     public String JavaDoc getRoleName()
83     {
84         return this.roleVO.getRoleName();
85     }
86     
87     public void setDescription(java.lang.String JavaDoc description)
88     {
89         this.roleVO.setDescription(description);
90     }
91
92     public String JavaDoc getDescription()
93     {
94         return this.roleVO.getDescription();
95     }
96     
97
98
99 }
100
Popular Tags