autogenerated java classes for current schema
[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      * Version string describing the application specific data
42      * storage version used
43      */
44     private java.lang.String _version;
45
46     /**
47      * Canonical name of application
48      *  
49      */
50     private java.lang.String _name;
51
52     /**
53      * Field _userList
54      */
55     private java.util.Vector _userList;
56
57     /**
58      * Field _common
59      */
60     private org.vamsas.objects.core.Common _common;
61
62     /**
63      * Field _instanceList
64      */
65     private java.util.Vector _instanceList;
66
67
68       //----------------/
69      //- Constructors -/
70     //----------------/
71
72     public ApplicationData() 
73      {
74         super();
75         _userList = new Vector();
76         _instanceList = new Vector();
77     } //-- org.vamsas.objects.core.ApplicationData()
78
79
80       //-----------/
81      //- Methods -/
82     //-----------/
83
84     /**
85      * Method addInstance
86      * 
87      * 
88      * 
89      * @param vInstance
90      */
91     public void addInstance(org.vamsas.objects.core.Instance vInstance)
92         throws java.lang.IndexOutOfBoundsException
93     {
94         _instanceList.addElement(vInstance);
95     } //-- void addInstance(org.vamsas.objects.core.Instance) 
96
97     /**
98      * Method addInstance
99      * 
100      * 
101      * 
102      * @param index
103      * @param vInstance
104      */
105     public void addInstance(int index, org.vamsas.objects.core.Instance vInstance)
106         throws java.lang.IndexOutOfBoundsException
107     {
108         _instanceList.insertElementAt(vInstance, index);
109     } //-- void addInstance(int, org.vamsas.objects.core.Instance) 
110
111     /**
112      * Method addUser
113      * 
114      * 
115      * 
116      * @param vUser
117      */
118     public void addUser(org.vamsas.objects.core.User vUser)
119         throws java.lang.IndexOutOfBoundsException
120     {
121         _userList.addElement(vUser);
122     } //-- void addUser(org.vamsas.objects.core.User) 
123
124     /**
125      * Method addUser
126      * 
127      * 
128      * 
129      * @param index
130      * @param vUser
131      */
132     public void addUser(int index, org.vamsas.objects.core.User vUser)
133         throws java.lang.IndexOutOfBoundsException
134     {
135         _userList.insertElementAt(vUser, index);
136     } //-- void addUser(int, org.vamsas.objects.core.User) 
137
138     /**
139      * Method enumerateInstance
140      * 
141      * 
142      * 
143      * @return Enumeration
144      */
145     public java.util.Enumeration enumerateInstance()
146     {
147         return _instanceList.elements();
148     } //-- java.util.Enumeration enumerateInstance() 
149
150     /**
151      * Method enumerateUser
152      * 
153      * 
154      * 
155      * @return Enumeration
156      */
157     public java.util.Enumeration enumerateUser()
158     {
159         return _userList.elements();
160     } //-- java.util.Enumeration enumerateUser() 
161
162     /**
163      * Note: hashCode() has not been overriden
164      * 
165      * @param obj
166      * @return boolean
167      */
168     public boolean equals(java.lang.Object obj)
169     {
170         if ( this == obj )
171             return true;
172         
173         if (super.equals(obj)==false)
174             return false;
175         
176         if (obj instanceof ApplicationData) {
177         
178             ApplicationData temp = (ApplicationData)obj;
179             if (this._version != null) {
180                 if (temp._version == null) return false;
181                 else if (!(this._version.equals(temp._version))) 
182                     return false;
183             }
184             else if (temp._version != null)
185                 return false;
186             if (this._name != null) {
187                 if (temp._name == null) return false;
188                 else if (!(this._name.equals(temp._name))) 
189                     return false;
190             }
191             else if (temp._name != null)
192                 return false;
193             if (this._userList != null) {
194                 if (temp._userList == null) return false;
195                 else if (!(this._userList.equals(temp._userList))) 
196                     return false;
197             }
198             else if (temp._userList != null)
199                 return false;
200             if (this._common != null) {
201                 if (temp._common == null) return false;
202                 else if (!(this._common.equals(temp._common))) 
203                     return false;
204             }
205             else if (temp._common != null)
206                 return false;
207             if (this._instanceList != null) {
208                 if (temp._instanceList == null) return false;
209                 else if (!(this._instanceList.equals(temp._instanceList))) 
210                     return false;
211             }
212             else if (temp._instanceList != null)
213                 return false;
214             return true;
215         }
216         return false;
217     } //-- boolean equals(java.lang.Object) 
218
219     /**
220      * Returns the value of field 'common'.
221      * 
222      * @return Common
223      * @return the value of field 'common'.
224      */
225     public org.vamsas.objects.core.Common getCommon()
226     {
227         return this._common;
228     } //-- org.vamsas.objects.core.Common getCommon() 
229
230     /**
231      * Method getInstance
232      * 
233      * 
234      * 
235      * @param index
236      * @return Instance
237      */
238     public org.vamsas.objects.core.Instance getInstance(int index)
239         throws java.lang.IndexOutOfBoundsException
240     {
241         //-- check bounds for index
242         if ((index < 0) || (index > _instanceList.size())) {
243             throw new IndexOutOfBoundsException("getInstance: Index value '"+index+"' not in range [0.."+_instanceList.size()+ "]");
244         }
245         
246         return (org.vamsas.objects.core.Instance) _instanceList.elementAt(index);
247     } //-- org.vamsas.objects.core.Instance getInstance(int) 
248
249     /**
250      * Method getInstance
251      * 
252      * 
253      * 
254      * @return Instance
255      */
256     public org.vamsas.objects.core.Instance[] getInstance()
257     {
258         int size = _instanceList.size();
259         org.vamsas.objects.core.Instance[] mArray = new org.vamsas.objects.core.Instance[size];
260         for (int index = 0; index < size; index++) {
261             mArray[index] = (org.vamsas.objects.core.Instance) _instanceList.elementAt(index);
262         }
263         return mArray;
264     } //-- org.vamsas.objects.core.Instance[] getInstance() 
265
266     /**
267      * Method getInstanceCount
268      * 
269      * 
270      * 
271      * @return int
272      */
273     public int getInstanceCount()
274     {
275         return _instanceList.size();
276     } //-- int getInstanceCount() 
277
278     /**
279      * Returns the value of field 'name'. The field 'name' has the
280      * following description: Canonical name of application
281      *  
282      * 
283      * @return String
284      * @return the value of field 'name'.
285      */
286     public java.lang.String getName()
287     {
288         return this._name;
289     } //-- java.lang.String getName() 
290
291     /**
292      * Method getUser
293      * 
294      * 
295      * 
296      * @param index
297      * @return User
298      */
299     public org.vamsas.objects.core.User getUser(int index)
300         throws java.lang.IndexOutOfBoundsException
301     {
302         //-- check bounds for index
303         if ((index < 0) || (index > _userList.size())) {
304             throw new IndexOutOfBoundsException("getUser: Index value '"+index+"' not in range [0.."+_userList.size()+ "]");
305         }
306         
307         return (org.vamsas.objects.core.User) _userList.elementAt(index);
308     } //-- org.vamsas.objects.core.User getUser(int) 
309
310     /**
311      * Method getUser
312      * 
313      * 
314      * 
315      * @return User
316      */
317     public org.vamsas.objects.core.User[] getUser()
318     {
319         int size = _userList.size();
320         org.vamsas.objects.core.User[] mArray = new org.vamsas.objects.core.User[size];
321         for (int index = 0; index < size; index++) {
322             mArray[index] = (org.vamsas.objects.core.User) _userList.elementAt(index);
323         }
324         return mArray;
325     } //-- org.vamsas.objects.core.User[] getUser() 
326
327     /**
328      * Method getUserCount
329      * 
330      * 
331      * 
332      * @return int
333      */
334     public int getUserCount()
335     {
336         return _userList.size();
337     } //-- int getUserCount() 
338
339     /**
340      * Returns the value of field 'version'. The field 'version'
341      * has the following description: Version string describing the
342      * application specific data storage version used
343      * 
344      * @return String
345      * @return the value of field 'version'.
346      */
347     public java.lang.String getVersion()
348     {
349         return this._version;
350     } //-- java.lang.String getVersion() 
351
352     /**
353      * Method isValid
354      * 
355      * 
356      * 
357      * @return boolean
358      */
359     public boolean isValid()
360     {
361         try {
362             validate();
363         }
364         catch (org.exolab.castor.xml.ValidationException vex) {
365             return false;
366         }
367         return true;
368     } //-- boolean isValid() 
369
370     /**
371      * Method marshal
372      * 
373      * 
374      * 
375      * @param out
376      */
377     public void marshal(java.io.Writer out)
378         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
379     {
380         
381         Marshaller.marshal(this, out);
382     } //-- void marshal(java.io.Writer) 
383
384     /**
385      * Method marshal
386      * 
387      * 
388      * 
389      * @param handler
390      */
391     public void marshal(org.xml.sax.ContentHandler handler)
392         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
393     {
394         
395         Marshaller.marshal(this, handler);
396     } //-- void marshal(org.xml.sax.ContentHandler) 
397
398     /**
399      * Method removeAllInstance
400      * 
401      */
402     public void removeAllInstance()
403     {
404         _instanceList.removeAllElements();
405     } //-- void removeAllInstance() 
406
407     /**
408      * Method removeAllUser
409      * 
410      */
411     public void removeAllUser()
412     {
413         _userList.removeAllElements();
414     } //-- void removeAllUser() 
415
416     /**
417      * Method removeInstance
418      * 
419      * 
420      * 
421      * @param index
422      * @return Instance
423      */
424     public org.vamsas.objects.core.Instance removeInstance(int index)
425     {
426         java.lang.Object obj = _instanceList.elementAt(index);
427         _instanceList.removeElementAt(index);
428         return (org.vamsas.objects.core.Instance) obj;
429     } //-- org.vamsas.objects.core.Instance removeInstance(int) 
430
431     /**
432      * Method removeUser
433      * 
434      * 
435      * 
436      * @param index
437      * @return User
438      */
439     public org.vamsas.objects.core.User removeUser(int index)
440     {
441         java.lang.Object obj = _userList.elementAt(index);
442         _userList.removeElementAt(index);
443         return (org.vamsas.objects.core.User) obj;
444     } //-- org.vamsas.objects.core.User removeUser(int) 
445
446     /**
447      * Sets the value of field 'common'.
448      * 
449      * @param common the value of field 'common'.
450      */
451     public void setCommon(org.vamsas.objects.core.Common common)
452     {
453         this._common = common;
454     } //-- void setCommon(org.vamsas.objects.core.Common) 
455
456     /**
457      * Method setInstance
458      * 
459      * 
460      * 
461      * @param index
462      * @param vInstance
463      */
464     public void setInstance(int index, org.vamsas.objects.core.Instance vInstance)
465         throws java.lang.IndexOutOfBoundsException
466     {
467         //-- check bounds for index
468         if ((index < 0) || (index > _instanceList.size())) {
469             throw new IndexOutOfBoundsException("setInstance: Index value '"+index+"' not in range [0.."+_instanceList.size()+ "]");
470         }
471         _instanceList.setElementAt(vInstance, index);
472     } //-- void setInstance(int, org.vamsas.objects.core.Instance) 
473
474     /**
475      * Method setInstance
476      * 
477      * 
478      * 
479      * @param instanceArray
480      */
481     public void setInstance(org.vamsas.objects.core.Instance[] instanceArray)
482     {
483         //-- copy array
484         _instanceList.removeAllElements();
485         for (int i = 0; i < instanceArray.length; i++) {
486             _instanceList.addElement(instanceArray[i]);
487         }
488     } //-- void setInstance(org.vamsas.objects.core.Instance) 
489
490     /**
491      * Sets the value of field 'name'. The field 'name' has the
492      * following description: Canonical name of application
493      *  
494      * 
495      * @param name the value of field 'name'.
496      */
497     public void setName(java.lang.String name)
498     {
499         this._name = name;
500     } //-- void setName(java.lang.String) 
501
502     /**
503      * Method setUser
504      * 
505      * 
506      * 
507      * @param index
508      * @param vUser
509      */
510     public void setUser(int index, org.vamsas.objects.core.User vUser)
511         throws java.lang.IndexOutOfBoundsException
512     {
513         //-- check bounds for index
514         if ((index < 0) || (index > _userList.size())) {
515             throw new IndexOutOfBoundsException("setUser: Index value '"+index+"' not in range [0.."+_userList.size()+ "]");
516         }
517         _userList.setElementAt(vUser, index);
518     } //-- void setUser(int, org.vamsas.objects.core.User) 
519
520     /**
521      * Method setUser
522      * 
523      * 
524      * 
525      * @param userArray
526      */
527     public void setUser(org.vamsas.objects.core.User[] userArray)
528     {
529         //-- copy array
530         _userList.removeAllElements();
531         for (int i = 0; i < userArray.length; i++) {
532             _userList.addElement(userArray[i]);
533         }
534     } //-- void setUser(org.vamsas.objects.core.User) 
535
536     /**
537      * Sets the value of field 'version'. The field 'version' has
538      * the following description: Version string describing the
539      * application specific data storage version used
540      * 
541      * @param version the value of field 'version'.
542      */
543     public void setVersion(java.lang.String version)
544     {
545         this._version = version;
546     } //-- void setVersion(java.lang.String) 
547
548     /**
549      * Method unmarshal
550      * 
551      * 
552      * 
553      * @param reader
554      * @return AppData
555      */
556     public static org.vamsas.objects.core.AppData unmarshal(java.io.Reader reader)
557         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
558     {
559         return (org.vamsas.objects.core.ApplicationData) Unmarshaller.unmarshal(org.vamsas.objects.core.ApplicationData.class, reader);
560     } //-- org.vamsas.objects.core.AppData unmarshal(java.io.Reader) 
561
562     /**
563      * Method validate
564      * 
565      */
566     public void validate()
567         throws org.exolab.castor.xml.ValidationException
568     {
569         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
570         validator.validate(this);
571     } //-- void validate() 
572
573 }