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: ExecutionRecordType.java,v 1.30 2007/01/04 16:26:08 clq2 Exp $
6    */
7   
8   package org.astrogrid.workflow.beans.v1.execution;
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.Date;
20  import java.util.Enumeration;
21  import org.astrogrid.applications.beans.v1.cea.castor.MessageType;
22  import org.astrogrid.applications.beans.v1.cea.castor.types.ExecutionPhase;
23  import org.exolab.castor.xml.MarshalException;
24  import org.exolab.castor.xml.Marshaller;
25  import org.exolab.castor.xml.Unmarshaller;
26  import org.exolab.castor.xml.ValidationException;
27  import org.xml.sax.ContentHandler;
28  
29  /***
30   * basic type for execution records
31   * 
32   * @version $Revision: 1.30 $ $Date: 2007/01/04 16:26:08 $
33   */
34  public class ExecutionRecordType extends org.astrogrid.common.bean.BaseBean 
35  implements java.io.Serializable
36  {
37  
38  
39        //--------------------------/
40       //- Class/Member Variables -/
41      //--------------------------/
42  
43      /***
44       * time execution started
45       */
46      private java.util.Date _startTime;
47  
48      /***
49       * time execution finished
50       */
51      private java.util.Date _finishTime;
52  
53      /***
54       * current execution status
55       */
56      private org.astrogrid.applications.beans.v1.cea.castor.types.ExecutionPhase _status = org.astrogrid.applications.beans.v1.cea.castor.types.ExecutionPhase.valueOf("PENDING");
57  
58      /***
59       * A string 'buffer' for holding further information, keyed by
60       * attribute - so execution record becomes a map.
61       */
62      private java.util.ArrayList _extensionList;
63  
64      /***
65       * Field _messageList
66       */
67      private java.util.ArrayList _messageList;
68  
69  
70        //----------------/
71       //- Constructors -/
72      //----------------/
73  
74      public ExecutionRecordType() {
75          super();
76          setStatus(org.astrogrid.applications.beans.v1.cea.castor.types.ExecutionPhase.valueOf("PENDING"));
77          _extensionList = new ArrayList();
78          _messageList = new ArrayList();
79      } //-- org.astrogrid.workflow.beans.v1.execution.ExecutionRecordType()
80  
81  
82        //-----------/
83       //- Methods -/
84      //-----------/
85  
86      /***
87       * Method addExtension
88       * 
89       * @param vExtension
90       */
91      public void addExtension(org.astrogrid.workflow.beans.v1.execution.Extension vExtension)
92          throws java.lang.IndexOutOfBoundsException
93      {
94          _extensionList.add(vExtension);
95      } //-- void addExtension(org.astrogrid.workflow.beans.v1.execution.Extension) 
96  
97      /***
98       * Method addExtension
99       * 
100      * @param index
101      * @param vExtension
102      */
103     public void addExtension(int index, org.astrogrid.workflow.beans.v1.execution.Extension vExtension)
104         throws java.lang.IndexOutOfBoundsException
105     {
106         _extensionList.add(index, vExtension);
107     } //-- void addExtension(int, org.astrogrid.workflow.beans.v1.execution.Extension) 
108 
109     /***
110      * Method addMessage
111      * 
112      * @param vMessage
113      */
114     public void addMessage(org.astrogrid.applications.beans.v1.cea.castor.MessageType vMessage)
115         throws java.lang.IndexOutOfBoundsException
116     {
117         _messageList.add(vMessage);
118     } //-- void addMessage(org.astrogrid.applications.beans.v1.cea.castor.MessageType) 
119 
120     /***
121      * Method addMessage
122      * 
123      * @param index
124      * @param vMessage
125      */
126     public void addMessage(int index, org.astrogrid.applications.beans.v1.cea.castor.MessageType vMessage)
127         throws java.lang.IndexOutOfBoundsException
128     {
129         _messageList.add(index, vMessage);
130     } //-- void addMessage(int, org.astrogrid.applications.beans.v1.cea.castor.MessageType) 
131 
132     /***
133      * Method clearExtension
134      */
135     public void clearExtension()
136     {
137         _extensionList.clear();
138     } //-- void clearExtension() 
139 
140     /***
141      * Method clearMessage
142      */
143     public void clearMessage()
144     {
145         _messageList.clear();
146     } //-- void clearMessage() 
147 
148     /***
149      * Method enumerateExtension
150      */
151     public java.util.Enumeration enumerateExtension()
152     {
153         return new org.exolab.castor.util.IteratorEnumeration(_extensionList.iterator());
154     } //-- java.util.Enumeration enumerateExtension() 
155 
156     /***
157      * Method enumerateMessage
158      */
159     public java.util.Enumeration enumerateMessage()
160     {
161         return new org.exolab.castor.util.IteratorEnumeration(_messageList.iterator());
162     } //-- java.util.Enumeration enumerateMessage() 
163 
164     /***
165      * Note: hashCode() has not been overriden
166      * 
167      * @param obj
168      */
169     public boolean equals(java.lang.Object obj)
170     {
171         if ( this == obj )
172             return true;
173         
174         if (super.equals(obj)==false)
175             return false;
176         
177         if (obj instanceof ExecutionRecordType) {
178         
179             ExecutionRecordType temp = (ExecutionRecordType)obj;
180             if (this._startTime != null) {
181                 if (temp._startTime == null) return false;
182                 else if (!(this._startTime.equals(temp._startTime))) 
183                     return false;
184             }
185             else if (temp._startTime != null)
186                 return false;
187             if (this._finishTime != null) {
188                 if (temp._finishTime == null) return false;
189                 else if (!(this._finishTime.equals(temp._finishTime))) 
190                     return false;
191             }
192             else if (temp._finishTime != null)
193                 return false;
194             if (this._status != null) {
195                 if (temp._status == null) return false;
196                 else if (!(this._status.equals(temp._status))) 
197                     return false;
198             }
199             else if (temp._status != null)
200                 return false;
201             if (this._extensionList != null) {
202                 if (temp._extensionList == null) return false;
203                 else if (!(this._extensionList.equals(temp._extensionList))) 
204                     return false;
205             }
206             else if (temp._extensionList != null)
207                 return false;
208             if (this._messageList != null) {
209                 if (temp._messageList == null) return false;
210                 else if (!(this._messageList.equals(temp._messageList))) 
211                     return false;
212             }
213             else if (temp._messageList != null)
214                 return false;
215             return true;
216         }
217         return false;
218     } //-- boolean equals(java.lang.Object) 
219 
220     /***
221      * Method getExtension
222      * 
223      * @param index
224      */
225     public org.astrogrid.workflow.beans.v1.execution.Extension getExtension(int index)
226         throws java.lang.IndexOutOfBoundsException
227     {
228         //-- check bounds for index
229         if ((index < 0) || (index > _extensionList.size())) {
230             throw new IndexOutOfBoundsException();
231         }
232         
233         return (org.astrogrid.workflow.beans.v1.execution.Extension) _extensionList.get(index);
234     } //-- org.astrogrid.workflow.beans.v1.execution.Extension getExtension(int) 
235 
236     /***
237      * Method getExtension
238      */
239     public org.astrogrid.workflow.beans.v1.execution.Extension[] getExtension()
240     {
241         int size = _extensionList.size();
242         org.astrogrid.workflow.beans.v1.execution.Extension[] mArray = new org.astrogrid.workflow.beans.v1.execution.Extension[size];
243         for (int index = 0; index < size; index++) {
244             mArray[index] = (org.astrogrid.workflow.beans.v1.execution.Extension) _extensionList.get(index);
245         }
246         return mArray;
247     } //-- org.astrogrid.workflow.beans.v1.execution.Extension[] getExtension() 
248 
249     /***
250      * Method getExtensionCount
251      */
252     public int getExtensionCount()
253     {
254         return _extensionList.size();
255     } //-- int getExtensionCount() 
256 
257     /***
258      * Returns the value of field 'finishTime'. The field
259      * 'finishTime' has the following description: time execution
260      * finished
261      * 
262      * @return the value of field 'finishTime'.
263      */
264     public java.util.Date getFinishTime()
265     {
266         return this._finishTime;
267     } //-- java.util.Date getFinishTime() 
268 
269     /***
270      * Method getMessage
271      * 
272      * @param index
273      */
274     public org.astrogrid.applications.beans.v1.cea.castor.MessageType getMessage(int index)
275         throws java.lang.IndexOutOfBoundsException
276     {
277         //-- check bounds for index
278         if ((index < 0) || (index > _messageList.size())) {
279             throw new IndexOutOfBoundsException();
280         }
281         
282         return (org.astrogrid.applications.beans.v1.cea.castor.MessageType) _messageList.get(index);
283     } //-- org.astrogrid.applications.beans.v1.cea.castor.MessageType getMessage(int) 
284 
285     /***
286      * Method getMessage
287      */
288     public org.astrogrid.applications.beans.v1.cea.castor.MessageType[] getMessage()
289     {
290         int size = _messageList.size();
291         org.astrogrid.applications.beans.v1.cea.castor.MessageType[] mArray = new org.astrogrid.applications.beans.v1.cea.castor.MessageType[size];
292         for (int index = 0; index < size; index++) {
293             mArray[index] = (org.astrogrid.applications.beans.v1.cea.castor.MessageType) _messageList.get(index);
294         }
295         return mArray;
296     } //-- org.astrogrid.applications.beans.v1.cea.castor.MessageType[] getMessage() 
297 
298     /***
299      * Method getMessageCount
300      */
301     public int getMessageCount()
302     {
303         return _messageList.size();
304     } //-- int getMessageCount() 
305 
306     /***
307      * Returns the value of field 'startTime'. The field
308      * 'startTime' has the following description: time execution
309      * started
310      * 
311      * @return the value of field 'startTime'.
312      */
313     public java.util.Date getStartTime()
314     {
315         return this._startTime;
316     } //-- java.util.Date getStartTime() 
317 
318     /***
319      * Returns the value of field 'status'. The field 'status' has
320      * the following description: current execution status
321      * 
322      * @return the value of field 'status'.
323      */
324     public org.astrogrid.applications.beans.v1.cea.castor.types.ExecutionPhase getStatus()
325     {
326         return this._status;
327     } //-- org.astrogrid.applications.beans.v1.cea.castor.types.ExecutionPhase getStatus() 
328 
329     /***
330      * Method isValid
331      */
332     public boolean isValid()
333     {
334         try {
335             validate();
336         }
337         catch (org.exolab.castor.xml.ValidationException vex) {
338             return false;
339         }
340         return true;
341     } //-- boolean isValid() 
342 
343     /***
344      * Method marshal
345      * 
346      * @param out
347      */
348     public void marshal(java.io.Writer out)
349         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
350     {
351         
352         Marshaller.marshal(this, out);
353     } //-- void marshal(java.io.Writer) 
354 
355     /***
356      * Method marshal
357      * 
358      * @param handler
359      */
360     public void marshal(org.xml.sax.ContentHandler handler)
361         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
362     {
363         
364         Marshaller.marshal(this, handler);
365     } //-- void marshal(org.xml.sax.ContentHandler) 
366 
367     /***
368      * Method removeExtension
369      * 
370      * @param vExtension
371      */
372     public boolean removeExtension(org.astrogrid.workflow.beans.v1.execution.Extension vExtension)
373     {
374         boolean removed = _extensionList.remove(vExtension);
375         return removed;
376     } //-- boolean removeExtension(org.astrogrid.workflow.beans.v1.execution.Extension) 
377 
378     /***
379      * Method removeMessage
380      * 
381      * @param vMessage
382      */
383     public boolean removeMessage(org.astrogrid.applications.beans.v1.cea.castor.MessageType vMessage)
384     {
385         boolean removed = _messageList.remove(vMessage);
386         return removed;
387     } //-- boolean removeMessage(org.astrogrid.applications.beans.v1.cea.castor.MessageType) 
388 
389     /***
390      * Method setExtension
391      * 
392      * @param index
393      * @param vExtension
394      */
395     public void setExtension(int index, org.astrogrid.workflow.beans.v1.execution.Extension vExtension)
396         throws java.lang.IndexOutOfBoundsException
397     {
398         //-- check bounds for index
399         if ((index < 0) || (index > _extensionList.size())) {
400             throw new IndexOutOfBoundsException();
401         }
402         _extensionList.set(index, vExtension);
403     } //-- void setExtension(int, org.astrogrid.workflow.beans.v1.execution.Extension) 
404 
405     /***
406      * Method setExtension
407      * 
408      * @param extensionArray
409      */
410     public void setExtension(org.astrogrid.workflow.beans.v1.execution.Extension[] extensionArray)
411     {
412         //-- copy array
413         _extensionList.clear();
414         for (int i = 0; i < extensionArray.length; i++) {
415             _extensionList.add(extensionArray[i]);
416         }
417     } //-- void setExtension(org.astrogrid.workflow.beans.v1.execution.Extension) 
418 
419     /***
420      * Sets the value of field 'finishTime'. The field 'finishTime'
421      * has the following description: time execution finished
422      * 
423      * @param finishTime the value of field 'finishTime'.
424      */
425     public void setFinishTime(java.util.Date finishTime)
426     {
427         this._finishTime = finishTime;
428     } //-- void setFinishTime(java.util.Date) 
429 
430     /***
431      * Method setMessage
432      * 
433      * @param index
434      * @param vMessage
435      */
436     public void setMessage(int index, org.astrogrid.applications.beans.v1.cea.castor.MessageType vMessage)
437         throws java.lang.IndexOutOfBoundsException
438     {
439         //-- check bounds for index
440         if ((index < 0) || (index > _messageList.size())) {
441             throw new IndexOutOfBoundsException();
442         }
443         _messageList.set(index, vMessage);
444     } //-- void setMessage(int, org.astrogrid.applications.beans.v1.cea.castor.MessageType) 
445 
446     /***
447      * Method setMessage
448      * 
449      * @param messageArray
450      */
451     public void setMessage(org.astrogrid.applications.beans.v1.cea.castor.MessageType[] messageArray)
452     {
453         //-- copy array
454         _messageList.clear();
455         for (int i = 0; i < messageArray.length; i++) {
456             _messageList.add(messageArray[i]);
457         }
458     } //-- void setMessage(org.astrogrid.applications.beans.v1.cea.castor.MessageType) 
459 
460     /***
461      * Sets the value of field 'startTime'. The field 'startTime'
462      * has the following description: time execution started
463      * 
464      * @param startTime the value of field 'startTime'.
465      */
466     public void setStartTime(java.util.Date startTime)
467     {
468         this._startTime = startTime;
469     } //-- void setStartTime(java.util.Date) 
470 
471     /***
472      * Sets the value of field 'status'. The field 'status' has the
473      * following description: current execution status
474      * 
475      * @param status the value of field 'status'.
476      */
477     public void setStatus(org.astrogrid.applications.beans.v1.cea.castor.types.ExecutionPhase status)
478     {
479         this._status = status;
480     } //-- void setStatus(org.astrogrid.applications.beans.v1.cea.castor.types.ExecutionPhase) 
481 
482     /***
483      * Method unmarshalExecutionRecordType
484      * 
485      * @param reader
486      */
487     public static org.astrogrid.workflow.beans.v1.execution.ExecutionRecordType unmarshalExecutionRecordType(java.io.Reader reader)
488         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
489     {
490         return (org.astrogrid.workflow.beans.v1.execution.ExecutionRecordType) Unmarshaller.unmarshal(org.astrogrid.workflow.beans.v1.execution.ExecutionRecordType.class, reader);
491     } //-- org.astrogrid.workflow.beans.v1.execution.ExecutionRecordType unmarshalExecutionRecordType(java.io.Reader) 
492 
493     /***
494      * Method validate
495      */
496     public void validate()
497         throws org.exolab.castor.xml.ValidationException
498     {
499         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
500         validator.validate(this);
501     } //-- void validate() 
502 
503 }