1
2
3
4
5
6
7
8 package org.astrogrid.registry.beans.resource.votable;
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 java.util.ArrayList;
19 import java.util.Enumeration;
20 import org.astrogrid.registry.beans.resource.votable.types.VOTABLEVersionType;
21 import org.exolab.castor.xml.MarshalException;
22 import org.exolab.castor.xml.Marshaller;
23 import org.exolab.castor.xml.Unmarshaller;
24 import org.exolab.castor.xml.ValidationException;
25 import org.xml.sax.ContentHandler;
26
27 /***
28 * Class VOTABLE.
29 *
30 * @version $Revision: 1.14 $ $Date: 2007/01/04 16:26:13 $
31 */
32 public class VOTABLE extends org.astrogrid.common.bean.BaseBean
33 implements java.io.Serializable
34 {
35
36
37
38
39
40
41 /***
42 * Field _ID
43 */
44 private java.lang.String _ID;
45
46 /***
47 * Field _version
48 */
49 private org.astrogrid.registry.beans.resource.votable.types.VOTABLEVersionType _version;
50
51 /***
52 * Field _DESCRIPTION
53 */
54 private org.astrogrid.registry.beans.resource.votable.AnyTEXT _DESCRIPTION;
55
56 /***
57 * Field _DEFINITIONS
58 */
59 private org.astrogrid.registry.beans.resource.votable.DEFINITIONS _DEFINITIONS;
60
61 /***
62 * Field _INFOList
63 */
64 private java.util.ArrayList _INFOList;
65
66 /***
67 * Field _RESOURCEList
68 */
69 private java.util.ArrayList _RESOURCEList;
70
71
72
73
74
75
76 public VOTABLE() {
77 super();
78 _INFOList = new ArrayList();
79 _RESOURCEList = new ArrayList();
80 }
81
82
83
84
85
86
87 /***
88 * Method addINFO
89 *
90 * @param vINFO
91 */
92 public void addINFO(org.astrogrid.registry.beans.resource.votable.INFO vINFO)
93 throws java.lang.IndexOutOfBoundsException
94 {
95 _INFOList.add(vINFO);
96 }
97
98 /***
99 * Method addINFO
100 *
101 * @param index
102 * @param vINFO
103 */
104 public void addINFO(int index, org.astrogrid.registry.beans.resource.votable.INFO vINFO)
105 throws java.lang.IndexOutOfBoundsException
106 {
107 _INFOList.add(index, vINFO);
108 }
109
110 /***
111 * Method addRESOURCE
112 *
113 * @param vRESOURCE
114 */
115 public void addRESOURCE(org.astrogrid.registry.beans.resource.votable.RESOURCE vRESOURCE)
116 throws java.lang.IndexOutOfBoundsException
117 {
118 _RESOURCEList.add(vRESOURCE);
119 }
120
121 /***
122 * Method addRESOURCE
123 *
124 * @param index
125 * @param vRESOURCE
126 */
127 public void addRESOURCE(int index, org.astrogrid.registry.beans.resource.votable.RESOURCE vRESOURCE)
128 throws java.lang.IndexOutOfBoundsException
129 {
130 _RESOURCEList.add(index, vRESOURCE);
131 }
132
133 /***
134 * Method clearINFO
135 */
136 public void clearINFO()
137 {
138 _INFOList.clear();
139 }
140
141 /***
142 * Method clearRESOURCE
143 */
144 public void clearRESOURCE()
145 {
146 _RESOURCEList.clear();
147 }
148
149 /***
150 * Method enumerateINFO
151 */
152 public java.util.Enumeration enumerateINFO()
153 {
154 return new org.exolab.castor.util.IteratorEnumeration(_INFOList.iterator());
155 }
156
157 /***
158 * Method enumerateRESOURCE
159 */
160 public java.util.Enumeration enumerateRESOURCE()
161 {
162 return new org.exolab.castor.util.IteratorEnumeration(_RESOURCEList.iterator());
163 }
164
165 /***
166 * Note: hashCode() has not been overriden
167 *
168 * @param obj
169 */
170 public boolean equals(java.lang.Object obj)
171 {
172 if ( this == obj )
173 return true;
174
175 if (super.equals(obj)==false)
176 return false;
177
178 if (obj instanceof VOTABLE) {
179
180 VOTABLE temp = (VOTABLE)obj;
181 if (this._ID != null) {
182 if (temp._ID == null) return false;
183 else if (!(this._ID.equals(temp._ID)))
184 return false;
185 }
186 else if (temp._ID != null)
187 return false;
188 if (this._version != null) {
189 if (temp._version == null) return false;
190 else if (!(this._version.equals(temp._version)))
191 return false;
192 }
193 else if (temp._version != null)
194 return false;
195 if (this._DESCRIPTION != null) {
196 if (temp._DESCRIPTION == null) return false;
197 else if (!(this._DESCRIPTION.equals(temp._DESCRIPTION)))
198 return false;
199 }
200 else if (temp._DESCRIPTION != null)
201 return false;
202 if (this._DEFINITIONS != null) {
203 if (temp._DEFINITIONS == null) return false;
204 else if (!(this._DEFINITIONS.equals(temp._DEFINITIONS)))
205 return false;
206 }
207 else if (temp._DEFINITIONS != null)
208 return false;
209 if (this._INFOList != null) {
210 if (temp._INFOList == null) return false;
211 else if (!(this._INFOList.equals(temp._INFOList)))
212 return false;
213 }
214 else if (temp._INFOList != null)
215 return false;
216 if (this._RESOURCEList != null) {
217 if (temp._RESOURCEList == null) return false;
218 else if (!(this._RESOURCEList.equals(temp._RESOURCEList)))
219 return false;
220 }
221 else if (temp._RESOURCEList != null)
222 return false;
223 return true;
224 }
225 return false;
226 }
227
228 /***
229 * Returns the value of field 'DEFINITIONS'.
230 *
231 * @return the value of field 'DEFINITIONS'.
232 */
233 public org.astrogrid.registry.beans.resource.votable.DEFINITIONS getDEFINITIONS()
234 {
235 return this._DEFINITIONS;
236 }
237
238 /***
239 * Returns the value of field 'DESCRIPTION'.
240 *
241 * @return the value of field 'DESCRIPTION'.
242 */
243 public org.astrogrid.registry.beans.resource.votable.AnyTEXT getDESCRIPTION()
244 {
245 return this._DESCRIPTION;
246 }
247
248 /***
249 * Returns the value of field 'ID'.
250 *
251 * @return the value of field 'ID'.
252 */
253 public java.lang.String getID()
254 {
255 return this._ID;
256 }
257
258 /***
259 * Method getINFO
260 *
261 * @param index
262 */
263 public org.astrogrid.registry.beans.resource.votable.INFO getINFO(int index)
264 throws java.lang.IndexOutOfBoundsException
265 {
266
267 if ((index < 0) || (index > _INFOList.size())) {
268 throw new IndexOutOfBoundsException();
269 }
270
271 return (org.astrogrid.registry.beans.resource.votable.INFO) _INFOList.get(index);
272 }
273
274 /***
275 * Method getINFO
276 */
277 public org.astrogrid.registry.beans.resource.votable.INFO[] getINFO()
278 {
279 int size = _INFOList.size();
280 org.astrogrid.registry.beans.resource.votable.INFO[] mArray = new org.astrogrid.registry.beans.resource.votable.INFO[size];
281 for (int index = 0; index < size; index++) {
282 mArray[index] = (org.astrogrid.registry.beans.resource.votable.INFO) _INFOList.get(index);
283 }
284 return mArray;
285 }
286
287 /***
288 * Method getINFOCount
289 */
290 public int getINFOCount()
291 {
292 return _INFOList.size();
293 }
294
295 /***
296 * Method getRESOURCE
297 *
298 * @param index
299 */
300 public org.astrogrid.registry.beans.resource.votable.RESOURCE getRESOURCE(int index)
301 throws java.lang.IndexOutOfBoundsException
302 {
303
304 if ((index < 0) || (index > _RESOURCEList.size())) {
305 throw new IndexOutOfBoundsException();
306 }
307
308 return (org.astrogrid.registry.beans.resource.votable.RESOURCE) _RESOURCEList.get(index);
309 }
310
311 /***
312 * Method getRESOURCE
313 */
314 public org.astrogrid.registry.beans.resource.votable.RESOURCE[] getRESOURCE()
315 {
316 int size = _RESOURCEList.size();
317 org.astrogrid.registry.beans.resource.votable.RESOURCE[] mArray = new org.astrogrid.registry.beans.resource.votable.RESOURCE[size];
318 for (int index = 0; index < size; index++) {
319 mArray[index] = (org.astrogrid.registry.beans.resource.votable.RESOURCE) _RESOURCEList.get(index);
320 }
321 return mArray;
322 }
323
324 /***
325 * Method getRESOURCECount
326 */
327 public int getRESOURCECount()
328 {
329 return _RESOURCEList.size();
330 }
331
332 /***
333 * Returns the value of field 'version'.
334 *
335 * @return the value of field 'version'.
336 */
337 public org.astrogrid.registry.beans.resource.votable.types.VOTABLEVersionType getVersion()
338 {
339 return this._version;
340 }
341
342 /***
343 * Method isValid
344 */
345 public boolean isValid()
346 {
347 try {
348 validate();
349 }
350 catch (org.exolab.castor.xml.ValidationException vex) {
351 return false;
352 }
353 return true;
354 }
355
356 /***
357 * Method marshal
358 *
359 * @param out
360 */
361 public void marshal(java.io.Writer out)
362 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
363 {
364
365 Marshaller.marshal(this, out);
366 }
367
368 /***
369 * Method marshal
370 *
371 * @param handler
372 */
373 public void marshal(org.xml.sax.ContentHandler handler)
374 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
375 {
376
377 Marshaller.marshal(this, handler);
378 }
379
380 /***
381 * Method removeINFO
382 *
383 * @param vINFO
384 */
385 public boolean removeINFO(org.astrogrid.registry.beans.resource.votable.INFO vINFO)
386 {
387 boolean removed = _INFOList.remove(vINFO);
388 return removed;
389 }
390
391 /***
392 * Method removeRESOURCE
393 *
394 * @param vRESOURCE
395 */
396 public boolean removeRESOURCE(org.astrogrid.registry.beans.resource.votable.RESOURCE vRESOURCE)
397 {
398 boolean removed = _RESOURCEList.remove(vRESOURCE);
399 return removed;
400 }
401
402 /***
403 * Sets the value of field 'DEFINITIONS'.
404 *
405 * @param DEFINITIONS the value of field 'DEFINITIONS'.
406 */
407 public void setDEFINITIONS(org.astrogrid.registry.beans.resource.votable.DEFINITIONS DEFINITIONS)
408 {
409 this._DEFINITIONS = DEFINITIONS;
410 }
411
412 /***
413 * Sets the value of field 'DESCRIPTION'.
414 *
415 * @param DESCRIPTION the value of field 'DESCRIPTION'.
416 */
417 public void setDESCRIPTION(org.astrogrid.registry.beans.resource.votable.AnyTEXT DESCRIPTION)
418 {
419 this._DESCRIPTION = DESCRIPTION;
420 }
421
422 /***
423 * Sets the value of field 'ID'.
424 *
425 * @param ID the value of field 'ID'.
426 */
427 public void setID(java.lang.String ID)
428 {
429 this._ID = ID;
430 }
431
432 /***
433 * Method setINFO
434 *
435 * @param index
436 * @param vINFO
437 */
438 public void setINFO(int index, org.astrogrid.registry.beans.resource.votable.INFO vINFO)
439 throws java.lang.IndexOutOfBoundsException
440 {
441
442 if ((index < 0) || (index > _INFOList.size())) {
443 throw new IndexOutOfBoundsException();
444 }
445 _INFOList.set(index, vINFO);
446 }
447
448 /***
449 * Method setINFO
450 *
451 * @param INFOArray
452 */
453 public void setINFO(org.astrogrid.registry.beans.resource.votable.INFO[] INFOArray)
454 {
455
456 _INFOList.clear();
457 for (int i = 0; i < INFOArray.length; i++) {
458 _INFOList.add(INFOArray[i]);
459 }
460 }
461
462 /***
463 * Method setRESOURCE
464 *
465 * @param index
466 * @param vRESOURCE
467 */
468 public void setRESOURCE(int index, org.astrogrid.registry.beans.resource.votable.RESOURCE vRESOURCE)
469 throws java.lang.IndexOutOfBoundsException
470 {
471
472 if ((index < 0) || (index > _RESOURCEList.size())) {
473 throw new IndexOutOfBoundsException();
474 }
475 _RESOURCEList.set(index, vRESOURCE);
476 }
477
478 /***
479 * Method setRESOURCE
480 *
481 * @param RESOURCEArray
482 */
483 public void setRESOURCE(org.astrogrid.registry.beans.resource.votable.RESOURCE[] RESOURCEArray)
484 {
485
486 _RESOURCEList.clear();
487 for (int i = 0; i < RESOURCEArray.length; i++) {
488 _RESOURCEList.add(RESOURCEArray[i]);
489 }
490 }
491
492 /***
493 * Sets the value of field 'version'.
494 *
495 * @param version the value of field 'version'.
496 */
497 public void setVersion(org.astrogrid.registry.beans.resource.votable.types.VOTABLEVersionType version)
498 {
499 this._version = version;
500 }
501
502 /***
503 * Method unmarshalVOTABLE
504 *
505 * @param reader
506 */
507 public static org.astrogrid.registry.beans.resource.votable.VOTABLE unmarshalVOTABLE(java.io.Reader reader)
508 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
509 {
510 return (org.astrogrid.registry.beans.resource.votable.VOTABLE) Unmarshaller.unmarshal(org.astrogrid.registry.beans.resource.votable.VOTABLE.class, reader);
511 }
512
513 /***
514 * Method validate
515 */
516 public void validate()
517 throws org.exolab.castor.xml.ValidationException
518 {
519 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
520 validator.validate(this);
521 }
522
523 }