2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
8 package org.vamsas.objects.core;
10 //---------------------------------/
11 //- Imported classes and packages -/
12 //---------------------------------/
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;
27 * Class ApplicationData.
29 * @version $Revision$ $Date$
31 public class ApplicationData extends org.vamsas.objects.core.AppData
32 implements java.io.Serializable
36 //--------------------------/
37 //- Class/Member Variables -/
38 //--------------------------/
41 * Version string describing the application specific data
42 * storage version used
44 private java.lang.String _version;
47 * Canonical name of application
50 private java.lang.String _name;
55 private java.util.Vector _userList;
60 private org.vamsas.objects.core.Common _common;
65 private java.util.Vector _instanceList;
72 public ApplicationData()
75 _userList = new Vector();
76 _instanceList = new Vector();
77 } //-- org.vamsas.objects.core.ApplicationData()
91 public void addInstance(org.vamsas.objects.core.Instance vInstance)
92 throws java.lang.IndexOutOfBoundsException
94 _instanceList.addElement(vInstance);
95 } //-- void addInstance(org.vamsas.objects.core.Instance)
105 public void addInstance(int index, org.vamsas.objects.core.Instance vInstance)
106 throws java.lang.IndexOutOfBoundsException
108 _instanceList.insertElementAt(vInstance, index);
109 } //-- void addInstance(int, org.vamsas.objects.core.Instance)
118 public void addUser(org.vamsas.objects.core.User vUser)
119 throws java.lang.IndexOutOfBoundsException
121 _userList.addElement(vUser);
122 } //-- void addUser(org.vamsas.objects.core.User)
132 public void addUser(int index, org.vamsas.objects.core.User vUser)
133 throws java.lang.IndexOutOfBoundsException
135 _userList.insertElementAt(vUser, index);
136 } //-- void addUser(int, org.vamsas.objects.core.User)
139 * Method enumerateInstance
143 * @return Enumeration
145 public java.util.Enumeration enumerateInstance()
147 return _instanceList.elements();
148 } //-- java.util.Enumeration enumerateInstance()
151 * Method enumerateUser
155 * @return Enumeration
157 public java.util.Enumeration enumerateUser()
159 return _userList.elements();
160 } //-- java.util.Enumeration enumerateUser()
163 * Note: hashCode() has not been overriden
168 public boolean equals(java.lang.Object obj)
173 if (super.equals(obj)==false)
176 if (obj instanceof ApplicationData) {
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)))
184 else if (temp._version != null)
186 if (this._name != null) {
187 if (temp._name == null) return false;
188 else if (!(this._name.equals(temp._name)))
191 else if (temp._name != null)
193 if (this._userList != null) {
194 if (temp._userList == null) return false;
195 else if (!(this._userList.equals(temp._userList)))
198 else if (temp._userList != null)
200 if (this._common != null) {
201 if (temp._common == null) return false;
202 else if (!(this._common.equals(temp._common)))
205 else if (temp._common != null)
207 if (this._instanceList != null) {
208 if (temp._instanceList == null) return false;
209 else if (!(this._instanceList.equals(temp._instanceList)))
212 else if (temp._instanceList != null)
217 } //-- boolean equals(java.lang.Object)
220 * Returns the value of field 'common'.
223 * @return the value of field 'common'.
225 public org.vamsas.objects.core.Common getCommon()
228 } //-- org.vamsas.objects.core.Common getCommon()
238 public org.vamsas.objects.core.Instance getInstance(int index)
239 throws java.lang.IndexOutOfBoundsException
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()+ "]");
246 return (org.vamsas.objects.core.Instance) _instanceList.elementAt(index);
247 } //-- org.vamsas.objects.core.Instance getInstance(int)
256 public org.vamsas.objects.core.Instance[] getInstance()
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);
264 } //-- org.vamsas.objects.core.Instance[] getInstance()
267 * Method getInstanceCount
273 public int getInstanceCount()
275 return _instanceList.size();
276 } //-- int getInstanceCount()
279 * Returns the value of field 'name'. The field 'name' has the
280 * following description: Canonical name of application
284 * @return the value of field 'name'.
286 public java.lang.String getName()
289 } //-- java.lang.String getName()
299 public org.vamsas.objects.core.User getUser(int index)
300 throws java.lang.IndexOutOfBoundsException
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()+ "]");
307 return (org.vamsas.objects.core.User) _userList.elementAt(index);
308 } //-- org.vamsas.objects.core.User getUser(int)
317 public org.vamsas.objects.core.User[] getUser()
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);
325 } //-- org.vamsas.objects.core.User[] getUser()
328 * Method getUserCount
334 public int getUserCount()
336 return _userList.size();
337 } //-- int getUserCount()
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
345 * @return the value of field 'version'.
347 public java.lang.String getVersion()
349 return this._version;
350 } //-- java.lang.String getVersion()
359 public boolean isValid()
364 catch (org.exolab.castor.xml.ValidationException vex) {
368 } //-- boolean isValid()
377 public void marshal(java.io.Writer out)
378 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
381 Marshaller.marshal(this, out);
382 } //-- void marshal(java.io.Writer)
391 public void marshal(org.xml.sax.ContentHandler handler)
392 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
395 Marshaller.marshal(this, handler);
396 } //-- void marshal(org.xml.sax.ContentHandler)
399 * Method removeAllInstance
402 public void removeAllInstance()
404 _instanceList.removeAllElements();
405 } //-- void removeAllInstance()
408 * Method removeAllUser
411 public void removeAllUser()
413 _userList.removeAllElements();
414 } //-- void removeAllUser()
417 * Method removeInstance
424 public org.vamsas.objects.core.Instance removeInstance(int index)
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)
439 public org.vamsas.objects.core.User removeUser(int index)
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)
447 * Sets the value of field 'common'.
449 * @param common the value of field 'common'.
451 public void setCommon(org.vamsas.objects.core.Common common)
453 this._common = common;
454 } //-- void setCommon(org.vamsas.objects.core.Common)
464 public void setInstance(int index, org.vamsas.objects.core.Instance vInstance)
465 throws java.lang.IndexOutOfBoundsException
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()+ "]");
471 _instanceList.setElementAt(vInstance, index);
472 } //-- void setInstance(int, org.vamsas.objects.core.Instance)
479 * @param instanceArray
481 public void setInstance(org.vamsas.objects.core.Instance[] instanceArray)
484 _instanceList.removeAllElements();
485 for (int i = 0; i < instanceArray.length; i++) {
486 _instanceList.addElement(instanceArray[i]);
488 } //-- void setInstance(org.vamsas.objects.core.Instance)
491 * Sets the value of field 'name'. The field 'name' has the
492 * following description: Canonical name of application
495 * @param name the value of field 'name'.
497 public void setName(java.lang.String name)
500 } //-- void setName(java.lang.String)
510 public void setUser(int index, org.vamsas.objects.core.User vUser)
511 throws java.lang.IndexOutOfBoundsException
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()+ "]");
517 _userList.setElementAt(vUser, index);
518 } //-- void setUser(int, org.vamsas.objects.core.User)
527 public void setUser(org.vamsas.objects.core.User[] userArray)
530 _userList.removeAllElements();
531 for (int i = 0; i < userArray.length; i++) {
532 _userList.addElement(userArray[i]);
534 } //-- void setUser(org.vamsas.objects.core.User)
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
541 * @param version the value of field 'version'.
543 public void setVersion(java.lang.String version)
545 this._version = version;
546 } //-- void setVersion(java.lang.String)
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
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)
566 public void validate()
567 throws org.exolab.castor.xml.ValidationException
569 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
570 validator.validate(this);
571 } //-- void validate()