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.astrogrid.registry.beans.v10.resource.types.ResourceStatusType;
19 import org.exolab.castor.xml.MarshalException;
20 import org.exolab.castor.xml.Marshaller;
21 import org.exolab.castor.xml.Unmarshaller;
22 import org.exolab.castor.xml.ValidationException;
23 import org.xml.sax.ContentHandler;
24
25 /***
26 * Any entity that is describable and identifiable by a IVOA
27 * Identifier.
28 *
29 *
30 * @version $Revision: 1.2 $ $Date: 2007/01/04 16:26:24 $
31 */
32 public class Resource extends org.astrogrid.common.bean.BaseBean
33 implements java.io.Serializable
34 {
35
36
37
38
39
40
41 /***
42 * The date this resource metadata description was created.
43 *
44 */
45 private org.exolab.castor.types.Date _created;
46
47 /***
48 * The date this resource metadata description was last
49 * updated.
50 *
51 */
52 private org.exolab.castor.types.Date _updated;
53
54 /***
55 * a tag indicating whether this resource is believed to be
56 * still
57 * actively maintained.
58 *
59 */
60 private org.astrogrid.registry.beans.v10.resource.types.ResourceStatusType _status = org.astrogrid.registry.beans.v10.resource.types.ResourceStatusType.valueOf("active");
61
62 /***
63 * the full name given to the resource
64 *
65 */
66 private java.lang.String _title;
67
68 /***
69 * a short name or abbreviation given to the resource.
70 *
71 */
72 private java.lang.String _shortName;
73
74 /***
75 * Unambiguous reference to the resource conforming to the IVOA
76 * standard for identifiers
77 *
78 */
79 private java.lang.String _identifier;
80
81 /***
82 * Information regarding the general curation of the resource
83 *
84 */
85 private org.astrogrid.registry.beans.v10.resource.Curation _curation;
86
87 /***
88 * Information regarding the general content of the resource
89 *
90 */
91 private org.astrogrid.registry.beans.v10.resource.Content _content;
92
93
94
95
96
97
98 public Resource() {
99 super();
100 setStatus(org.astrogrid.registry.beans.v10.resource.types.ResourceStatusType.valueOf("active"));
101 }
102
103
104
105
106
107
108 /***
109 * Note: hashCode() has not been overriden
110 *
111 * @param obj
112 */
113 public boolean equals(java.lang.Object obj)
114 {
115 if ( this == obj )
116 return true;
117
118 if (super.equals(obj)==false)
119 return false;
120
121 if (obj instanceof Resource) {
122
123 Resource temp = (Resource)obj;
124 if (this._created != null) {
125 if (temp._created == null) return false;
126 else if (!(this._created.equals(temp._created)))
127 return false;
128 }
129 else if (temp._created != null)
130 return false;
131 if (this._updated != null) {
132 if (temp._updated == null) return false;
133 else if (!(this._updated.equals(temp._updated)))
134 return false;
135 }
136 else if (temp._updated != null)
137 return false;
138 if (this._status != null) {
139 if (temp._status == null) return false;
140 else if (!(this._status.equals(temp._status)))
141 return false;
142 }
143 else if (temp._status != null)
144 return false;
145 if (this._title != null) {
146 if (temp._title == null) return false;
147 else if (!(this._title.equals(temp._title)))
148 return false;
149 }
150 else if (temp._title != null)
151 return false;
152 if (this._shortName != null) {
153 if (temp._shortName == null) return false;
154 else if (!(this._shortName.equals(temp._shortName)))
155 return false;
156 }
157 else if (temp._shortName != null)
158 return false;
159 if (this._identifier != null) {
160 if (temp._identifier == null) return false;
161 else if (!(this._identifier.equals(temp._identifier)))
162 return false;
163 }
164 else if (temp._identifier != null)
165 return false;
166 if (this._curation != null) {
167 if (temp._curation == null) return false;
168 else if (!(this._curation.equals(temp._curation)))
169 return false;
170 }
171 else if (temp._curation != null)
172 return false;
173 if (this._content != null) {
174 if (temp._content == null) return false;
175 else if (!(this._content.equals(temp._content)))
176 return false;
177 }
178 else if (temp._content != null)
179 return false;
180 return true;
181 }
182 return false;
183 }
184
185 /***
186 * Returns the value of field 'content'. The field 'content'
187 * has the following description: Information regarding the
188 * general content of the resource
189 *
190 *
191 * @return the value of field 'content'.
192 */
193 public org.astrogrid.registry.beans.v10.resource.Content getContent()
194 {
195 return this._content;
196 }
197
198 /***
199 * Returns the value of field 'created'. The field 'created'
200 * has the following description: The date this resource
201 * metadata description was created.
202 *
203 *
204 * @return the value of field 'created'.
205 */
206 public org.exolab.castor.types.Date getCreated()
207 {
208 return this._created;
209 }
210
211 /***
212 * Returns the value of field 'curation'. The field 'curation'
213 * has the following description: Information regarding the
214 * general curation of the resource
215 *
216 *
217 * @return the value of field 'curation'.
218 */
219 public org.astrogrid.registry.beans.v10.resource.Curation getCuration()
220 {
221 return this._curation;
222 }
223
224 /***
225 * Returns the value of field 'identifier'. The field
226 * 'identifier' has the following description: Unambiguous
227 * reference to the resource conforming to the IVOA
228 * standard for identifiers
229 *
230 *
231 * @return the value of field 'identifier'.
232 */
233 public java.lang.String getIdentifier()
234 {
235 return this._identifier;
236 }
237
238 /***
239 * Returns the value of field 'shortName'. The field
240 * 'shortName' has the following description: a short name or
241 * abbreviation given to the resource.
242 *
243 *
244 * @return the value of field 'shortName'.
245 */
246 public java.lang.String getShortName()
247 {
248 return this._shortName;
249 }
250
251 /***
252 * Returns the value of field 'status'. The field 'status' has
253 * the following description: a tag indicating whether this
254 * resource is believed to be still
255 * actively maintained.
256 *
257 *
258 * @return the value of field 'status'.
259 */
260 public org.astrogrid.registry.beans.v10.resource.types.ResourceStatusType getStatus()
261 {
262 return this._status;
263 }
264
265 /***
266 * Returns the value of field 'title'. The field 'title' has
267 * the following description: the full name given to the
268 * resource
269 *
270 *
271 * @return the value of field 'title'.
272 */
273 public java.lang.String getTitle()
274 {
275 return this._title;
276 }
277
278 /***
279 * Returns the value of field 'updated'. The field 'updated'
280 * has the following description: The date this resource
281 * metadata description was last updated.
282 *
283 *
284 * @return the value of field 'updated'.
285 */
286 public org.exolab.castor.types.Date getUpdated()
287 {
288 return this._updated;
289 }
290
291 /***
292 * Method isValid
293 */
294 public boolean isValid()
295 {
296 try {
297 validate();
298 }
299 catch (org.exolab.castor.xml.ValidationException vex) {
300 return false;
301 }
302 return true;
303 }
304
305 /***
306 * Method marshal
307 *
308 * @param out
309 */
310 public void marshal(java.io.Writer out)
311 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
312 {
313
314 Marshaller.marshal(this, out);
315 }
316
317 /***
318 * Method marshal
319 *
320 * @param handler
321 */
322 public void marshal(org.xml.sax.ContentHandler handler)
323 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
324 {
325
326 Marshaller.marshal(this, handler);
327 }
328
329 /***
330 * Sets the value of field 'content'. The field 'content' has
331 * the following description: Information regarding the general
332 * content of the resource
333 *
334 *
335 * @param content the value of field 'content'.
336 */
337 public void setContent(org.astrogrid.registry.beans.v10.resource.Content content)
338 {
339 this._content = content;
340 }
341
342 /***
343 * Sets the value of field 'created'. The field 'created' has
344 * the following description: The date this resource metadata
345 * description was created.
346 *
347 *
348 * @param created the value of field 'created'.
349 */
350 public void setCreated(org.exolab.castor.types.Date created)
351 {
352 this._created = created;
353 }
354
355 /***
356 * Sets the value of field 'curation'. The field 'curation' has
357 * the following description: Information regarding the general
358 * curation of the resource
359 *
360 *
361 * @param curation the value of field 'curation'.
362 */
363 public void setCuration(org.astrogrid.registry.beans.v10.resource.Curation curation)
364 {
365 this._curation = curation;
366 }
367
368 /***
369 * Sets the value of field 'identifier'. The field 'identifier'
370 * has the following description: Unambiguous reference to the
371 * resource conforming to the IVOA
372 * standard for identifiers
373 *
374 *
375 * @param identifier the value of field 'identifier'.
376 */
377 public void setIdentifier(java.lang.String identifier)
378 {
379 this._identifier = identifier;
380 }
381
382 /***
383 * Sets the value of field 'shortName'. The field 'shortName'
384 * has the following description: a short name or abbreviation
385 * given to the resource.
386 *
387 *
388 * @param shortName the value of field 'shortName'.
389 */
390 public void setShortName(java.lang.String shortName)
391 {
392 this._shortName = shortName;
393 }
394
395 /***
396 * Sets the value of field 'status'. The field 'status' has the
397 * following description: a tag indicating whether this
398 * resource is believed to be still
399 * actively maintained.
400 *
401 *
402 * @param status the value of field 'status'.
403 */
404 public void setStatus(org.astrogrid.registry.beans.v10.resource.types.ResourceStatusType status)
405 {
406 this._status = status;
407 }
408
409 /***
410 * Sets the value of field 'title'. The field 'title' has the
411 * following description: the full name given to the resource
412 *
413 *
414 * @param title the value of field 'title'.
415 */
416 public void setTitle(java.lang.String title)
417 {
418 this._title = title;
419 }
420
421 /***
422 * Sets the value of field 'updated'. The field 'updated' has
423 * the following description: The date this resource metadata
424 * description was last updated.
425 *
426 *
427 * @param updated the value of field 'updated'.
428 */
429 public void setUpdated(org.exolab.castor.types.Date updated)
430 {
431 this._updated = updated;
432 }
433
434 /***
435 * Method unmarshalResource
436 *
437 * @param reader
438 */
439 public static org.astrogrid.registry.beans.v10.resource.Resource unmarshalResource(java.io.Reader reader)
440 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
441 {
442 return (org.astrogrid.registry.beans.v10.resource.Resource) Unmarshaller.unmarshal(org.astrogrid.registry.beans.v10.resource.Resource.class, reader);
443 }
444
445 /***
446 * Method validate
447 */
448 public void validate()
449 throws org.exolab.castor.xml.ValidationException
450 {
451 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
452 validator.validate(this);
453 }
454
455 }