KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > webapp > jonasadmin > security > GroupMemoryRealmForm


1 /*
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * Initial developer(s): Michel-Ange ANTON
22  * --------------------------------------------------------------------------
23  * $Id: GroupMemoryRealmForm.java,v 1.5 2005/04/21 08:59:54 kemlerp Exp $
24  * --------------------------------------------------------------------------
25  */

26
27 package org.objectweb.jonas.webapp.jonasadmin.security;
28
29 import java.util.ArrayList JavaDoc;
30
31 import javax.servlet.http.HttpServletRequest JavaDoc;
32
33 import org.apache.struts.action.ActionMessage;
34 import org.apache.struts.action.ActionErrors;
35 import org.apache.struts.action.ActionForm;
36 import org.apache.struts.action.ActionMapping;
37 import org.objectweb.jonas.webapp.jonasadmin.Jlists;
38
39 public class GroupMemoryRealmForm extends ActionForm {
40
41 // --------------------------------------------------------- Constants
42

43 // --------------------------------------------------------- Properties variables
44

45     private String JavaDoc action = null;
46     private String JavaDoc group = null;
47     private String JavaDoc description = null;
48     private java.util.ArrayList JavaDoc listRolesGroup = new ArrayList JavaDoc();
49     private java.util.ArrayList JavaDoc listRolesRealm = new ArrayList JavaDoc();
50     private java.util.ArrayList JavaDoc listRolesUsed = new ArrayList JavaDoc();
51     private java.util.ArrayList JavaDoc listRolesNotused = new ArrayList JavaDoc();
52     private String JavaDoc rolesUsed = null;
53     private String JavaDoc rolesNotused = null;
54     private String JavaDoc[] rolesNotusedSelected = new String JavaDoc[0];
55     private String JavaDoc[] rolesUsedSelected = new String JavaDoc[0];
56
57 // --------------------------------------------------------- Public Methods
58

59     /**
60      * Reset all properties to their default values.
61      *
62      * @param mapping The mapping used to select this instance
63      * @param request The servlet request we are processing
64      */

65     public void reset(ActionMapping mapping, HttpServletRequest JavaDoc request) {
66         rolesUsed = null;
67         rolesNotused = null;
68         // Mandatory !
69
rolesNotusedSelected = new String JavaDoc[0];
70         rolesUsedSelected = new String JavaDoc[0];
71     }
72
73     /**
74      * Validate the properties that have been set from this HTTP request,
75      * and return an <code>ActionErrors</code> object that encapsulates any
76      * validation errors that have been found. If no errors are found, return
77      * <code>null</code> or an <code>ActionErrors</code> object with no
78      * recorded error messages.
79      *
80      * @param mapping The mapping used to select this instance
81      * @param request The servlet request we are processing
82      */

83     public ActionErrors validate(ActionMapping mapping, HttpServletRequest JavaDoc request) {
84         ActionErrors oErrors = new ActionErrors();
85         // Create errors
86
if (action.equals("create") == true) {
87             group = group.trim();
88             if (group.length() == 0) {
89                 oErrors.add("group"
90                     , new ActionMessage("error.security.factory.memory.realm.group.name.required"));
91             }
92         }
93         // Replace the elements in their good place
94
if (oErrors.size() > 0) {
95             listRolesUsed = Jlists.getArrayList(rolesUsed, Jlists.SEPARATOR);
96             listRolesNotused = Jlists.getArrayList(rolesNotused, Jlists.SEPARATOR);
97         }
98         return oErrors;
99     }
100
101 // --------------------------------------------------------- Properties Methods
102

103     public String JavaDoc getGroup() {
104         return group;
105     }
106
107     public void setGroup(String JavaDoc group) {
108         this.group = group;
109     }
110
111     public String JavaDoc getDescription() {
112         return description;
113     }
114
115     public void setDescription(String JavaDoc description) {
116         this.description = description;
117     }
118
119     public java.util.ArrayList JavaDoc getListRolesGroup() {
120         return listRolesGroup;
121     }
122
123     public void setListRolesGroup(java.util.ArrayList JavaDoc listRolesGroup) {
124         this.listRolesGroup = listRolesGroup;
125     }
126
127     public java.util.ArrayList JavaDoc getListRolesRealm() {
128         return listRolesRealm;
129     }
130
131     public void setListRolesRealm(java.util.ArrayList JavaDoc listRolesRealm) {
132         this.listRolesRealm = listRolesRealm;
133     }
134
135     public java.util.ArrayList JavaDoc getListRolesUsed() {
136         return listRolesUsed;
137     }
138
139     public void setListRolesUsed(java.util.ArrayList JavaDoc listRolesUsed) {
140         this.listRolesUsed = listRolesUsed;
141     }
142
143     public java.util.ArrayList JavaDoc getListRolesNotused() {
144         return listRolesNotused;
145     }
146
147     public void setListRolesNotused(java.util.ArrayList JavaDoc listRolesNotused) {
148         this.listRolesNotused = listRolesNotused;
149     }
150
151     public String JavaDoc getRolesUsed() {
152         return rolesUsed;
153     }
154
155     public void setRolesUsed(String JavaDoc rolesUsed) {
156         this.rolesUsed = rolesUsed;
157     }
158
159     public String JavaDoc getRolesNotused() {
160         return rolesNotused;
161     }
162
163     public void setRolesNotused(String JavaDoc rolesNotused) {
164         this.rolesNotused = rolesNotused;
165     }
166
167     public String JavaDoc[] getRolesNotusedSelected() {
168         return rolesNotusedSelected;
169     }
170
171     public void setRolesNotusedSelected(String JavaDoc[] rolesNotusedSelected) {
172         this.rolesNotusedSelected = rolesNotusedSelected;
173     }
174
175     public String JavaDoc[] getRolesUsedSelected() {
176         return rolesUsedSelected;
177     }
178
179     public void setRolesUsedSelected(String JavaDoc[] rolesUsedSelected) {
180         this.rolesUsedSelected = rolesUsedSelected;
181     }
182
183     public String JavaDoc getAction() {
184         return action;
185     }
186
187     public void setAction(String JavaDoc action) {
188         this.action = action;
189     }
190
191 }
Popular Tags