View Javadoc

1   /*
2    * This class was automatically generated with 
3    * <a href="http://www.castor.org">Castor 0.9.4.3</a>, using an XML
4    * Schema.
5    * $Id: CurationType.java,v 1.14 2007/01/04 16:26:22 clq2 Exp $
6    */
7   
8   package org.astrogrid.registry.beans.resource;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
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.exolab.castor.xml.MarshalException;
21  import org.exolab.castor.xml.Marshaller;
22  import org.exolab.castor.xml.Unmarshaller;
23  import org.exolab.castor.xml.ValidationException;
24  import org.xml.sax.ContentHandler;
25  
26  /***
27   * Class CurationType.
28   * 
29   * @version $Revision: 1.14 $ $Date: 2007/01/04 16:26:22 $
30   */
31  public class CurationType extends org.astrogrid.common.bean.BaseBean 
32  implements java.io.Serializable
33  {
34  
35  
36        //--------------------------/
37       //- Class/Member Variables -/
38      //--------------------------/
39  
40      /***
41       * Entity (e.g. person or organisation) responsible for making
42       * the 
43       *  resource available
44       *  
45       */
46      private org.astrogrid.registry.beans.resource.ResourceReferenceType _publisher;
47  
48      /***
49       * Information that can be used for contacting someone with
50       *  regard to this resource.
51       *  
52       */
53      private org.astrogrid.registry.beans.resource.ContactType _contact;
54  
55      /***
56       * Date associated with an event in the life cycle of the
57       *  resource. 
58       *  
59       */
60      private java.util.ArrayList _dateList;
61  
62      /***
63       * The entity (e.g. person or organisation) primarily
64       * responsible for
65       *  creating the content or constitution of the resource
66       *  
67       */
68      private org.astrogrid.registry.beans.resource.CreatorType _creator;
69  
70      /***
71       * Entity responsible for contributions to the content of the
72       * resource
73       *  
74       */
75      private java.util.ArrayList _contributorList;
76  
77      /***
78       * Label associated with creation or availablilty of a version
79       * of 
80       *  a resource.
81       *  
82       */
83      private java.lang.String _version;
84  
85  
86        //----------------/
87       //- Constructors -/
88      //----------------/
89  
90      public CurationType() {
91          super();
92          _dateList = new ArrayList();
93          _contributorList = new ArrayList();
94      } //-- org.astrogrid.registry.beans.resource.CurationType()
95  
96  
97        //-----------/
98       //- Methods -/
99      //-----------/
100 
101     /***
102      * Method addContributor
103      * 
104      * @param vContributor
105      */
106     public void addContributor(org.astrogrid.registry.beans.resource.NameReferenceType vContributor)
107         throws java.lang.IndexOutOfBoundsException
108     {
109         _contributorList.add(vContributor);
110     } //-- void addContributor(org.astrogrid.registry.beans.resource.NameReferenceType) 
111 
112     /***
113      * Method addContributor
114      * 
115      * @param index
116      * @param vContributor
117      */
118     public void addContributor(int index, org.astrogrid.registry.beans.resource.NameReferenceType vContributor)
119         throws java.lang.IndexOutOfBoundsException
120     {
121         _contributorList.add(index, vContributor);
122     } //-- void addContributor(int, org.astrogrid.registry.beans.resource.NameReferenceType) 
123 
124     /***
125      * Method addDate
126      * 
127      * @param vDate
128      */
129     public void addDate(org.astrogrid.registry.beans.resource.DateType vDate)
130         throws java.lang.IndexOutOfBoundsException
131     {
132         _dateList.add(vDate);
133     } //-- void addDate(org.astrogrid.registry.beans.resource.DateType) 
134 
135     /***
136      * Method addDate
137      * 
138      * @param index
139      * @param vDate
140      */
141     public void addDate(int index, org.astrogrid.registry.beans.resource.DateType vDate)
142         throws java.lang.IndexOutOfBoundsException
143     {
144         _dateList.add(index, vDate);
145     } //-- void addDate(int, org.astrogrid.registry.beans.resource.DateType) 
146 
147     /***
148      * Method clearContributor
149      */
150     public void clearContributor()
151     {
152         _contributorList.clear();
153     } //-- void clearContributor() 
154 
155     /***
156      * Method clearDate
157      */
158     public void clearDate()
159     {
160         _dateList.clear();
161     } //-- void clearDate() 
162 
163     /***
164      * Method enumerateContributor
165      */
166     public java.util.Enumeration enumerateContributor()
167     {
168         return new org.exolab.castor.util.IteratorEnumeration(_contributorList.iterator());
169     } //-- java.util.Enumeration enumerateContributor() 
170 
171     /***
172      * Method enumerateDate
173      */
174     public java.util.Enumeration enumerateDate()
175     {
176         return new org.exolab.castor.util.IteratorEnumeration(_dateList.iterator());
177     } //-- java.util.Enumeration enumerateDate() 
178 
179     /***
180      * Note: hashCode() has not been overriden
181      * 
182      * @param obj
183      */
184     public boolean equals(java.lang.Object obj)
185     {
186         if ( this == obj )
187             return true;
188         
189         if (super.equals(obj)==false)
190             return false;
191         
192         if (obj instanceof CurationType) {
193         
194             CurationType temp = (CurationType)obj;
195             if (this._publisher != null) {
196                 if (temp._publisher == null) return false;
197                 else if (!(this._publisher.equals(temp._publisher))) 
198                     return false;
199             }
200             else if (temp._publisher != null)
201                 return false;
202             if (this._contact != null) {
203                 if (temp._contact == null) return false;
204                 else if (!(this._contact.equals(temp._contact))) 
205                     return false;
206             }
207             else if (temp._contact != null)
208                 return false;
209             if (this._dateList != null) {
210                 if (temp._dateList == null) return false;
211                 else if (!(this._dateList.equals(temp._dateList))) 
212                     return false;
213             }
214             else if (temp._dateList != null)
215                 return false;
216             if (this._creator != null) {
217                 if (temp._creator == null) return false;
218                 else if (!(this._creator.equals(temp._creator))) 
219                     return false;
220             }
221             else if (temp._creator != null)
222                 return false;
223             if (this._contributorList != null) {
224                 if (temp._contributorList == null) return false;
225                 else if (!(this._contributorList.equals(temp._contributorList))) 
226                     return false;
227             }
228             else if (temp._contributorList != null)
229                 return false;
230             if (this._version != null) {
231                 if (temp._version == null) return false;
232                 else if (!(this._version.equals(temp._version))) 
233                     return false;
234             }
235             else if (temp._version != null)
236                 return false;
237             return true;
238         }
239         return false;
240     } //-- boolean equals(java.lang.Object) 
241 
242     /***
243      * Returns the value of field 'contact'. The field 'contact'
244      * has the following description: Information that can be used
245      * for contacting someone with
246      *  regard to this resource.
247      *  
248      * 
249      * @return the value of field 'contact'.
250      */
251     public org.astrogrid.registry.beans.resource.ContactType getContact()
252     {
253         return this._contact;
254     } //-- org.astrogrid.registry.beans.resource.ContactType getContact() 
255 
256     /***
257      * Method getContributor
258      * 
259      * @param index
260      */
261     public org.astrogrid.registry.beans.resource.NameReferenceType getContributor(int index)
262         throws java.lang.IndexOutOfBoundsException
263     {
264         //-- check bounds for index
265         if ((index < 0) || (index > _contributorList.size())) {
266             throw new IndexOutOfBoundsException();
267         }
268         
269         return (org.astrogrid.registry.beans.resource.NameReferenceType) _contributorList.get(index);
270     } //-- org.astrogrid.registry.beans.resource.NameReferenceType getContributor(int) 
271 
272     /***
273      * Method getContributor
274      */
275     public org.astrogrid.registry.beans.resource.NameReferenceType[] getContributor()
276     {
277         int size = _contributorList.size();
278         org.astrogrid.registry.beans.resource.NameReferenceType[] mArray = new org.astrogrid.registry.beans.resource.NameReferenceType[size];
279         for (int index = 0; index < size; index++) {
280             mArray[index] = (org.astrogrid.registry.beans.resource.NameReferenceType) _contributorList.get(index);
281         }
282         return mArray;
283     } //-- org.astrogrid.registry.beans.resource.NameReferenceType[] getContributor() 
284 
285     /***
286      * Method getContributorCount
287      */
288     public int getContributorCount()
289     {
290         return _contributorList.size();
291     } //-- int getContributorCount() 
292 
293     /***
294      * Returns the value of field 'creator'. The field 'creator'
295      * has the following description: The entity (e.g. person or
296      * organisation) primarily responsible for
297      *  creating the content or constitution of the resource
298      *  
299      * 
300      * @return the value of field 'creator'.
301      */
302     public org.astrogrid.registry.beans.resource.CreatorType getCreator()
303     {
304         return this._creator;
305     } //-- org.astrogrid.registry.beans.resource.CreatorType getCreator() 
306 
307     /***
308      * Method getDate
309      * 
310      * @param index
311      */
312     public org.astrogrid.registry.beans.resource.DateType getDate(int index)
313         throws java.lang.IndexOutOfBoundsException
314     {
315         //-- check bounds for index
316         if ((index < 0) || (index > _dateList.size())) {
317             throw new IndexOutOfBoundsException();
318         }
319         
320         return (org.astrogrid.registry.beans.resource.DateType) _dateList.get(index);
321     } //-- org.astrogrid.registry.beans.resource.DateType getDate(int) 
322 
323     /***
324      * Method getDate
325      */
326     public org.astrogrid.registry.beans.resource.DateType[] getDate()
327     {
328         int size = _dateList.size();
329         org.astrogrid.registry.beans.resource.DateType[] mArray = new org.astrogrid.registry.beans.resource.DateType[size];
330         for (int index = 0; index < size; index++) {
331             mArray[index] = (org.astrogrid.registry.beans.resource.DateType) _dateList.get(index);
332         }
333         return mArray;
334     } //-- org.astrogrid.registry.beans.resource.DateType[] getDate() 
335 
336     /***
337      * Method getDateCount
338      */
339     public int getDateCount()
340     {
341         return _dateList.size();
342     } //-- int getDateCount() 
343 
344     /***
345      * Returns the value of field 'publisher'. The field
346      * 'publisher' has the following description: Entity (e.g.
347      * person or organisation) responsible for making the 
348      *  resource available
349      *  
350      * 
351      * @return the value of field 'publisher'.
352      */
353     public org.astrogrid.registry.beans.resource.ResourceReferenceType getPublisher()
354     {
355         return this._publisher;
356     } //-- org.astrogrid.registry.beans.resource.ResourceReferenceType getPublisher() 
357 
358     /***
359      * Returns the value of field 'version'. The field 'version'
360      * has the following description: Label associated with
361      * creation or availablilty of a version of 
362      *  a resource.
363      *  
364      * 
365      * @return the value of field 'version'.
366      */
367     public java.lang.String getVersion()
368     {
369         return this._version;
370     } //-- java.lang.String getVersion() 
371 
372     /***
373      * Method isValid
374      */
375     public boolean isValid()
376     {
377         try {
378             validate();
379         }
380         catch (org.exolab.castor.xml.ValidationException vex) {
381             return false;
382         }
383         return true;
384     } //-- boolean isValid() 
385 
386     /***
387      * Method marshal
388      * 
389      * @param out
390      */
391     public void marshal(java.io.Writer out)
392         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
393     {
394         
395         Marshaller.marshal(this, out);
396     } //-- void marshal(java.io.Writer) 
397 
398     /***
399      * Method marshal
400      * 
401      * @param handler
402      */
403     public void marshal(org.xml.sax.ContentHandler handler)
404         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
405     {
406         
407         Marshaller.marshal(this, handler);
408     } //-- void marshal(org.xml.sax.ContentHandler) 
409 
410     /***
411      * Method removeContributor
412      * 
413      * @param vContributor
414      */
415     public boolean removeContributor(org.astrogrid.registry.beans.resource.NameReferenceType vContributor)
416     {
417         boolean removed = _contributorList.remove(vContributor);
418         return removed;
419     } //-- boolean removeContributor(org.astrogrid.registry.beans.resource.NameReferenceType) 
420 
421     /***
422      * Method removeDate
423      * 
424      * @param vDate
425      */
426     public boolean removeDate(org.astrogrid.registry.beans.resource.DateType vDate)
427     {
428         boolean removed = _dateList.remove(vDate);
429         return removed;
430     } //-- boolean removeDate(org.astrogrid.registry.beans.resource.DateType) 
431 
432     /***
433      * Sets the value of field 'contact'. The field 'contact' has
434      * the following description: Information that can be used for
435      * contacting someone with
436      *  regard to this resource.
437      *  
438      * 
439      * @param contact the value of field 'contact'.
440      */
441     public void setContact(org.astrogrid.registry.beans.resource.ContactType contact)
442     {
443         this._contact = contact;
444     } //-- void setContact(org.astrogrid.registry.beans.resource.ContactType) 
445 
446     /***
447      * Method setContributor
448      * 
449      * @param index
450      * @param vContributor
451      */
452     public void setContributor(int index, org.astrogrid.registry.beans.resource.NameReferenceType vContributor)
453         throws java.lang.IndexOutOfBoundsException
454     {
455         //-- check bounds for index
456         if ((index < 0) || (index > _contributorList.size())) {
457             throw new IndexOutOfBoundsException();
458         }
459         _contributorList.set(index, vContributor);
460     } //-- void setContributor(int, org.astrogrid.registry.beans.resource.NameReferenceType) 
461 
462     /***
463      * Method setContributor
464      * 
465      * @param contributorArray
466      */
467     public void setContributor(org.astrogrid.registry.beans.resource.NameReferenceType[] contributorArray)
468     {
469         //-- copy array
470         _contributorList.clear();
471         for (int i = 0; i < contributorArray.length; i++) {
472             _contributorList.add(contributorArray[i]);
473         }
474     } //-- void setContributor(org.astrogrid.registry.beans.resource.NameReferenceType) 
475 
476     /***
477      * Sets the value of field 'creator'. The field 'creator' has
478      * the following description: The entity (e.g. person or
479      * organisation) primarily responsible for
480      *  creating the content or constitution of the resource
481      *  
482      * 
483      * @param creator the value of field 'creator'.
484      */
485     public void setCreator(org.astrogrid.registry.beans.resource.CreatorType creator)
486     {
487         this._creator = creator;
488     } //-- void setCreator(org.astrogrid.registry.beans.resource.CreatorType) 
489 
490     /***
491      * Method setDate
492      * 
493      * @param index
494      * @param vDate
495      */
496     public void setDate(int index, org.astrogrid.registry.beans.resource.DateType vDate)
497         throws java.lang.IndexOutOfBoundsException
498     {
499         //-- check bounds for index
500         if ((index < 0) || (index > _dateList.size())) {
501             throw new IndexOutOfBoundsException();
502         }
503         _dateList.set(index, vDate);
504     } //-- void setDate(int, org.astrogrid.registry.beans.resource.DateType) 
505 
506     /***
507      * Method setDate
508      * 
509      * @param dateArray
510      */
511     public void setDate(org.astrogrid.registry.beans.resource.DateType[] dateArray)
512     {
513         //-- copy array
514         _dateList.clear();
515         for (int i = 0; i < dateArray.length; i++) {
516             _dateList.add(dateArray[i]);
517         }
518     } //-- void setDate(org.astrogrid.registry.beans.resource.DateType) 
519 
520     /***
521      * Sets the value of field 'publisher'. The field 'publisher'
522      * has the following description: Entity (e.g. person or
523      * organisation) responsible for making the 
524      *  resource available
525      *  
526      * 
527      * @param publisher the value of field 'publisher'.
528      */
529     public void setPublisher(org.astrogrid.registry.beans.resource.ResourceReferenceType publisher)
530     {
531         this._publisher = publisher;
532     } //-- void setPublisher(org.astrogrid.registry.beans.resource.ResourceReferenceType) 
533 
534     /***
535      * Sets the value of field 'version'. The field 'version' has
536      * the following description: Label associated with creation or
537      * availablilty of a version of 
538      *  a resource.
539      *  
540      * 
541      * @param version the value of field 'version'.
542      */
543     public void setVersion(java.lang.String version)
544     {
545         this._version = version;
546     } //-- void setVersion(java.lang.String) 
547 
548     /***
549      * Method unmarshalCurationType
550      * 
551      * @param reader
552      */
553     public static org.astrogrid.registry.beans.resource.CurationType unmarshalCurationType(java.io.Reader reader)
554         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
555     {
556         return (org.astrogrid.registry.beans.resource.CurationType) Unmarshaller.unmarshal(org.astrogrid.registry.beans.resource.CurationType.class, reader);
557     } //-- org.astrogrid.registry.beans.resource.CurationType unmarshalCurationType(java.io.Reader) 
558 
559     /***
560      * Method validate
561      */
562     public void validate()
563         throws org.exolab.castor.xml.ValidationException
564     {
565         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
566         validator.validate(this);
567     } //-- void validate() 
568 
569 }