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: Step.java,v 1.36 2007/01/04 16:26:27 clq2 Exp $
6    */
7   
8   package org.astrogrid.workflow.beans.v1;
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.workflow.beans.v1.execution.StepExecutionRecord;
21  import org.astrogrid.workflow.beans.v1.types.JoinType;
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   * a step of the workflow - call to an external CEA application.
30   * 
31   * @version $Revision: 1.36 $ $Date: 2007/01/04 16:26:27 $
32   */
33  public class Step extends org.astrogrid.workflow.beans.v1.AbstractActivity 
34  implements java.io.Serializable
35  {
36  
37  
38        //--------------------------/
39       //- Class/Member Variables -/
40      //--------------------------/
41  
42      /***
43       * descriptive name for this step
44       */
45      private java.lang.String _name;
46  
47      /***
48       * workflow variable in which to store results of this cea call
49       */
50      private java.lang.String _resultVar;
51  
52      /***
53       * @deprecated don't use
54       */
55      private org.astrogrid.workflow.beans.v1.types.JoinType _joinCondition = org.astrogrid.workflow.beans.v1.types.JoinType.valueOf("any");
56  
57      /***
58       * @deprecated don't use
59       */
60      private int _stepNumber;
61  
62      /***
63       * keeps track of state for field: _stepNumber
64       */
65      private boolean _has_stepNumber;
66  
67      /***
68       * @deprecated don't use
69       */
70      private int _sequenceNumber;
71  
72      /***
73       * keeps track of state for field: _sequenceNumber
74       */
75      private boolean _has_sequenceNumber;
76  
77      /***
78       * optional description of this step.
79       */
80      private java.lang.String _description;
81  
82      /***
83       * defines the application to call, and the parameters to pass
84       */
85      private org.astrogrid.workflow.beans.v1.Tool _tool;
86  
87      /***
88       * records of executioins of this step
89       */
90      private java.util.ArrayList _stepExecutionRecordList;
91  
92  
93        //----------------/
94       //- Constructors -/
95      //----------------/
96  
97      public Step() {
98          super();
99          setJoinCondition(org.astrogrid.workflow.beans.v1.types.JoinType.valueOf("any"));
100         _stepExecutionRecordList = new ArrayList();
101     } //-- org.astrogrid.workflow.beans.v1.Step()
102 
103 
104       //-----------/
105      //- Methods -/
106     //-----------/
107 
108     /***
109      * Method addStepExecutionRecord
110      * 
111      * @param vStepExecutionRecord
112      */
113     public void addStepExecutionRecord(org.astrogrid.workflow.beans.v1.execution.StepExecutionRecord vStepExecutionRecord)
114         throws java.lang.IndexOutOfBoundsException
115     {
116         _stepExecutionRecordList.add(vStepExecutionRecord);
117     } //-- void addStepExecutionRecord(org.astrogrid.workflow.beans.v1.execution.StepExecutionRecord) 
118 
119     /***
120      * Method addStepExecutionRecord
121      * 
122      * @param index
123      * @param vStepExecutionRecord
124      */
125     public void addStepExecutionRecord(int index, org.astrogrid.workflow.beans.v1.execution.StepExecutionRecord vStepExecutionRecord)
126         throws java.lang.IndexOutOfBoundsException
127     {
128         _stepExecutionRecordList.add(index, vStepExecutionRecord);
129     } //-- void addStepExecutionRecord(int, org.astrogrid.workflow.beans.v1.execution.StepExecutionRecord) 
130 
131     /***
132      * Method clearStepExecutionRecord
133      */
134     public void clearStepExecutionRecord()
135     {
136         _stepExecutionRecordList.clear();
137     } //-- void clearStepExecutionRecord() 
138 
139     /***
140      * Method deleteSequenceNumber
141      */
142     public void deleteSequenceNumber()
143     {
144         this._has_sequenceNumber= false;
145     } //-- void deleteSequenceNumber() 
146 
147     /***
148      * Method deleteStepNumber
149      */
150     public void deleteStepNumber()
151     {
152         this._has_stepNumber= false;
153     } //-- void deleteStepNumber() 
154 
155     /***
156      * Method enumerateStepExecutionRecord
157      */
158     public java.util.Enumeration enumerateStepExecutionRecord()
159     {
160         return new org.exolab.castor.util.IteratorEnumeration(_stepExecutionRecordList.iterator());
161     } //-- java.util.Enumeration enumerateStepExecutionRecord() 
162 
163     /***
164      * Note: hashCode() has not been overriden
165      * 
166      * @param obj
167      */
168     public boolean equals(java.lang.Object obj)
169     {
170         if ( this == obj )
171             return true;
172         
173         if (super.equals(obj)==false)
174             return false;
175         
176         if (obj instanceof Step) {
177         
178             Step temp = (Step)obj;
179             if (this._name != null) {
180                 if (temp._name == null) return false;
181                 else if (!(this._name.equals(temp._name))) 
182                     return false;
183             }
184             else if (temp._name != null)
185                 return false;
186             if (this._resultVar != null) {
187                 if (temp._resultVar == null) return false;
188                 else if (!(this._resultVar.equals(temp._resultVar))) 
189                     return false;
190             }
191             else if (temp._resultVar != null)
192                 return false;
193             if (this._joinCondition != null) {
194                 if (temp._joinCondition == null) return false;
195                 else if (!(this._joinCondition.equals(temp._joinCondition))) 
196                     return false;
197             }
198             else if (temp._joinCondition != null)
199                 return false;
200             if (this._stepNumber != temp._stepNumber)
201                 return false;
202             if (this._has_stepNumber != temp._has_stepNumber)
203                 return false;
204             if (this._sequenceNumber != temp._sequenceNumber)
205                 return false;
206             if (this._has_sequenceNumber != temp._has_sequenceNumber)
207                 return false;
208             if (this._description != null) {
209                 if (temp._description == null) return false;
210                 else if (!(this._description.equals(temp._description))) 
211                     return false;
212             }
213             else if (temp._description != null)
214                 return false;
215             if (this._tool != null) {
216                 if (temp._tool == null) return false;
217                 else if (!(this._tool.equals(temp._tool))) 
218                     return false;
219             }
220             else if (temp._tool != null)
221                 return false;
222             if (this._stepExecutionRecordList != null) {
223                 if (temp._stepExecutionRecordList == null) return false;
224                 else if (!(this._stepExecutionRecordList.equals(temp._stepExecutionRecordList))) 
225                     return false;
226             }
227             else if (temp._stepExecutionRecordList != null)
228                 return false;
229             return true;
230         }
231         return false;
232     } //-- boolean equals(java.lang.Object) 
233 
234     /***
235      * Returns the value of field 'description'. The field
236      * 'description' has the following description: optional
237      * description of this step.
238      * 
239      * @return the value of field 'description'.
240      */
241     public java.lang.String getDescription()
242     {
243         return this._description;
244     } //-- java.lang.String getDescription() 
245 
246     /***
247      * Returns the value of field 'joinCondition'. The field
248      * 'joinCondition' has the following description: @deprecated
249      * don't use
250      * 
251      * @return the value of field 'joinCondition'.
252      */
253     public org.astrogrid.workflow.beans.v1.types.JoinType getJoinCondition()
254     {
255         return this._joinCondition;
256     } //-- org.astrogrid.workflow.beans.v1.types.JoinType getJoinCondition() 
257 
258     /***
259      * Returns the value of field 'name'. The field 'name' has the
260      * following description: descriptive name for this step
261      * 
262      * @return the value of field 'name'.
263      */
264     public java.lang.String getName()
265     {
266         return this._name;
267     } //-- java.lang.String getName() 
268 
269     /***
270      * Returns the value of field 'resultVar'. The field
271      * 'resultVar' has the following description: workflow variable
272      * in which to store results of this cea call
273      * 
274      * @return the value of field 'resultVar'.
275      */
276     public java.lang.String getResultVar()
277     {
278         return this._resultVar;
279     } //-- java.lang.String getResultVar() 
280 
281     /***
282      * Returns the value of field 'sequenceNumber'. The field
283      * 'sequenceNumber' has the following description: @deprecated
284      * don't use
285      * 
286      * @return the value of field 'sequenceNumber'.
287      */
288     public int getSequenceNumber()
289     {
290         return this._sequenceNumber;
291     } //-- int getSequenceNumber() 
292 
293     /***
294      * Method getStepExecutionRecord
295      * 
296      * @param index
297      */
298     public org.astrogrid.workflow.beans.v1.execution.StepExecutionRecord getStepExecutionRecord(int index)
299         throws java.lang.IndexOutOfBoundsException
300     {
301         //-- check bounds for index
302         if ((index < 0) || (index > _stepExecutionRecordList.size())) {
303             throw new IndexOutOfBoundsException();
304         }
305         
306         return (org.astrogrid.workflow.beans.v1.execution.StepExecutionRecord) _stepExecutionRecordList.get(index);
307     } //-- org.astrogrid.workflow.beans.v1.execution.StepExecutionRecord getStepExecutionRecord(int) 
308 
309     /***
310      * Method getStepExecutionRecord
311      */
312     public org.astrogrid.workflow.beans.v1.execution.StepExecutionRecord[] getStepExecutionRecord()
313     {
314         int size = _stepExecutionRecordList.size();
315         org.astrogrid.workflow.beans.v1.execution.StepExecutionRecord[] mArray = new org.astrogrid.workflow.beans.v1.execution.StepExecutionRecord[size];
316         for (int index = 0; index < size; index++) {
317             mArray[index] = (org.astrogrid.workflow.beans.v1.execution.StepExecutionRecord) _stepExecutionRecordList.get(index);
318         }
319         return mArray;
320     } //-- org.astrogrid.workflow.beans.v1.execution.StepExecutionRecord[] getStepExecutionRecord() 
321 
322     /***
323      * Method getStepExecutionRecordCount
324      */
325     public int getStepExecutionRecordCount()
326     {
327         return _stepExecutionRecordList.size();
328     } //-- int getStepExecutionRecordCount() 
329 
330     /***
331      * Returns the value of field 'stepNumber'. The field
332      * 'stepNumber' has the following description: @deprecated
333      * don't use
334      * 
335      * @return the value of field 'stepNumber'.
336      */
337     public int getStepNumber()
338     {
339         return this._stepNumber;
340     } //-- int getStepNumber() 
341 
342     /***
343      * Returns the value of field 'tool'. The field 'tool' has the
344      * following description: defines the application to call, and
345      * the parameters to pass
346      * 
347      * @return the value of field 'tool'.
348      */
349     public org.astrogrid.workflow.beans.v1.Tool getTool()
350     {
351         return this._tool;
352     } //-- org.astrogrid.workflow.beans.v1.Tool getTool() 
353 
354     /***
355      * Method hasSequenceNumber
356      */
357     public boolean hasSequenceNumber()
358     {
359         return this._has_sequenceNumber;
360     } //-- boolean hasSequenceNumber() 
361 
362     /***
363      * Method hasStepNumber
364      */
365     public boolean hasStepNumber()
366     {
367         return this._has_stepNumber;
368     } //-- boolean hasStepNumber() 
369 
370     /***
371      * Method isValid
372      */
373     public boolean isValid()
374     {
375         try {
376             validate();
377         }
378         catch (org.exolab.castor.xml.ValidationException vex) {
379             return false;
380         }
381         return true;
382     } //-- boolean isValid() 
383 
384     /***
385      * Method marshal
386      * 
387      * @param out
388      */
389     public void marshal(java.io.Writer out)
390         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
391     {
392         
393         Marshaller.marshal(this, out);
394     } //-- void marshal(java.io.Writer) 
395 
396     /***
397      * Method marshal
398      * 
399      * @param handler
400      */
401     public void marshal(org.xml.sax.ContentHandler handler)
402         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
403     {
404         
405         Marshaller.marshal(this, handler);
406     } //-- void marshal(org.xml.sax.ContentHandler) 
407 
408     /***
409      * Method removeStepExecutionRecord
410      * 
411      * @param vStepExecutionRecord
412      */
413     public boolean removeStepExecutionRecord(org.astrogrid.workflow.beans.v1.execution.StepExecutionRecord vStepExecutionRecord)
414     {
415         boolean removed = _stepExecutionRecordList.remove(vStepExecutionRecord);
416         return removed;
417     } //-- boolean removeStepExecutionRecord(org.astrogrid.workflow.beans.v1.execution.StepExecutionRecord) 
418 
419     /***
420      * Sets the value of field 'description'. The field
421      * 'description' has the following description: optional
422      * description of this step.
423      * 
424      * @param description the value of field 'description'.
425      */
426     public void setDescription(java.lang.String description)
427     {
428         this._description = description;
429     } //-- void setDescription(java.lang.String) 
430 
431     /***
432      * Sets the value of field 'joinCondition'. The field
433      * 'joinCondition' has the following description: @deprecated
434      * don't use
435      * 
436      * @param joinCondition the value of field 'joinCondition'.
437      */
438     public void setJoinCondition(org.astrogrid.workflow.beans.v1.types.JoinType joinCondition)
439     {
440         this._joinCondition = joinCondition;
441     } //-- void setJoinCondition(org.astrogrid.workflow.beans.v1.types.JoinType) 
442 
443     /***
444      * Sets the value of field 'name'. The field 'name' has the
445      * following description: descriptive name for this step
446      * 
447      * @param name the value of field 'name'.
448      */
449     public void setName(java.lang.String name)
450     {
451         this._name = name;
452     } //-- void setName(java.lang.String) 
453 
454     /***
455      * Sets the value of field 'resultVar'. The field 'resultVar'
456      * has the following description: workflow variable in which to
457      * store results of this cea call
458      * 
459      * @param resultVar the value of field 'resultVar'.
460      */
461     public void setResultVar(java.lang.String resultVar)
462     {
463         this._resultVar = resultVar;
464     } //-- void setResultVar(java.lang.String) 
465 
466     /***
467      * Sets the value of field 'sequenceNumber'. The field
468      * 'sequenceNumber' has the following description: @deprecated
469      * don't use
470      * 
471      * @param sequenceNumber the value of field 'sequenceNumber'.
472      */
473     public void setSequenceNumber(int sequenceNumber)
474     {
475         this._sequenceNumber = sequenceNumber;
476         this._has_sequenceNumber = true;
477     } //-- void setSequenceNumber(int) 
478 
479     /***
480      * Method setStepExecutionRecord
481      * 
482      * @param index
483      * @param vStepExecutionRecord
484      */
485     public void setStepExecutionRecord(int index, org.astrogrid.workflow.beans.v1.execution.StepExecutionRecord vStepExecutionRecord)
486         throws java.lang.IndexOutOfBoundsException
487     {
488         //-- check bounds for index
489         if ((index < 0) || (index > _stepExecutionRecordList.size())) {
490             throw new IndexOutOfBoundsException();
491         }
492         _stepExecutionRecordList.set(index, vStepExecutionRecord);
493     } //-- void setStepExecutionRecord(int, org.astrogrid.workflow.beans.v1.execution.StepExecutionRecord) 
494 
495     /***
496      * Method setStepExecutionRecord
497      * 
498      * @param stepExecutionRecordArray
499      */
500     public void setStepExecutionRecord(org.astrogrid.workflow.beans.v1.execution.StepExecutionRecord[] stepExecutionRecordArray)
501     {
502         //-- copy array
503         _stepExecutionRecordList.clear();
504         for (int i = 0; i < stepExecutionRecordArray.length; i++) {
505             _stepExecutionRecordList.add(stepExecutionRecordArray[i]);
506         }
507     } //-- void setStepExecutionRecord(org.astrogrid.workflow.beans.v1.execution.StepExecutionRecord) 
508 
509     /***
510      * Sets the value of field 'stepNumber'. The field 'stepNumber'
511      * has the following description: @deprecated don't use
512      * 
513      * @param stepNumber the value of field 'stepNumber'.
514      */
515     public void setStepNumber(int stepNumber)
516     {
517         this._stepNumber = stepNumber;
518         this._has_stepNumber = true;
519     } //-- void setStepNumber(int) 
520 
521     /***
522      * Sets the value of field 'tool'. The field 'tool' has the
523      * following description: defines the application to call, and
524      * the parameters to pass
525      * 
526      * @param tool the value of field 'tool'.
527      */
528     public void setTool(org.astrogrid.workflow.beans.v1.Tool tool)
529     {
530         this._tool = tool;
531     } //-- void setTool(org.astrogrid.workflow.beans.v1.Tool) 
532 
533     /***
534      * Method unmarshalStep
535      * 
536      * @param reader
537      */
538     public static org.astrogrid.workflow.beans.v1.Step unmarshalStep(java.io.Reader reader)
539         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
540     {
541         return (org.astrogrid.workflow.beans.v1.Step) Unmarshaller.unmarshal(org.astrogrid.workflow.beans.v1.Step.class, reader);
542     } //-- org.astrogrid.workflow.beans.v1.Step unmarshalStep(java.io.Reader) 
543 
544     /***
545      * Method validate
546      */
547     public void validate()
548         throws org.exolab.castor.xml.ValidationException
549     {
550         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
551         validator.validate(this);
552     } //-- void validate() 
553 
554 }