1
2
3
4
5
6
7
8 package org.astrogrid.registry.beans.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 * Class ResourceReferenceType.
26 *
27 * @version $Revision: 1.14 $ $Date: 2007/01/04 16:26:22 $
28 */
29 public class ResourceReferenceType extends org.astrogrid.common.bean.BaseBean
30 implements java.io.Serializable
31 {
32
33
34
35
36
37
38 /***
39 * Unambiguous reference to the resource conforming to the IVOA
40 * standard for identifiers
41 *
42 */
43 private org.astrogrid.registry.beans.resource.IdentifierType _identifier;
44
45 /***
46 * the full name of a resource
47 */
48 private java.lang.String _title;
49
50 /***
51 * An account of the nature of the resource
52 *
53 */
54 private java.lang.String _description;
55
56 /***
57 * URL pointing to a human-readable document describing this
58 * resource.
59 *
60 */
61 private java.lang.String _referenceURL;
62
63
64
65
66
67
68 public ResourceReferenceType() {
69 super();
70 }
71
72
73
74
75
76
77 /***
78 * Note: hashCode() has not been overriden
79 *
80 * @param obj
81 */
82 public boolean equals(java.lang.Object obj)
83 {
84 if ( this == obj )
85 return true;
86
87 if (super.equals(obj)==false)
88 return false;
89
90 if (obj instanceof ResourceReferenceType) {
91
92 ResourceReferenceType temp = (ResourceReferenceType)obj;
93 if (this._identifier != null) {
94 if (temp._identifier == null) return false;
95 else if (!(this._identifier.equals(temp._identifier)))
96 return false;
97 }
98 else if (temp._identifier != null)
99 return false;
100 if (this._title != null) {
101 if (temp._title == null) return false;
102 else if (!(this._title.equals(temp._title)))
103 return false;
104 }
105 else if (temp._title != null)
106 return false;
107 if (this._description != null) {
108 if (temp._description == null) return false;
109 else if (!(this._description.equals(temp._description)))
110 return false;
111 }
112 else if (temp._description != null)
113 return false;
114 if (this._referenceURL != null) {
115 if (temp._referenceURL == null) return false;
116 else if (!(this._referenceURL.equals(temp._referenceURL)))
117 return false;
118 }
119 else if (temp._referenceURL != null)
120 return false;
121 return true;
122 }
123 return false;
124 }
125
126 /***
127 * Returns the value of field 'description'. The field
128 * 'description' has the following description: An account of
129 * the nature of the resource
130 *
131 *
132 * @return the value of field 'description'.
133 */
134 public java.lang.String getDescription()
135 {
136 return this._description;
137 }
138
139 /***
140 * Returns the value of field 'identifier'. The field
141 * 'identifier' has the following description: Unambiguous
142 * reference to the resource conforming to the IVOA
143 * standard for identifiers
144 *
145 *
146 * @return the value of field 'identifier'.
147 */
148 public org.astrogrid.registry.beans.resource.IdentifierType getIdentifier()
149 {
150 return this._identifier;
151 }
152
153 /***
154 * Returns the value of field 'referenceURL'. The field
155 * 'referenceURL' has the following description: URL pointing
156 * to a human-readable document describing this
157 * resource.
158 *
159 *
160 * @return the value of field 'referenceURL'.
161 */
162 public java.lang.String getReferenceURL()
163 {
164 return this._referenceURL;
165 }
166
167 /***
168 * Returns the value of field 'title'. The field 'title' has
169 * the following description: the full name of a resource
170 *
171 * @return the value of field 'title'.
172 */
173 public java.lang.String getTitle()
174 {
175 return this._title;
176 }
177
178 /***
179 * Method isValid
180 */
181 public boolean isValid()
182 {
183 try {
184 validate();
185 }
186 catch (org.exolab.castor.xml.ValidationException vex) {
187 return false;
188 }
189 return true;
190 }
191
192 /***
193 * Method marshal
194 *
195 * @param out
196 */
197 public void marshal(java.io.Writer out)
198 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
199 {
200
201 Marshaller.marshal(this, out);
202 }
203
204 /***
205 * Method marshal
206 *
207 * @param handler
208 */
209 public void marshal(org.xml.sax.ContentHandler handler)
210 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
211 {
212
213 Marshaller.marshal(this, handler);
214 }
215
216 /***
217 * Sets the value of field 'description'. The field
218 * 'description' has the following description: An account of
219 * the nature of the resource
220 *
221 *
222 * @param description the value of field 'description'.
223 */
224 public void setDescription(java.lang.String description)
225 {
226 this._description = description;
227 }
228
229 /***
230 * Sets the value of field 'identifier'. The field 'identifier'
231 * has the following description: Unambiguous reference to the
232 * resource conforming to the IVOA
233 * standard for identifiers
234 *
235 *
236 * @param identifier the value of field 'identifier'.
237 */
238 public void setIdentifier(org.astrogrid.registry.beans.resource.IdentifierType identifier)
239 {
240 this._identifier = identifier;
241 }
242
243 /***
244 * Sets the value of field 'referenceURL'. The field
245 * 'referenceURL' has the following description: URL pointing
246 * to a human-readable document describing this
247 * resource.
248 *
249 *
250 * @param referenceURL the value of field 'referenceURL'.
251 */
252 public void setReferenceURL(java.lang.String referenceURL)
253 {
254 this._referenceURL = referenceURL;
255 }
256
257 /***
258 * Sets the value of field 'title'. The field 'title' has the
259 * following description: the full name of a resource
260 *
261 * @param title the value of field 'title'.
262 */
263 public void setTitle(java.lang.String title)
264 {
265 this._title = title;
266 }
267
268 /***
269 * Method unmarshalResourceReferenceType
270 *
271 * @param reader
272 */
273 public static org.astrogrid.registry.beans.resource.ResourceReferenceType unmarshalResourceReferenceType(java.io.Reader reader)
274 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
275 {
276 return (org.astrogrid.registry.beans.resource.ResourceReferenceType) Unmarshaller.unmarshal(org.astrogrid.registry.beans.resource.ResourceReferenceType.class, reader);
277 }
278
279 /***
280 * Method validate
281 */
282 public void validate()
283 throws org.exolab.castor.xml.ValidationException
284 {
285 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
286 validator.validate(this);
287 }
288
289 }