1
2
3
4
5
6
7
8 package org.astrogrid.registry.beans.v10.resource;
9
10
11
12
13
14 import java.io.IOException;
15 import java.io.Reader;
16 import java.io.Serializable;
17 import java.io.Writer;
18 import org.exolab.castor.xml.MarshalException;
19 import org.exolab.castor.xml.Marshaller;
20 import org.exolab.castor.xml.Unmarshaller;
21 import org.exolab.castor.xml.ValidationException;
22 import org.xml.sax.ContentHandler;
23
24 /***
25 * Information that can be used for contacting someone
26 *
27 *
28 * @version $Revision: 1.2 $ $Date: 2007/01/04 16:26:24 $
29 */
30 public class Contact extends org.astrogrid.common.bean.BaseBean
31 implements java.io.Serializable
32 {
33
34
35
36
37
38
39 /***
40 * the name or title of the contact person.
41 *
42 */
43 private org.astrogrid.registry.beans.v10.resource.ResourceName _name;
44
45 /***
46 * the contact mailing address
47 */
48 private java.lang.String _address;
49
50 /***
51 * the contact email address
52 */
53 private java.lang.String _email;
54
55 /***
56 * the contact telephone number
57 */
58 private java.lang.String _telephone;
59
60
61
62
63
64
65 public Contact() {
66 super();
67 }
68
69
70
71
72
73
74 /***
75 * Note: hashCode() has not been overriden
76 *
77 * @param obj
78 */
79 public boolean equals(java.lang.Object obj)
80 {
81 if ( this == obj )
82 return true;
83
84 if (super.equals(obj)==false)
85 return false;
86
87 if (obj instanceof Contact) {
88
89 Contact temp = (Contact)obj;
90 if (this._name != null) {
91 if (temp._name == null) return false;
92 else if (!(this._name.equals(temp._name)))
93 return false;
94 }
95 else if (temp._name != null)
96 return false;
97 if (this._address != null) {
98 if (temp._address == null) return false;
99 else if (!(this._address.equals(temp._address)))
100 return false;
101 }
102 else if (temp._address != null)
103 return false;
104 if (this._email != null) {
105 if (temp._email == null) return false;
106 else if (!(this._email.equals(temp._email)))
107 return false;
108 }
109 else if (temp._email != null)
110 return false;
111 if (this._telephone != null) {
112 if (temp._telephone == null) return false;
113 else if (!(this._telephone.equals(temp._telephone)))
114 return false;
115 }
116 else if (temp._telephone != null)
117 return false;
118 return true;
119 }
120 return false;
121 }
122
123 /***
124 * Returns the value of field 'address'. The field 'address'
125 * has the following description: the contact mailing address
126 *
127 * @return the value of field 'address'.
128 */
129 public java.lang.String getAddress()
130 {
131 return this._address;
132 }
133
134 /***
135 * Returns the value of field 'email'. The field 'email' has
136 * the following description: the contact email address
137 *
138 * @return the value of field 'email'.
139 */
140 public java.lang.String getEmail()
141 {
142 return this._email;
143 }
144
145 /***
146 * Returns the value of field 'name'. The field 'name' has the
147 * following description: the name or title of the contact
148 * person.
149 *
150 *
151 * @return the value of field 'name'.
152 */
153 public org.astrogrid.registry.beans.v10.resource.ResourceName getName()
154 {
155 return this._name;
156 }
157
158 /***
159 * Returns the value of field 'telephone'. The field
160 * 'telephone' has the following description: the contact
161 * telephone number
162 *
163 * @return the value of field 'telephone'.
164 */
165 public java.lang.String getTelephone()
166 {
167 return this._telephone;
168 }
169
170 /***
171 * Method isValid
172 */
173 public boolean isValid()
174 {
175 try {
176 validate();
177 }
178 catch (org.exolab.castor.xml.ValidationException vex) {
179 return false;
180 }
181 return true;
182 }
183
184 /***
185 * Method marshal
186 *
187 * @param out
188 */
189 public void marshal(java.io.Writer out)
190 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
191 {
192
193 Marshaller.marshal(this, out);
194 }
195
196 /***
197 * Method marshal
198 *
199 * @param handler
200 */
201 public void marshal(org.xml.sax.ContentHandler handler)
202 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
203 {
204
205 Marshaller.marshal(this, handler);
206 }
207
208 /***
209 * Sets the value of field 'address'. The field 'address' has
210 * the following description: the contact mailing address
211 *
212 * @param address the value of field 'address'.
213 */
214 public void setAddress(java.lang.String address)
215 {
216 this._address = address;
217 }
218
219 /***
220 * Sets the value of field 'email'. The field 'email' has the
221 * following description: the contact email address
222 *
223 * @param email the value of field 'email'.
224 */
225 public void setEmail(java.lang.String email)
226 {
227 this._email = email;
228 }
229
230 /***
231 * Sets the value of field 'name'. The field 'name' has the
232 * following description: the name or title of the contact
233 * person.
234 *
235 *
236 * @param name the value of field 'name'.
237 */
238 public void setName(org.astrogrid.registry.beans.v10.resource.ResourceName name)
239 {
240 this._name = name;
241 }
242
243 /***
244 * Sets the value of field 'telephone'. The field 'telephone'
245 * has the following description: the contact telephone number
246 *
247 * @param telephone the value of field 'telephone'.
248 */
249 public void setTelephone(java.lang.String telephone)
250 {
251 this._telephone = telephone;
252 }
253
254 /***
255 * Method unmarshalContact
256 *
257 * @param reader
258 */
259 public static org.astrogrid.registry.beans.v10.resource.Contact unmarshalContact(java.io.Reader reader)
260 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
261 {
262 return (org.astrogrid.registry.beans.v10.resource.Contact) Unmarshaller.unmarshal(org.astrogrid.registry.beans.v10.resource.Contact.class, reader);
263 }
264
265 /***
266 * Method validate
267 */
268 public void validate()
269 throws org.exolab.castor.xml.ValidationException
270 {
271 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
272 validator.validate(this);
273 }
274
275 }