KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > websphere6 > dd > beans > AuthorizationsType


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.j2ee.websphere6.dd.beans;
20
21 import org.w3c.dom.*;
22 import org.netbeans.modules.schema2beans.*;
23 import java.beans.*;
24 import java.util.*;
25
26 // BEGIN_NOI18N
27

28 public class AuthorizationsType extends org.netbeans.modules.schema2beans.BaseBean implements DDXmiConstants {
29
30     static Vector comparators = new Vector();
31     private static final org.netbeans.modules.schema2beans.Version runtimeVersion = new org.netbeans.modules.schema2beans.Version(4, 2, 0);
32
33
34     public AuthorizationsType() {
35         this(Common.USE_DEFAULT_VALUES);
36     }
37     
38     public AuthorizationsType(int options) {
39         super(comparators, runtimeVersion);
40         // Properties (see root bean comments for the bean graph)
41
initPropertyTables(4);
42         this.createProperty(ROLE_ID,
43                 ROLE,
44                 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY,
45                 java.lang.String JavaDoc.class);
46         this.createAttribute(ROLE, HREF_ID, ROLE_HREF,
47                 AttrProp.CDATA | AttrProp.IMPLIED,
48                 null, null);
49         
50         this.createProperty(GROUPS_ID,
51                 GROUPS,
52                 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY,
53                 java.lang.String JavaDoc.class);
54         
55         this.createAttribute(GROUPS, XMI_ID_ID, GROUPS_XMI_ID,
56                 AttrProp.CDATA | AttrProp.IMPLIED,
57                 null, null);
58         this.createAttribute(GROUPS, NAME_ID, GROUPS_NAME ,
59                 AttrProp.CDATA | AttrProp.IMPLIED,
60                 null, null);
61         
62         this.createProperty(USERS_ID,
63                 USERS,
64                 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY,
65                 java.lang.String JavaDoc.class);
66         
67         this.createAttribute(USERS, XMI_ID_ID, USERS_XMI_ID,
68                 AttrProp.CDATA | AttrProp.IMPLIED,
69                 null, null);
70         this.createAttribute(USERS, NAME_ID, USERS_NAME ,
71                 AttrProp.CDATA | AttrProp.IMPLIED,
72                 null, null);
73         
74         this.createProperty(SPECIAL_SUBJECTS_ID,
75                 SPECIAL_SUBJECTS,
76                 Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY,
77                 SpecialSubjectType.class);
78         
79         this.createAttribute(SPECIAL_SUBJECTS, XMI_ID_ID, SPECIAL_SUBJECTS_XMI_ID,
80                 AttrProp.CDATA | AttrProp.IMPLIED,
81                 null, null);
82         this.createAttribute(SPECIAL_SUBJECTS, XMI_TYPE_ID, SPECIAL_SUBJECTS_TYPE,
83                 AttrProp.CDATA | AttrProp.IMPLIED,
84                 null, null);
85         this.createAttribute(SPECIAL_SUBJECTS, NAME_ID, SPECIAL_SUBJECTS_NAME,
86                 AttrProp.CDATA | AttrProp.IMPLIED,
87                 null, null);
88         
89         
90         
91         
92         this.initialize(options);
93     }
94     
95     // Setting the default values of the properties
96
void initialize(int options) {
97         
98     }
99     public void setDefaults(){
100         String JavaDoc time_id="_"+java.lang.System.currentTimeMillis();
101         setRoleHref("SOME_ROLE");
102         setXmiId(AUTHORIZATION+time_id);
103         SpecialSubjectType sst=new SpecialSubjectType();
104         sst.setType(SPECIAL_SUBJECTS_TYPE_EVERYONE);
105         sst.setXmiId(SPECIAL_SUBJECTS_TYPE_EVERYONE + time_id);
106         sst.setName(SPECIAL_SUBJECTS_TYPE_EVERYONE);
107         setSpecialSubjects(sst);
108         ;
109     }
110     
111     public void setXmiId(String JavaDoc value) {
112         this.setAttributeValue(AUTH_ID,value);
113     }
114     public String JavaDoc getXmiId() {
115         return (String JavaDoc)getAttributeValue(AUTH_ID);
116     }
117     
118     // This attribute is mandatory
119
public void setRole(java.lang.String JavaDoc value) {
120         this.setValue(ROLE, value);
121     }
122     
123     //
124
public java.lang.String JavaDoc getRole() {
125         return (java.lang.String JavaDoc)this.getValue(ROLE);
126     }
127     
128     // This attribute is optional
129
public void setGroups(java.lang.String JavaDoc value) {
130         this.setValue(GROUPS, value);
131     }
132     
133     //
134
public java.lang.String JavaDoc getGroups() {
135         return (java.lang.String JavaDoc)this.getValue(GROUPS);
136     }
137     
138     // This attribute is optional
139
public void setUsers(java.lang.String JavaDoc value) {
140         this.setValue(USERS, value);
141     }
142     
143     //
144
public java.lang.String JavaDoc getUsers() {
145         return (java.lang.String JavaDoc)this.getValue(USERS);
146     }
147     
148     //
149
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
150         comparators.add(c);
151     }
152     
153     //
154
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
155         comparators.remove(c);
156     }
157     
158     // This attribute is optional
159
public void setRoleHref(java.lang.String JavaDoc value) {
160         if(getRole()==null) {
161             setRole("");
162         }
163         setAttributeValue(ROLE, ROLE_HREF,DDXmi.addAppHrefToId(value));
164     }
165     
166     public String JavaDoc getRoleHref() {
167         if(getRole()==null) {
168             return null;
169         }
170         return DDXmi.getIdFromHref((String JavaDoc)getAttributeValue(ROLE, ROLE_HREF));
171     }
172     
173     public void setGroupsXmiId(java.lang.String JavaDoc value) {
174         if(getGroups()==null) {
175             setGroups("");
176         }
177         setAttributeValue(GROUPS, GROUPS_XMI_ID,value);
178     }
179     
180     public String JavaDoc getGroupsXmiId() {
181         if(getGroups()==null) {
182             return null;
183         }
184         return (String JavaDoc)getAttributeValue(GROUPS, GROUPS_XMI_ID);
185     }
186     
187     public void setGroupsName(java.lang.String JavaDoc value) {
188         if(getGroups()==null) {
189             setGroups("");
190         }
191         setAttributeValue(GROUPS, GROUPS_NAME,value);
192     }
193     
194     public String JavaDoc getGroupsName() {
195         if(getGroups()==null) {
196             return null;
197         }
198         return (String JavaDoc)getAttributeValue(GROUPS, GROUPS_NAME);
199     }
200     
201     
202     public void setUsersXmiId(java.lang.String JavaDoc value) {
203         if(getUsers()==null) {
204             setUsers("");
205         }
206         setAttributeValue(USERS, USERS_XMI_ID,value);
207     }
208     
209     public String JavaDoc getUsersXmiId() {
210         if(getUsers()==null) {
211             return null;
212         }
213         return (String JavaDoc)getAttributeValue(USERS, USERS_XMI_ID);
214     }
215     
216     public void setUsersName(java.lang.String JavaDoc value) {
217         if(getUsers()==null) {
218             setUsers("");
219         }
220         setAttributeValue(USERS, USERS_NAME,value);
221     }
222     
223     public String JavaDoc getUsersName() {
224         if(getUsers()==null) {
225             return null;
226         }
227         return (String JavaDoc)getAttributeValue(USERS, USERS_NAME);
228     }
229     
230     
231     // functions for manupulation SpecialSubjects
232
public void setSpecialSubjects(SpecialSubjectType value) {
233         this.setValue(SPECIAL_SUBJECTS,value);
234     }
235     
236     public SpecialSubjectType getSpecialSubjects() {
237         return (SpecialSubjectType) this.getValue(SPECIAL_SUBJECTS);
238     }
239     
240     public int sizeSpecialSubjects() {
241         return this.size(SPECIAL_SUBJECTS);
242     }
243     
244     
245     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
246         boolean restrictionFailure = false;
247         boolean restrictionPassed = false;
248         
249          if(getXmiId()==null) {
250             throw new org.netbeans.modules.schema2beans.ValidateException("getXmiId() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, AUTHORIZATIONS, this); // NOI18N
251
}
252         if(getRoleHref()==null) {
253             throw new org.netbeans.modules.schema2beans.ValidateException("getRoleHref() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, ROLE, this); // NOI18N
254
}
255         if(getGroups()!=null){
256             if(getGroupsName()==null) {
257                 throw new org.netbeans.modules.schema2beans.ValidateException("getGroupsName() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, GROUPS, this); // NOI18N
258
}
259             if(getGroupsXmiId()==null) {
260                 throw new org.netbeans.modules.schema2beans.ValidateException("getGroupsXmiId() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, GROUPS, this); // NOI18N
261
}
262         }
263         if(getUsers()!=null){
264             if(getUsersName()==null) {
265                 throw new org.netbeans.modules.schema2beans.ValidateException("getUsersName() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, USERS, this); // NOI18N
266
}
267             if(getUsersXmiId()==null) {
268                 throw new org.netbeans.modules.schema2beans.ValidateException("getUsersXmiId() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, USERS, this); // NOI18N
269
}
270         }
271          if(getSpecialSubjects()!=null){
272             getSpecialSubjects().validate();
273         }
274         
275         
276     }
277     // Dump the content of this bean returning it as a String
278
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
279         String JavaDoc s;
280         Object JavaDoc o;
281         org.netbeans.modules.schema2beans.BaseBean n;
282         str.append(indent);
283         str.append("Role"); // NOI18N
284
str.append(indent+"\t"); // NOI18N
285
str.append("<"); // NOI18N
286
o = this.getRole();
287         str.append((o==null?"null":o.toString().trim())); // NOI18N
288
str.append(">\n"); // NOI18N
289
this.dumpAttributes(ROLE, 0, str, indent);
290         
291         str.append(indent);
292         str.append("Groups"); // NOI18N
293
str.append(indent+"\t"); // NOI18N
294
str.append("<"); // NOI18N
295
o = this.getGroups();
296         str.append((o==null?"null":o.toString().trim())); // NOI18N
297
str.append(">\n"); // NOI18N
298
this.dumpAttributes(GROUPS, 0, str, indent);
299         
300     }
301     public String JavaDoc dumpBeanNode(){
302         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
303         str.append(getClass().getName()); // NOI18N
304
this.dump(str, "\n "); // NOI18N
305
return str.toString();
306     }}
307
308 // END_NOI18N
309

310
Popular Tags