KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > dd > impl > transform > ModElement


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 2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 /**
20  * This generated bean class ModElement matches the schema element 'mod-element'.
21  * The root bean class is Transform
22  *
23  * Generated on Sat Aug 13 01:27:36 GMT-08:00 2005
24  * @Generated
25  */

26
27 package org.netbeans.modules.j2ee.sun.dd.impl.transform;
28
29 import org.w3c.dom.*;
30 import org.netbeans.modules.schema2beans.*;
31 import java.beans.*;
32 import java.util.*;
33
34 // BEGIN_NOI18N
35

36 public class ModElement extends org.netbeans.modules.schema2beans.BaseBean
37 {
38
39     static Vector comparators = new Vector();
40     private static final org.netbeans.modules.schema2beans.Version runtimeVersion = new org.netbeans.modules.schema2beans.Version(4, 2, 0);
41
42     static public final String JavaDoc NAME = "Name"; // NOI18N
43
static public final String JavaDoc MOD_ATTRIBUTE = "ModAttribute"; // NOI18N
44
static public final String JavaDoc SUB_ELEMENT = "SubElement"; // NOI18N
45

46     public ModElement() {
47         this(Common.USE_DEFAULT_VALUES);
48     }
49
50     public ModElement(int options)
51     {
52         super(comparators, runtimeVersion);
53         // Properties (see root bean comments for the bean graph)
54
initPropertyTables(3);
55         this.createProperty("name", // NOI18N
56
NAME,
57             Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY,
58             String JavaDoc.class);
59         this.createProperty("mod-attribute", // NOI18N
60
MOD_ATTRIBUTE,
61             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
62             ModAttribute.class);
63         this.createProperty("sub-element", // NOI18N
64
SUB_ELEMENT,
65             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
66             SubElement.class);
67         this.initialize(options);
68     }
69
70     // Setting the default values of the properties
71
void initialize(int options) {
72
73     }
74
75     // This attribute is mandatory
76
public void setName(String JavaDoc value) {
77         this.setValue(NAME, value);
78     }
79
80     //
81
public String JavaDoc getName() {
82         return (String JavaDoc)this.getValue(NAME);
83     }
84
85     // This attribute is an array, possibly empty
86
public void setModAttribute(int index, ModAttribute value) {
87         this.setValue(MOD_ATTRIBUTE, index, value);
88     }
89
90     //
91
public ModAttribute getModAttribute(int index) {
92         return (ModAttribute)this.getValue(MOD_ATTRIBUTE, index);
93     }
94
95     // Return the number of properties
96
public int sizeModAttribute() {
97         return this.size(MOD_ATTRIBUTE);
98     }
99
100     // This attribute is an array, possibly empty
101
public void setModAttribute(ModAttribute[] value) {
102         this.setValue(MOD_ATTRIBUTE, value);
103     }
104
105     //
106
public ModAttribute[] getModAttribute() {
107         return (ModAttribute[])this.getValues(MOD_ATTRIBUTE);
108     }
109
110     // Add a new element returning its index in the list
111
public int addModAttribute(ModAttribute value) {
112         int positionOfNewItem = this.addValue(MOD_ATTRIBUTE, value);
113         return positionOfNewItem;
114     }
115
116     //
117
// Remove an element using its reference
118
// Returns the index the element had in the list
119
//
120
public int removeModAttribute(ModAttribute value) {
121         return this.removeValue(MOD_ATTRIBUTE, value);
122     }
123
124     // This attribute is an array, possibly empty
125
public void setSubElement(int index, SubElement value) {
126         this.setValue(SUB_ELEMENT, index, value);
127     }
128
129     //
130
public SubElement getSubElement(int index) {
131         return (SubElement)this.getValue(SUB_ELEMENT, index);
132     }
133
134     // Return the number of properties
135
public int sizeSubElement() {
136         return this.size(SUB_ELEMENT);
137     }
138
139     // This attribute is an array, possibly empty
140
public void setSubElement(SubElement[] value) {
141         this.setValue(SUB_ELEMENT, value);
142     }
143
144     //
145
public SubElement[] getSubElement() {
146         return (SubElement[])this.getValues(SUB_ELEMENT);
147     }
148
149     // Add a new element returning its index in the list
150
public int addSubElement(SubElement value) {
151         int positionOfNewItem = this.addValue(SUB_ELEMENT, value);
152         return positionOfNewItem;
153     }
154
155     //
156
// Remove an element using its reference
157
// Returns the index the element had in the list
158
//
159
public int removeSubElement(SubElement value) {
160         return this.removeValue(SUB_ELEMENT, value);
161     }
162
163     /**
164      * Create a new bean using it's default constructor.
165      * This does not add it to any bean graph.
166      */

167     public ModAttribute newModAttribute() {
168         return new ModAttribute();
169     }
170
171     /**
172      * Create a new bean using it's default constructor.
173      * This does not add it to any bean graph.
174      */

175     public SubElement newSubElement() {
176         return new SubElement();
177     }
178
179     //
180
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
181         comparators.add(c);
182     }
183
184     //
185
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
186         comparators.remove(c);
187     }
188     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
189         boolean restrictionFailure = false;
190         boolean restrictionPassed = false;
191         // Validating property name
192
if (getName() == null) {
193             throw new org.netbeans.modules.schema2beans.ValidateException("getName() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, "name", this); // NOI18N
194
}
195         // Validating property modAttribute
196
for (int _index = 0; _index < sizeModAttribute(); ++_index) {
197             ModAttribute element = getModAttribute(_index);
198             if (element != null) {
199                 element.validate();
200             }
201         }
202         // Validating property subElement
203
for (int _index = 0; _index < sizeSubElement(); ++_index) {
204             SubElement element = getSubElement(_index);
205             if (element != null) {
206                 element.validate();
207             }
208         }
209     }
210
211     // Dump the content of this bean returning it as a String
212
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
213         String JavaDoc s;
214         Object JavaDoc o;
215         org.netbeans.modules.schema2beans.BaseBean n;
216         str.append(indent);
217         str.append("Name"); // NOI18N
218
str.append(indent+"\t"); // NOI18N
219
str.append("<"); // NOI18N
220
o = this.getName();
221         str.append((o==null?"null":o.toString().trim())); // NOI18N
222
str.append(">\n"); // NOI18N
223
this.dumpAttributes(NAME, 0, str, indent);
224
225         str.append(indent);
226         str.append("ModAttribute["+this.sizeModAttribute()+"]"); // NOI18N
227
for(int i=0; i<this.sizeModAttribute(); i++)
228         {
229             str.append(indent+"\t");
230             str.append("#"+i+":");
231             n = (org.netbeans.modules.schema2beans.BaseBean) this.getModAttribute(i);
232             if (n != null)
233                 n.dump(str, indent + "\t"); // NOI18N
234
else
235                 str.append(indent+"\tnull"); // NOI18N
236
this.dumpAttributes(MOD_ATTRIBUTE, i, str, indent);
237         }
238
239         str.append(indent);
240         str.append("SubElement["+this.sizeSubElement()+"]"); // NOI18N
241
for(int i=0; i<this.sizeSubElement(); i++)
242         {
243             str.append(indent+"\t");
244             str.append("#"+i+":");
245             n = (org.netbeans.modules.schema2beans.BaseBean) this.getSubElement(i);
246             if (n != null)
247                 n.dump(str, indent + "\t"); // NOI18N
248
else
249                 str.append(indent+"\tnull"); // NOI18N
250
this.dumpAttributes(SUB_ELEMENT, i, str, indent);
251         }
252
253     }
254     public String JavaDoc dumpBeanNode(){
255         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
256         str.append("ModElement\n"); // NOI18N
257
this.dump(str, "\n "); // NOI18N
258
return str.toString();
259     }}
260
261 // END_NOI18N
262

263
264 /*
265         The following schema file has been used for generation:
266
267
268 <!--- Put your DTDDoc comment here. -->
269 <!ELEMENT transform (xmltype)*>
270
271 <!--- xmltype : target version of the server xml -->
272 <!ELEMENT xmltype (name, mod-element*)>
273
274 <!--- Put your DTDDoc comment here. -->
275 <!ELEMENT name (#PCDATA)>
276
277 <!--- mod-element : element that contains sub-elements and attributes that need to be removed
278       ie. sub-elements and attributes that were added in a later version of server xml -->
279 <!ELEMENT mod-element (name, mod-attribute*, sub-element*)>
280
281 <!--- sub-element : sub-elements that need to be removed -->
282 <!ELEMENT sub-element (name)>
283
284 <!--- new-attribute : attribute that need to be removed -->
285 <!ELEMENT mod-attribute (name)>
286
287
288 */

289
Popular Tags