0339959920f245b649619b07f1104e44b8520eb3
[vamsas.git] / src / uk / ac / vamsas / objects / core / User.java
1 /*
2  * This class was automatically generated with 
3  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
4  * Schema.
5  * $Id$
6  */
7
8 package uk.ac.vamsas.objects.core;
9
10   //---------------------------------/
11  //- Imported classes and packages -/
12 //---------------------------------/
13
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
16
17 /**
18  * Class User.
19  * 
20  * @version $Revision$ $Date$
21  */
22 public class User extends uk.ac.vamsas.objects.core.AppData 
23 implements java.io.Serializable
24 {
25
26
27       //--------------------------/
28      //- Class/Member Variables -/
29     //--------------------------/
30
31     /**
32      * Field _fullname.
33      */
34     private java.lang.String _fullname;
35
36     /**
37      * Field _organization.
38      */
39     private java.lang.String _organization;
40
41
42       //----------------/
43      //- Constructors -/
44     //----------------/
45
46     public User() {
47         super();
48     }
49
50
51       //-----------/
52      //- Methods -/
53     //-----------/
54
55     /**
56      * Overrides the java.lang.Object.equals method.
57      * 
58      * @param obj
59      * @return true if the objects are equal.
60      */
61     public boolean equals(
62             final java.lang.Object obj) {
63         if ( this == obj )
64             return true;
65         
66         if (super.equals(obj)==false)
67             return false;
68         
69         if (obj instanceof User) {
70         
71             User temp = (User)obj;
72             boolean thcycle;
73             boolean tmcycle;
74             if (this._fullname != null) {
75                 if (temp._fullname == null) return false;
76                 if (this._fullname != temp._fullname) {
77                     thcycle=org.castor.util.CycleBreaker.startingToCycle(this._fullname);
78                     tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._fullname);
79                     if (thcycle!=tmcycle) {
80                         if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._fullname); };
81                         if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._fullname); };
82                         return false;
83                     }
84                     if (!thcycle) {
85                         if (!this._fullname.equals(temp._fullname)) {
86                             org.castor.util.CycleBreaker.releaseCycleHandle(this._fullname);
87                             org.castor.util.CycleBreaker.releaseCycleHandle(temp._fullname);
88                             return false;
89                         }
90                         org.castor.util.CycleBreaker.releaseCycleHandle(this._fullname);
91                         org.castor.util.CycleBreaker.releaseCycleHandle(temp._fullname);
92                     }
93                 }
94             } else if (temp._fullname != null)
95                 return false;
96             if (this._organization != null) {
97                 if (temp._organization == null) return false;
98                 if (this._organization != temp._organization) {
99                     thcycle=org.castor.util.CycleBreaker.startingToCycle(this._organization);
100                     tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._organization);
101                     if (thcycle!=tmcycle) {
102                         if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._organization); };
103                         if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._organization); };
104                         return false;
105                     }
106                     if (!thcycle) {
107                         if (!this._organization.equals(temp._organization)) {
108                             org.castor.util.CycleBreaker.releaseCycleHandle(this._organization);
109                             org.castor.util.CycleBreaker.releaseCycleHandle(temp._organization);
110                             return false;
111                         }
112                         org.castor.util.CycleBreaker.releaseCycleHandle(this._organization);
113                         org.castor.util.CycleBreaker.releaseCycleHandle(temp._organization);
114                     }
115                 }
116             } else if (temp._organization != null)
117                 return false;
118             return true;
119         }
120         return false;
121     }
122
123     /**
124      * Returns the value of field 'fullname'.
125      * 
126      * @return the value of field 'Fullname'.
127      */
128     public java.lang.String getFullname(
129     ) {
130         return this._fullname;
131     }
132
133     /**
134      * Returns the value of field 'organization'.
135      * 
136      * @return the value of field 'Organization'.
137      */
138     public java.lang.String getOrganization(
139     ) {
140         return this._organization;
141     }
142
143     /**
144      * Overrides the java.lang.Object.hashCode method.
145      * <p>
146      * The following steps came from <b>Effective Java Programming
147      * Language Guide</b> by Joshua Bloch, Chapter 3
148      * 
149      * @return a hash code value for the object.
150      */
151     public int hashCode(
152     ) {
153         int result = super.hashCode();
154         
155         long tmp;
156         if (_fullname != null
157             && !org.castor.util.CycleBreaker.startingToCycle(_fullname)) {
158            result = 37 * result + _fullname.hashCode();
159            org.castor.util.CycleBreaker.releaseCycleHandle(_fullname);
160         }
161         if (_organization != null
162             && !org.castor.util.CycleBreaker.startingToCycle(_organization)) {
163            result = 37 * result + _organization.hashCode();
164            org.castor.util.CycleBreaker.releaseCycleHandle(_organization);
165         }
166         
167         return result;
168     }
169
170     /**
171      * Method isValid.
172      * 
173      * @return true if this object is valid according to the schema
174      */
175     public boolean isValid(
176     ) {
177         try {
178             validate();
179         } catch (org.exolab.castor.xml.ValidationException vex) {
180             return false;
181         }
182         return true;
183     }
184
185     /**
186      * 
187      * 
188      * @param out
189      * @throws org.exolab.castor.xml.MarshalException if object is
190      * null or if any SAXException is thrown during marshaling
191      * @throws org.exolab.castor.xml.ValidationException if this
192      * object is an invalid instance according to the schema
193      */
194     public void marshal(
195             final java.io.Writer out)
196     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
197         Marshaller.marshal(this, out);
198     }
199
200     /**
201      * 
202      * 
203      * @param handler
204      * @throws java.io.IOException if an IOException occurs during
205      * marshaling
206      * @throws org.exolab.castor.xml.ValidationException if this
207      * object is an invalid instance according to the schema
208      * @throws org.exolab.castor.xml.MarshalException if object is
209      * null or if any SAXException is thrown during marshaling
210      */
211     public void marshal(
212             final org.xml.sax.ContentHandler handler)
213     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
214         Marshaller.marshal(this, handler);
215     }
216
217     /**
218      * Sets the value of field 'fullname'.
219      * 
220      * @param fullname the value of field 'fullname'.
221      */
222     public void setFullname(
223             final java.lang.String fullname) {
224         this._fullname = fullname;
225     }
226
227     /**
228      * Sets the value of field 'organization'.
229      * 
230      * @param organization the value of field 'organization'.
231      */
232     public void setOrganization(
233             final java.lang.String organization) {
234         this._organization = organization;
235     }
236
237     /**
238      * Method unmarshal.
239      * 
240      * @param reader
241      * @throws org.exolab.castor.xml.MarshalException if object is
242      * null or if any SAXException is thrown during marshaling
243      * @throws org.exolab.castor.xml.ValidationException if this
244      * object is an invalid instance according to the schema
245      * @return the unmarshaled uk.ac.vamsas.objects.core.AppData
246      */
247     public static uk.ac.vamsas.objects.core.AppData unmarshal(
248             final java.io.Reader reader)
249     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
250         return (uk.ac.vamsas.objects.core.AppData) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.User.class, reader);
251     }
252
253     /**
254      * 
255      * 
256      * @throws org.exolab.castor.xml.ValidationException if this
257      * object is an invalid instance according to the schema
258      */
259     public void validate(
260     )
261     throws org.exolab.castor.xml.ValidationException {
262         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
263         validator.validate(this);
264     }
265
266 }