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: Table.java,v 1.2 2007/01/04 16:26:25 clq2 Exp $
6    */
7   
8   package org.astrogrid.registry.beans.v10.resource.dataservice;
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 Table.
28   * 
29   * @version $Revision: 1.2 $ $Date: 2007/01/04 16:26:25 $
30   */
31  public class Table extends org.astrogrid.common.bean.BaseBean 
32  implements java.io.Serializable
33  {
34  
35  
36        //--------------------------/
37       //- Class/Member Variables -/
38      //--------------------------/
39  
40      /***
41       * a name for the role this table plays. Recognized
42       *  values include "out", indicating this table is output 
43       *  from a query.
44       *  
45       */
46      private java.lang.String _role;
47  
48      /***
49       * the name of the table 
50       *  
51       */
52      private java.lang.String _name;
53  
54      /***
55       * a description of the tables contents
56       *  
57       */
58      private java.lang.String _description;
59  
60      /***
61       * a description of a table column.
62       *  
63       */
64      private java.util.ArrayList _columnList;
65  
66  
67        //----------------/
68       //- Constructors -/
69      //----------------/
70  
71      public Table() {
72          super();
73          _columnList = new ArrayList();
74      } //-- org.astrogrid.registry.beans.v10.resource.dataservice.Table()
75  
76  
77        //-----------/
78       //- Methods -/
79      //-----------/
80  
81      /***
82       * Method addColumn
83       * 
84       * @param vColumn
85       */
86      public void addColumn(org.astrogrid.registry.beans.v10.resource.dataservice.Param vColumn)
87          throws java.lang.IndexOutOfBoundsException
88      {
89          _columnList.add(vColumn);
90      } //-- void addColumn(org.astrogrid.registry.beans.v10.resource.dataservice.Param) 
91  
92      /***
93       * Method addColumn
94       * 
95       * @param index
96       * @param vColumn
97       */
98      public void addColumn(int index, org.astrogrid.registry.beans.v10.resource.dataservice.Param vColumn)
99          throws java.lang.IndexOutOfBoundsException
100     {
101         _columnList.add(index, vColumn);
102     } //-- void addColumn(int, org.astrogrid.registry.beans.v10.resource.dataservice.Param) 
103 
104     /***
105      * Method clearColumn
106      */
107     public void clearColumn()
108     {
109         _columnList.clear();
110     } //-- void clearColumn() 
111 
112     /***
113      * Method enumerateColumn
114      */
115     public java.util.Enumeration enumerateColumn()
116     {
117         return new org.exolab.castor.util.IteratorEnumeration(_columnList.iterator());
118     } //-- java.util.Enumeration enumerateColumn() 
119 
120     /***
121      * Note: hashCode() has not been overriden
122      * 
123      * @param obj
124      */
125     public boolean equals(java.lang.Object obj)
126     {
127         if ( this == obj )
128             return true;
129         
130         if (super.equals(obj)==false)
131             return false;
132         
133         if (obj instanceof Table) {
134         
135             Table temp = (Table)obj;
136             if (this._role != null) {
137                 if (temp._role == null) return false;
138                 else if (!(this._role.equals(temp._role))) 
139                     return false;
140             }
141             else if (temp._role != null)
142                 return false;
143             if (this._name != null) {
144                 if (temp._name == null) return false;
145                 else if (!(this._name.equals(temp._name))) 
146                     return false;
147             }
148             else if (temp._name != null)
149                 return false;
150             if (this._description != null) {
151                 if (temp._description == null) return false;
152                 else if (!(this._description.equals(temp._description))) 
153                     return false;
154             }
155             else if (temp._description != null)
156                 return false;
157             if (this._columnList != null) {
158                 if (temp._columnList == null) return false;
159                 else if (!(this._columnList.equals(temp._columnList))) 
160                     return false;
161             }
162             else if (temp._columnList != null)
163                 return false;
164             return true;
165         }
166         return false;
167     } //-- boolean equals(java.lang.Object) 
168 
169     /***
170      * Method getColumn
171      * 
172      * @param index
173      */
174     public org.astrogrid.registry.beans.v10.resource.dataservice.Param getColumn(int index)
175         throws java.lang.IndexOutOfBoundsException
176     {
177         //-- check bounds for index
178         if ((index < 0) || (index > _columnList.size())) {
179             throw new IndexOutOfBoundsException();
180         }
181         
182         return (org.astrogrid.registry.beans.v10.resource.dataservice.Param) _columnList.get(index);
183     } //-- org.astrogrid.registry.beans.v10.resource.dataservice.Param getColumn(int) 
184 
185     /***
186      * Method getColumn
187      */
188     public org.astrogrid.registry.beans.v10.resource.dataservice.Param[] getColumn()
189     {
190         int size = _columnList.size();
191         org.astrogrid.registry.beans.v10.resource.dataservice.Param[] mArray = new org.astrogrid.registry.beans.v10.resource.dataservice.Param[size];
192         for (int index = 0; index < size; index++) {
193             mArray[index] = (org.astrogrid.registry.beans.v10.resource.dataservice.Param) _columnList.get(index);
194         }
195         return mArray;
196     } //-- org.astrogrid.registry.beans.v10.resource.dataservice.Param[] getColumn() 
197 
198     /***
199      * Method getColumnCount
200      */
201     public int getColumnCount()
202     {
203         return _columnList.size();
204     } //-- int getColumnCount() 
205 
206     /***
207      * Returns the value of field 'description'. The field
208      * 'description' has the following description: a description
209      * of the tables contents
210      *  
211      * 
212      * @return the value of field 'description'.
213      */
214     public java.lang.String getDescription()
215     {
216         return this._description;
217     } //-- java.lang.String getDescription() 
218 
219     /***
220      * Returns the value of field 'name'. The field 'name' has the
221      * following description: the name of the table 
222      *  
223      * 
224      * @return the value of field 'name'.
225      */
226     public java.lang.String getName()
227     {
228         return this._name;
229     } //-- java.lang.String getName() 
230 
231     /***
232      * Returns the value of field 'role'. The field 'role' has the
233      * following description: a name for the role this table plays.
234      * Recognized
235      *  values include "out", indicating this table is output 
236      *  from a query.
237      *  
238      * 
239      * @return the value of field 'role'.
240      */
241     public java.lang.String getRole()
242     {
243         return this._role;
244     } //-- java.lang.String getRole() 
245 
246     /***
247      * Method isValid
248      */
249     public boolean isValid()
250     {
251         try {
252             validate();
253         }
254         catch (org.exolab.castor.xml.ValidationException vex) {
255             return false;
256         }
257         return true;
258     } //-- boolean isValid() 
259 
260     /***
261      * Method marshal
262      * 
263      * @param out
264      */
265     public void marshal(java.io.Writer out)
266         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
267     {
268         
269         Marshaller.marshal(this, out);
270     } //-- void marshal(java.io.Writer) 
271 
272     /***
273      * Method marshal
274      * 
275      * @param handler
276      */
277     public void marshal(org.xml.sax.ContentHandler handler)
278         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
279     {
280         
281         Marshaller.marshal(this, handler);
282     } //-- void marshal(org.xml.sax.ContentHandler) 
283 
284     /***
285      * Method removeColumn
286      * 
287      * @param vColumn
288      */
289     public boolean removeColumn(org.astrogrid.registry.beans.v10.resource.dataservice.Param vColumn)
290     {
291         boolean removed = _columnList.remove(vColumn);
292         return removed;
293     } //-- boolean removeColumn(org.astrogrid.registry.beans.v10.resource.dataservice.Param) 
294 
295     /***
296      * Method setColumn
297      * 
298      * @param index
299      * @param vColumn
300      */
301     public void setColumn(int index, org.astrogrid.registry.beans.v10.resource.dataservice.Param vColumn)
302         throws java.lang.IndexOutOfBoundsException
303     {
304         //-- check bounds for index
305         if ((index < 0) || (index > _columnList.size())) {
306             throw new IndexOutOfBoundsException();
307         }
308         _columnList.set(index, vColumn);
309     } //-- void setColumn(int, org.astrogrid.registry.beans.v10.resource.dataservice.Param) 
310 
311     /***
312      * Method setColumn
313      * 
314      * @param columnArray
315      */
316     public void setColumn(org.astrogrid.registry.beans.v10.resource.dataservice.Param[] columnArray)
317     {
318         //-- copy array
319         _columnList.clear();
320         for (int i = 0; i < columnArray.length; i++) {
321             _columnList.add(columnArray[i]);
322         }
323     } //-- void setColumn(org.astrogrid.registry.beans.v10.resource.dataservice.Param) 
324 
325     /***
326      * Sets the value of field 'description'. The field
327      * 'description' has the following description: a description
328      * of the tables contents
329      *  
330      * 
331      * @param description the value of field 'description'.
332      */
333     public void setDescription(java.lang.String description)
334     {
335         this._description = description;
336     } //-- void setDescription(java.lang.String) 
337 
338     /***
339      * Sets the value of field 'name'. The field 'name' has the
340      * following description: the name of the table 
341      *  
342      * 
343      * @param name the value of field 'name'.
344      */
345     public void setName(java.lang.String name)
346     {
347         this._name = name;
348     } //-- void setName(java.lang.String) 
349 
350     /***
351      * Sets the value of field 'role'. The field 'role' has the
352      * following description: a name for the role this table plays.
353      * Recognized
354      *  values include "out", indicating this table is output 
355      *  from a query.
356      *  
357      * 
358      * @param role the value of field 'role'.
359      */
360     public void setRole(java.lang.String role)
361     {
362         this._role = role;
363     } //-- void setRole(java.lang.String) 
364 
365     /***
366      * Method unmarshalTable
367      * 
368      * @param reader
369      */
370     public static org.astrogrid.registry.beans.v10.resource.dataservice.Table unmarshalTable(java.io.Reader reader)
371         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
372     {
373         return (org.astrogrid.registry.beans.v10.resource.dataservice.Table) Unmarshaller.unmarshal(org.astrogrid.registry.beans.v10.resource.dataservice.Table.class, reader);
374     } //-- org.astrogrid.registry.beans.v10.resource.dataservice.Table unmarshalTable(java.io.Reader) 
375 
376     /***
377      * Method validate
378      */
379     public void validate()
380         throws org.exolab.castor.xml.ValidationException
381     {
382         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
383         validator.validate(this);
384     } //-- void validate() 
385 
386 }