37f374d52447f9a6fd4fee7fb8f19d4b7c242a8d
[vamsas.git] / src / org / vamsas / objects / core / ApplicationData.java
1 /*
2  * This class was automatically generated with 
3  * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
4  * Schema.
5  * $Id$
6  */
7
8 package org.vamsas.objects.core;
9
10   //---------------------------------/
11  //- Imported classes and packages -/
12 //---------------------------------/
13
14 import java.io.IOException;
15 import java.io.Reader;
16 import java.io.Serializable;
17 import java.io.Writer;
18 import java.util.Enumeration;
19 import java.util.Vector;
20 import org.exolab.castor.xml.MarshalException;
21 import org.exolab.castor.xml.Marshaller;
22 import org.exolab.castor.xml.Unmarshaller;
23 import org.exolab.castor.xml.ValidationException;
24 import org.xml.sax.ContentHandler;
25
26 /**
27  * Class ApplicationData.
28  * 
29  * @version $Revision$ $Date$
30  */
31 public class ApplicationData extends org.vamsas.objects.core.AppData 
32 implements java.io.Serializable
33 {
34
35
36       //--------------------------/
37      //- Class/Member Variables -/
38     //--------------------------/
39
40     /**
41      * Field _version
42      */
43     private java.lang.String _version;
44
45     /**
46      * Field _name
47      */
48     private java.lang.String _name;
49
50     /**
51      * Field _urn
52      */
53     private java.lang.String _urn;
54
55     /**
56      * Field _userList
57      */
58     private java.util.Vector _userList;
59
60
61       //----------------/
62      //- Constructors -/
63     //----------------/
64
65     public ApplicationData() 
66      {
67         super();
68         _userList = new Vector();
69     } //-- org.vamsas.objects.core.ApplicationData()
70
71
72       //-----------/
73      //- Methods -/
74     //-----------/
75
76     /**
77      * Method addUser
78      * 
79      * 
80      * 
81      * @param vUser
82      */
83     public void addUser(org.vamsas.objects.core.User vUser)
84         throws java.lang.IndexOutOfBoundsException
85     {
86         _userList.addElement(vUser);
87     } //-- void addUser(org.vamsas.objects.core.User) 
88
89     /**
90      * Method addUser
91      * 
92      * 
93      * 
94      * @param index
95      * @param vUser
96      */
97     public void addUser(int index, org.vamsas.objects.core.User vUser)
98         throws java.lang.IndexOutOfBoundsException
99     {
100         _userList.insertElementAt(vUser, index);
101     } //-- void addUser(int, org.vamsas.objects.core.User) 
102
103     /**
104      * Method enumerateUser
105      * 
106      * 
107      * 
108      * @return Enumeration
109      */
110     public java.util.Enumeration enumerateUser()
111     {
112         return _userList.elements();
113     } //-- java.util.Enumeration enumerateUser() 
114
115     /**
116      * Note: hashCode() has not been overriden
117      * 
118      * @param obj
119      * @return boolean
120      */
121     public boolean equals(java.lang.Object obj)
122     {
123         if ( this == obj )
124             return true;
125         
126         if (super.equals(obj)==false)
127             return false;
128         
129         if (obj instanceof ApplicationData) {
130         
131             ApplicationData temp = (ApplicationData)obj;
132             if (this._version != null) {
133                 if (temp._version == null) return false;
134                 else if (!(this._version.equals(temp._version))) 
135                     return false;
136             }
137             else if (temp._version != null)
138                 return false;
139             if (this._name != null) {
140                 if (temp._name == null) return false;
141                 else if (!(this._name.equals(temp._name))) 
142                     return false;
143             }
144             else if (temp._name != null)
145                 return false;
146             if (this._urn != null) {
147                 if (temp._urn == null) return false;
148                 else if (!(this._urn.equals(temp._urn))) 
149                     return false;
150             }
151             else if (temp._urn != null)
152                 return false;
153             if (this._userList != null) {
154                 if (temp._userList == null) return false;
155                 else if (!(this._userList.equals(temp._userList))) 
156                     return false;
157             }
158             else if (temp._userList != null)
159                 return false;
160             return true;
161         }
162         return false;
163     } //-- boolean equals(java.lang.Object) 
164
165     /**
166      * Returns the value of field 'name'.
167      * 
168      * @return String
169      * @return the value of field 'name'.
170      */
171     public java.lang.String getName()
172     {
173         return this._name;
174     } //-- java.lang.String getName() 
175
176     /**
177      * Returns the value of field 'urn'.
178      * 
179      * @return String
180      * @return the value of field 'urn'.
181      */
182     public java.lang.String getUrn()
183     {
184         return this._urn;
185     } //-- java.lang.String getUrn() 
186
187     /**
188      * Method getUser
189      * 
190      * 
191      * 
192      * @param index
193      * @return User
194      */
195     public org.vamsas.objects.core.User getUser(int index)
196         throws java.lang.IndexOutOfBoundsException
197     {
198         //-- check bounds for index
199         if ((index < 0) || (index > _userList.size())) {
200             throw new IndexOutOfBoundsException("getUser: Index value '"+index+"' not in range [0.."+_userList.size()+ "]");
201         }
202         
203         return (org.vamsas.objects.core.User) _userList.elementAt(index);
204     } //-- org.vamsas.objects.core.User getUser(int) 
205
206     /**
207      * Method getUser
208      * 
209      * 
210      * 
211      * @return User
212      */
213     public org.vamsas.objects.core.User[] getUser()
214     {
215         int size = _userList.size();
216         org.vamsas.objects.core.User[] mArray = new org.vamsas.objects.core.User[size];
217         for (int index = 0; index < size; index++) {
218             mArray[index] = (org.vamsas.objects.core.User) _userList.elementAt(index);
219         }
220         return mArray;
221     } //-- org.vamsas.objects.core.User[] getUser() 
222
223     /**
224      * Method getUserCount
225      * 
226      * 
227      * 
228      * @return int
229      */
230     public int getUserCount()
231     {
232         return _userList.size();
233     } //-- int getUserCount() 
234
235     /**
236      * Returns the value of field 'version'.
237      * 
238      * @return String
239      * @return the value of field 'version'.
240      */
241     public java.lang.String getVersion()
242     {
243         return this._version;
244     } //-- java.lang.String getVersion() 
245
246     /**
247      * Method isValid
248      * 
249      * 
250      * 
251      * @return boolean
252      */
253     public boolean isValid()
254     {
255         try {
256             validate();
257         }
258         catch (org.exolab.castor.xml.ValidationException vex) {
259             return false;
260         }
261         return true;
262     } //-- boolean isValid() 
263
264     /**
265      * Method marshal
266      * 
267      * 
268      * 
269      * @param out
270      */
271     public void marshal(java.io.Writer out)
272         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
273     {
274         
275         Marshaller.marshal(this, out);
276     } //-- void marshal(java.io.Writer) 
277
278     /**
279      * Method marshal
280      * 
281      * 
282      * 
283      * @param handler
284      */
285     public void marshal(org.xml.sax.ContentHandler handler)
286         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
287     {
288         
289         Marshaller.marshal(this, handler);
290     } //-- void marshal(org.xml.sax.ContentHandler) 
291
292     /**
293      * Method removeAllUser
294      * 
295      */
296     public void removeAllUser()
297     {
298         _userList.removeAllElements();
299     } //-- void removeAllUser() 
300
301     /**
302      * Method removeUser
303      * 
304      * 
305      * 
306      * @param index
307      * @return User
308      */
309     public org.vamsas.objects.core.User removeUser(int index)
310     {
311         java.lang.Object obj = _userList.elementAt(index);
312         _userList.removeElementAt(index);
313         return (org.vamsas.objects.core.User) obj;
314     } //-- org.vamsas.objects.core.User removeUser(int) 
315
316     /**
317      * Sets the value of field 'name'.
318      * 
319      * @param name the value of field 'name'.
320      */
321     public void setName(java.lang.String name)
322     {
323         this._name = name;
324     } //-- void setName(java.lang.String) 
325
326     /**
327      * Sets the value of field 'urn'.
328      * 
329      * @param urn the value of field 'urn'.
330      */
331     public void setUrn(java.lang.String urn)
332     {
333         this._urn = urn;
334     } //-- void setUrn(java.lang.String) 
335
336     /**
337      * Method setUser
338      * 
339      * 
340      * 
341      * @param index
342      * @param vUser
343      */
344     public void setUser(int index, org.vamsas.objects.core.User vUser)
345         throws java.lang.IndexOutOfBoundsException
346     {
347         //-- check bounds for index
348         if ((index < 0) || (index > _userList.size())) {
349             throw new IndexOutOfBoundsException("setUser: Index value '"+index+"' not in range [0.."+_userList.size()+ "]");
350         }
351         _userList.setElementAt(vUser, index);
352     } //-- void setUser(int, org.vamsas.objects.core.User) 
353
354     /**
355      * Method setUser
356      * 
357      * 
358      * 
359      * @param userArray
360      */
361     public void setUser(org.vamsas.objects.core.User[] userArray)
362     {
363         //-- copy array
364         _userList.removeAllElements();
365         for (int i = 0; i < userArray.length; i++) {
366             _userList.addElement(userArray[i]);
367         }
368     } //-- void setUser(org.vamsas.objects.core.User) 
369
370     /**
371      * Sets the value of field 'version'.
372      * 
373      * @param version the value of field 'version'.
374      */
375     public void setVersion(java.lang.String version)
376     {
377         this._version = version;
378     } //-- void setVersion(java.lang.String) 
379
380     /**
381      * Method unmarshal
382      * 
383      * 
384      * 
385      * @param reader
386      * @return AppData
387      */
388     public static org.vamsas.objects.core.AppData unmarshal(java.io.Reader reader)
389         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
390     {
391         return (org.vamsas.objects.core.ApplicationData) Unmarshaller.unmarshal(org.vamsas.objects.core.ApplicationData.class, reader);
392     } //-- org.vamsas.objects.core.AppData unmarshal(java.io.Reader) 
393
394     /**
395      * Method validate
396      * 
397      */
398     public void validate()
399         throws org.exolab.castor.xml.ValidationException
400     {
401         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
402         validator.validate(this);
403     } //-- void validate() 
404
405 }