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