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: Content.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.astrogrid.registry.beans.v10.resource.types.ContentLevel;
21  import org.astrogrid.registry.beans.v10.resource.types.Type;
22  import org.exolab.castor.xml.MarshalException;
23  import org.exolab.castor.xml.Marshaller;
24  import org.exolab.castor.xml.Unmarshaller;
25  import org.exolab.castor.xml.ValidationException;
26  import org.xml.sax.ContentHandler;
27  
28  /***
29   * Information regarding the general content of a resource
30   *  
31   * 
32   * @version $Revision: 1.2 $ $Date: 2007/01/04 16:26:24 $
33   */
34  public class Content extends org.astrogrid.common.bean.BaseBean 
35  implements java.io.Serializable
36  {
37  
38  
39        //--------------------------/
40       //- Class/Member Variables -/
41      //--------------------------/
42  
43      /***
44       * List of topics, object types, or other descriptive keywords 
45       *  about the resource. 
46       *  
47       */
48      private java.util.ArrayList _subjectList;
49  
50      /***
51       * An account of the nature of the resource
52       *  
53       */
54      private java.lang.String _description;
55  
56      /***
57       * a bibliographic reference from which the present resource is
58       * 
59       *  derived or extracted. 
60       *  
61       */
62      private org.astrogrid.registry.beans.v10.resource.Source _source;
63  
64      /***
65       * URL pointing to a human-readable document describing this 
66       *  resource. 
67       *  
68       */
69      private java.lang.String _referenceURL;
70  
71      /***
72       * Nature or genre of the content of the resource
73       *  
74       */
75      private java.util.ArrayList _typeList;
76  
77      /***
78       * Description of the content level or intended audience
79       *  
80       */
81      private java.util.ArrayList _contentLevelList;
82  
83      /***
84       * a description of a relationship to another resource. 
85       *  
86       */
87      private java.util.ArrayList _relationshipList;
88  
89  
90        //----------------/
91       //- Constructors -/
92      //----------------/
93  
94      public Content() {
95          super();
96          _subjectList = new ArrayList();
97          _typeList = new ArrayList();
98          _contentLevelList = new ArrayList();
99          _relationshipList = new ArrayList();
100     } //-- org.astrogrid.registry.beans.v10.resource.Content()
101 
102 
103       //-----------/
104      //- Methods -/
105     //-----------/
106 
107     /***
108      * Method addContentLevel
109      * 
110      * @param vContentLevel
111      */
112     public void addContentLevel(org.astrogrid.registry.beans.v10.resource.types.ContentLevel vContentLevel)
113         throws java.lang.IndexOutOfBoundsException
114     {
115         _contentLevelList.add(vContentLevel);
116     } //-- void addContentLevel(org.astrogrid.registry.beans.v10.resource.types.ContentLevel) 
117 
118     /***
119      * Method addContentLevel
120      * 
121      * @param index
122      * @param vContentLevel
123      */
124     public void addContentLevel(int index, org.astrogrid.registry.beans.v10.resource.types.ContentLevel vContentLevel)
125         throws java.lang.IndexOutOfBoundsException
126     {
127         _contentLevelList.add(index, vContentLevel);
128     } //-- void addContentLevel(int, org.astrogrid.registry.beans.v10.resource.types.ContentLevel) 
129 
130     /***
131      * Method addRelationship
132      * 
133      * @param vRelationship
134      */
135     public void addRelationship(org.astrogrid.registry.beans.v10.resource.Relationship vRelationship)
136         throws java.lang.IndexOutOfBoundsException
137     {
138         _relationshipList.add(vRelationship);
139     } //-- void addRelationship(org.astrogrid.registry.beans.v10.resource.Relationship) 
140 
141     /***
142      * Method addRelationship
143      * 
144      * @param index
145      * @param vRelationship
146      */
147     public void addRelationship(int index, org.astrogrid.registry.beans.v10.resource.Relationship vRelationship)
148         throws java.lang.IndexOutOfBoundsException
149     {
150         _relationshipList.add(index, vRelationship);
151     } //-- void addRelationship(int, org.astrogrid.registry.beans.v10.resource.Relationship) 
152 
153     /***
154      * Method addSubject
155      * 
156      * @param vSubject
157      */
158     public void addSubject(java.lang.String vSubject)
159         throws java.lang.IndexOutOfBoundsException
160     {
161         _subjectList.add(vSubject);
162     } //-- void addSubject(java.lang.String) 
163 
164     /***
165      * Method addSubject
166      * 
167      * @param index
168      * @param vSubject
169      */
170     public void addSubject(int index, java.lang.String vSubject)
171         throws java.lang.IndexOutOfBoundsException
172     {
173         _subjectList.add(index, vSubject);
174     } //-- void addSubject(int, java.lang.String) 
175 
176     /***
177      * Method addType
178      * 
179      * @param vType
180      */
181     public void addType(org.astrogrid.registry.beans.v10.resource.types.Type vType)
182         throws java.lang.IndexOutOfBoundsException
183     {
184         _typeList.add(vType);
185     } //-- void addType(org.astrogrid.registry.beans.v10.resource.types.Type) 
186 
187     /***
188      * Method addType
189      * 
190      * @param index
191      * @param vType
192      */
193     public void addType(int index, org.astrogrid.registry.beans.v10.resource.types.Type vType)
194         throws java.lang.IndexOutOfBoundsException
195     {
196         _typeList.add(index, vType);
197     } //-- void addType(int, org.astrogrid.registry.beans.v10.resource.types.Type) 
198 
199     /***
200      * Method clearContentLevel
201      */
202     public void clearContentLevel()
203     {
204         _contentLevelList.clear();
205     } //-- void clearContentLevel() 
206 
207     /***
208      * Method clearRelationship
209      */
210     public void clearRelationship()
211     {
212         _relationshipList.clear();
213     } //-- void clearRelationship() 
214 
215     /***
216      * Method clearSubject
217      */
218     public void clearSubject()
219     {
220         _subjectList.clear();
221     } //-- void clearSubject() 
222 
223     /***
224      * Method clearType
225      */
226     public void clearType()
227     {
228         _typeList.clear();
229     } //-- void clearType() 
230 
231     /***
232      * Method enumerateContentLevel
233      */
234     public java.util.Enumeration enumerateContentLevel()
235     {
236         return new org.exolab.castor.util.IteratorEnumeration(_contentLevelList.iterator());
237     } //-- java.util.Enumeration enumerateContentLevel() 
238 
239     /***
240      * Method enumerateRelationship
241      */
242     public java.util.Enumeration enumerateRelationship()
243     {
244         return new org.exolab.castor.util.IteratorEnumeration(_relationshipList.iterator());
245     } //-- java.util.Enumeration enumerateRelationship() 
246 
247     /***
248      * Method enumerateSubject
249      */
250     public java.util.Enumeration enumerateSubject()
251     {
252         return new org.exolab.castor.util.IteratorEnumeration(_subjectList.iterator());
253     } //-- java.util.Enumeration enumerateSubject() 
254 
255     /***
256      * Method enumerateType
257      */
258     public java.util.Enumeration enumerateType()
259     {
260         return new org.exolab.castor.util.IteratorEnumeration(_typeList.iterator());
261     } //-- java.util.Enumeration enumerateType() 
262 
263     /***
264      * Note: hashCode() has not been overriden
265      * 
266      * @param obj
267      */
268     public boolean equals(java.lang.Object obj)
269     {
270         if ( this == obj )
271             return true;
272         
273         if (super.equals(obj)==false)
274             return false;
275         
276         if (obj instanceof Content) {
277         
278             Content temp = (Content)obj;
279             if (this._subjectList != null) {
280                 if (temp._subjectList == null) return false;
281                 else if (!(this._subjectList.equals(temp._subjectList))) 
282                     return false;
283             }
284             else if (temp._subjectList != null)
285                 return false;
286             if (this._description != null) {
287                 if (temp._description == null) return false;
288                 else if (!(this._description.equals(temp._description))) 
289                     return false;
290             }
291             else if (temp._description != null)
292                 return false;
293             if (this._source != null) {
294                 if (temp._source == null) return false;
295                 else if (!(this._source.equals(temp._source))) 
296                     return false;
297             }
298             else if (temp._source != null)
299                 return false;
300             if (this._referenceURL != null) {
301                 if (temp._referenceURL == null) return false;
302                 else if (!(this._referenceURL.equals(temp._referenceURL))) 
303                     return false;
304             }
305             else if (temp._referenceURL != null)
306                 return false;
307             if (this._typeList != null) {
308                 if (temp._typeList == null) return false;
309                 else if (!(this._typeList.equals(temp._typeList))) 
310                     return false;
311             }
312             else if (temp._typeList != null)
313                 return false;
314             if (this._contentLevelList != null) {
315                 if (temp._contentLevelList == null) return false;
316                 else if (!(this._contentLevelList.equals(temp._contentLevelList))) 
317                     return false;
318             }
319             else if (temp._contentLevelList != null)
320                 return false;
321             if (this._relationshipList != null) {
322                 if (temp._relationshipList == null) return false;
323                 else if (!(this._relationshipList.equals(temp._relationshipList))) 
324                     return false;
325             }
326             else if (temp._relationshipList != null)
327                 return false;
328             return true;
329         }
330         return false;
331     } //-- boolean equals(java.lang.Object) 
332 
333     /***
334      * Method getContentLevel
335      * 
336      * @param index
337      */
338     public org.astrogrid.registry.beans.v10.resource.types.ContentLevel getContentLevel(int index)
339         throws java.lang.IndexOutOfBoundsException
340     {
341         //-- check bounds for index
342         if ((index < 0) || (index > _contentLevelList.size())) {
343             throw new IndexOutOfBoundsException();
344         }
345         
346         return (org.astrogrid.registry.beans.v10.resource.types.ContentLevel) _contentLevelList.get(index);
347     } //-- org.astrogrid.registry.beans.v10.resource.types.ContentLevel getContentLevel(int) 
348 
349     /***
350      * Method getContentLevel
351      */
352     public org.astrogrid.registry.beans.v10.resource.types.ContentLevel[] getContentLevel()
353     {
354         int size = _contentLevelList.size();
355         org.astrogrid.registry.beans.v10.resource.types.ContentLevel[] mArray = new org.astrogrid.registry.beans.v10.resource.types.ContentLevel[size];
356         for (int index = 0; index < size; index++) {
357             mArray[index] = (org.astrogrid.registry.beans.v10.resource.types.ContentLevel) _contentLevelList.get(index);
358         }
359         return mArray;
360     } //-- org.astrogrid.registry.beans.v10.resource.types.ContentLevel[] getContentLevel() 
361 
362     /***
363      * Method getContentLevelCount
364      */
365     public int getContentLevelCount()
366     {
367         return _contentLevelList.size();
368     } //-- int getContentLevelCount() 
369 
370     /***
371      * Returns the value of field 'description'. The field
372      * 'description' has the following description: An account of
373      * the nature of the resource
374      *  
375      * 
376      * @return the value of field 'description'.
377      */
378     public java.lang.String getDescription()
379     {
380         return this._description;
381     } //-- java.lang.String getDescription() 
382 
383     /***
384      * Returns the value of field 'referenceURL'. The field
385      * 'referenceURL' has the following description: URL pointing
386      * to a human-readable document describing this 
387      *  resource. 
388      *  
389      * 
390      * @return the value of field 'referenceURL'.
391      */
392     public java.lang.String getReferenceURL()
393     {
394         return this._referenceURL;
395     } //-- java.lang.String getReferenceURL() 
396 
397     /***
398      * Method getRelationship
399      * 
400      * @param index
401      */
402     public org.astrogrid.registry.beans.v10.resource.Relationship getRelationship(int index)
403         throws java.lang.IndexOutOfBoundsException
404     {
405         //-- check bounds for index
406         if ((index < 0) || (index > _relationshipList.size())) {
407             throw new IndexOutOfBoundsException();
408         }
409         
410         return (org.astrogrid.registry.beans.v10.resource.Relationship) _relationshipList.get(index);
411     } //-- org.astrogrid.registry.beans.v10.resource.Relationship getRelationship(int) 
412 
413     /***
414      * Method getRelationship
415      */
416     public org.astrogrid.registry.beans.v10.resource.Relationship[] getRelationship()
417     {
418         int size = _relationshipList.size();
419         org.astrogrid.registry.beans.v10.resource.Relationship[] mArray = new org.astrogrid.registry.beans.v10.resource.Relationship[size];
420         for (int index = 0; index < size; index++) {
421             mArray[index] = (org.astrogrid.registry.beans.v10.resource.Relationship) _relationshipList.get(index);
422         }
423         return mArray;
424     } //-- org.astrogrid.registry.beans.v10.resource.Relationship[] getRelationship() 
425 
426     /***
427      * Method getRelationshipCount
428      */
429     public int getRelationshipCount()
430     {
431         return _relationshipList.size();
432     } //-- int getRelationshipCount() 
433 
434     /***
435      * Returns the value of field 'source'. The field 'source' has
436      * the following description: a bibliographic reference from
437      * which the present resource is 
438      *  derived or extracted. 
439      *  
440      * 
441      * @return the value of field 'source'.
442      */
443     public org.astrogrid.registry.beans.v10.resource.Source getSource()
444     {
445         return this._source;
446     } //-- org.astrogrid.registry.beans.v10.resource.Source getSource() 
447 
448     /***
449      * Method getSubject
450      * 
451      * @param index
452      */
453     public java.lang.String getSubject(int index)
454         throws java.lang.IndexOutOfBoundsException
455     {
456         //-- check bounds for index
457         if ((index < 0) || (index > _subjectList.size())) {
458             throw new IndexOutOfBoundsException();
459         }
460         
461         return (String)_subjectList.get(index);
462     } //-- java.lang.String getSubject(int) 
463 
464     /***
465      * Method getSubject
466      */
467     public java.lang.String[] getSubject()
468     {
469         int size = _subjectList.size();
470         java.lang.String[] mArray = new java.lang.String[size];
471         for (int index = 0; index < size; index++) {
472             mArray[index] = (String)_subjectList.get(index);
473         }
474         return mArray;
475     } //-- java.lang.String[] getSubject() 
476 
477     /***
478      * Method getSubjectCount
479      */
480     public int getSubjectCount()
481     {
482         return _subjectList.size();
483     } //-- int getSubjectCount() 
484 
485     /***
486      * Method getType
487      * 
488      * @param index
489      */
490     public org.astrogrid.registry.beans.v10.resource.types.Type getType(int index)
491         throws java.lang.IndexOutOfBoundsException
492     {
493         //-- check bounds for index
494         if ((index < 0) || (index > _typeList.size())) {
495             throw new IndexOutOfBoundsException();
496         }
497         
498         return (org.astrogrid.registry.beans.v10.resource.types.Type) _typeList.get(index);
499     } //-- org.astrogrid.registry.beans.v10.resource.types.Type getType(int) 
500 
501     /***
502      * Method getType
503      */
504     public org.astrogrid.registry.beans.v10.resource.types.Type[] getType()
505     {
506         int size = _typeList.size();
507         org.astrogrid.registry.beans.v10.resource.types.Type[] mArray = new org.astrogrid.registry.beans.v10.resource.types.Type[size];
508         for (int index = 0; index < size; index++) {
509             mArray[index] = (org.astrogrid.registry.beans.v10.resource.types.Type) _typeList.get(index);
510         }
511         return mArray;
512     } //-- org.astrogrid.registry.beans.v10.resource.types.Type[] getType() 
513 
514     /***
515      * Method getTypeCount
516      */
517     public int getTypeCount()
518     {
519         return _typeList.size();
520     } //-- int getTypeCount() 
521 
522     /***
523      * Method isValid
524      */
525     public boolean isValid()
526     {
527         try {
528             validate();
529         }
530         catch (org.exolab.castor.xml.ValidationException vex) {
531             return false;
532         }
533         return true;
534     } //-- boolean isValid() 
535 
536     /***
537      * Method marshal
538      * 
539      * @param out
540      */
541     public void marshal(java.io.Writer out)
542         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
543     {
544         
545         Marshaller.marshal(this, out);
546     } //-- void marshal(java.io.Writer) 
547 
548     /***
549      * Method marshal
550      * 
551      * @param handler
552      */
553     public void marshal(org.xml.sax.ContentHandler handler)
554         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
555     {
556         
557         Marshaller.marshal(this, handler);
558     } //-- void marshal(org.xml.sax.ContentHandler) 
559 
560     /***
561      * Method removeContentLevel
562      * 
563      * @param vContentLevel
564      */
565     public boolean removeContentLevel(org.astrogrid.registry.beans.v10.resource.types.ContentLevel vContentLevel)
566     {
567         boolean removed = _contentLevelList.remove(vContentLevel);
568         return removed;
569     } //-- boolean removeContentLevel(org.astrogrid.registry.beans.v10.resource.types.ContentLevel) 
570 
571     /***
572      * Method removeRelationship
573      * 
574      * @param vRelationship
575      */
576     public boolean removeRelationship(org.astrogrid.registry.beans.v10.resource.Relationship vRelationship)
577     {
578         boolean removed = _relationshipList.remove(vRelationship);
579         return removed;
580     } //-- boolean removeRelationship(org.astrogrid.registry.beans.v10.resource.Relationship) 
581 
582     /***
583      * Method removeSubject
584      * 
585      * @param vSubject
586      */
587     public boolean removeSubject(java.lang.String vSubject)
588     {
589         boolean removed = _subjectList.remove(vSubject);
590         return removed;
591     } //-- boolean removeSubject(java.lang.String) 
592 
593     /***
594      * Method removeType
595      * 
596      * @param vType
597      */
598     public boolean removeType(org.astrogrid.registry.beans.v10.resource.types.Type vType)
599     {
600         boolean removed = _typeList.remove(vType);
601         return removed;
602     } //-- boolean removeType(org.astrogrid.registry.beans.v10.resource.types.Type) 
603 
604     /***
605      * Method setContentLevel
606      * 
607      * @param index
608      * @param vContentLevel
609      */
610     public void setContentLevel(int index, org.astrogrid.registry.beans.v10.resource.types.ContentLevel vContentLevel)
611         throws java.lang.IndexOutOfBoundsException
612     {
613         //-- check bounds for index
614         if ((index < 0) || (index > _contentLevelList.size())) {
615             throw new IndexOutOfBoundsException();
616         }
617         _contentLevelList.set(index, vContentLevel);
618     } //-- void setContentLevel(int, org.astrogrid.registry.beans.v10.resource.types.ContentLevel) 
619 
620     /***
621      * Method setContentLevel
622      * 
623      * @param contentLevelArray
624      */
625     public void setContentLevel(org.astrogrid.registry.beans.v10.resource.types.ContentLevel[] contentLevelArray)
626     {
627         //-- copy array
628         _contentLevelList.clear();
629         for (int i = 0; i < contentLevelArray.length; i++) {
630             _contentLevelList.add(contentLevelArray[i]);
631         }
632     } //-- void setContentLevel(org.astrogrid.registry.beans.v10.resource.types.ContentLevel) 
633 
634     /***
635      * Sets the value of field 'description'. The field
636      * 'description' has the following description: An account of
637      * the nature of the resource
638      *  
639      * 
640      * @param description the value of field 'description'.
641      */
642     public void setDescription(java.lang.String description)
643     {
644         this._description = description;
645     } //-- void setDescription(java.lang.String) 
646 
647     /***
648      * Sets the value of field 'referenceURL'. The field
649      * 'referenceURL' has the following description: URL pointing
650      * to a human-readable document describing this 
651      *  resource. 
652      *  
653      * 
654      * @param referenceURL the value of field 'referenceURL'.
655      */
656     public void setReferenceURL(java.lang.String referenceURL)
657     {
658         this._referenceURL = referenceURL;
659     } //-- void setReferenceURL(java.lang.String) 
660 
661     /***
662      * Method setRelationship
663      * 
664      * @param index
665      * @param vRelationship
666      */
667     public void setRelationship(int index, org.astrogrid.registry.beans.v10.resource.Relationship vRelationship)
668         throws java.lang.IndexOutOfBoundsException
669     {
670         //-- check bounds for index
671         if ((index < 0) || (index > _relationshipList.size())) {
672             throw new IndexOutOfBoundsException();
673         }
674         _relationshipList.set(index, vRelationship);
675     } //-- void setRelationship(int, org.astrogrid.registry.beans.v10.resource.Relationship) 
676 
677     /***
678      * Method setRelationship
679      * 
680      * @param relationshipArray
681      */
682     public void setRelationship(org.astrogrid.registry.beans.v10.resource.Relationship[] relationshipArray)
683     {
684         //-- copy array
685         _relationshipList.clear();
686         for (int i = 0; i < relationshipArray.length; i++) {
687             _relationshipList.add(relationshipArray[i]);
688         }
689     } //-- void setRelationship(org.astrogrid.registry.beans.v10.resource.Relationship) 
690 
691     /***
692      * Sets the value of field 'source'. The field 'source' has the
693      * following description: a bibliographic reference from which
694      * the present resource is 
695      *  derived or extracted. 
696      *  
697      * 
698      * @param source the value of field 'source'.
699      */
700     public void setSource(org.astrogrid.registry.beans.v10.resource.Source source)
701     {
702         this._source = source;
703     } //-- void setSource(org.astrogrid.registry.beans.v10.resource.Source) 
704 
705     /***
706      * Method setSubject
707      * 
708      * @param index
709      * @param vSubject
710      */
711     public void setSubject(int index, java.lang.String vSubject)
712         throws java.lang.IndexOutOfBoundsException
713     {
714         //-- check bounds for index
715         if ((index < 0) || (index > _subjectList.size())) {
716             throw new IndexOutOfBoundsException();
717         }
718         _subjectList.set(index, vSubject);
719     } //-- void setSubject(int, java.lang.String) 
720 
721     /***
722      * Method setSubject
723      * 
724      * @param subjectArray
725      */
726     public void setSubject(java.lang.String[] subjectArray)
727     {
728         //-- copy array
729         _subjectList.clear();
730         for (int i = 0; i < subjectArray.length; i++) {
731             _subjectList.add(subjectArray[i]);
732         }
733     } //-- void setSubject(java.lang.String) 
734 
735     /***
736      * Method setType
737      * 
738      * @param index
739      * @param vType
740      */
741     public void setType(int index, org.astrogrid.registry.beans.v10.resource.types.Type vType)
742         throws java.lang.IndexOutOfBoundsException
743     {
744         //-- check bounds for index
745         if ((index < 0) || (index > _typeList.size())) {
746             throw new IndexOutOfBoundsException();
747         }
748         _typeList.set(index, vType);
749     } //-- void setType(int, org.astrogrid.registry.beans.v10.resource.types.Type) 
750 
751     /***
752      * Method setType
753      * 
754      * @param typeArray
755      */
756     public void setType(org.astrogrid.registry.beans.v10.resource.types.Type[] typeArray)
757     {
758         //-- copy array
759         _typeList.clear();
760         for (int i = 0; i < typeArray.length; i++) {
761             _typeList.add(typeArray[i]);
762         }
763     } //-- void setType(org.astrogrid.registry.beans.v10.resource.types.Type) 
764 
765     /***
766      * Method unmarshalContent
767      * 
768      * @param reader
769      */
770     public static org.astrogrid.registry.beans.v10.resource.Content unmarshalContent(java.io.Reader reader)
771         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
772     {
773         return (org.astrogrid.registry.beans.v10.resource.Content) Unmarshaller.unmarshal(org.astrogrid.registry.beans.v10.resource.Content.class, reader);
774     } //-- org.astrogrid.registry.beans.v10.resource.Content unmarshalContent(java.io.Reader) 
775 
776     /***
777      * Method validate
778      */
779     public void validate()
780         throws org.exolab.castor.xml.ValidationException
781     {
782         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
783         validator.validate(this);
784     } //-- void validate() 
785 
786 }