1
2
3
4
5
6
7
8 package org.astrogrid.workflow.beans.v1;
9
10
11
12
13
14 import java.io.IOException;
15 import java.io.Reader;
16 import java.io.Serializable;
17 import java.io.Writer;
18 import org.astrogrid.community.beans.v1.Credentials;
19 import org.astrogrid.workflow.beans.v1.execution.JobExecutionRecord;
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 * Base element of an Astrogird workflow document, conforming to
28 * the schema
29 * defined for namespace
30 * http://www.astrogrid.org/schema/AGWorkflow/v1
31 *
32 *
33 * @version $Revision: 1.36 $ $Date: 2007/01/04 16:26:26 $
34 */
35 public class Workflow extends org.astrogrid.common.bean.BaseBean
36 implements java.io.Serializable
37 {
38
39
40
41
42
43
44 /***
45 * descriptive name for this workflow
46 */
47 private java.lang.String _name;
48
49 /***
50 * used within the job execution system.
51 */
52 private java.lang.String _id;
53
54 /***
55 * sequence of activities to perform
56 */
57 private org.astrogrid.workflow.beans.v1.Sequence _sequence;
58
59 /***
60 * An optional textual description
61 */
62 private java.lang.String _description;
63
64 /***
65 * Field _credentials
66 */
67 private org.astrogrid.community.beans.v1.Credentials _credentials;
68
69 /***
70 * Details of the execution of this workflow
71 */
72 private org.astrogrid.workflow.beans.v1.execution.JobExecutionRecord _jobExecutionRecord;
73
74
75
76
77
78
79 public Workflow() {
80 super();
81 }
82
83
84
85
86
87
88 /***
89 * Note: hashCode() has not been overriden
90 *
91 * @param obj
92 */
93 public boolean equals(java.lang.Object obj)
94 {
95 if ( this == obj )
96 return true;
97
98 if (super.equals(obj)==false)
99 return false;
100
101 if (obj instanceof Workflow) {
102
103 Workflow temp = (Workflow)obj;
104 if (this._name != null) {
105 if (temp._name == null) return false;
106 else if (!(this._name.equals(temp._name)))
107 return false;
108 }
109 else if (temp._name != null)
110 return false;
111 if (this._id != null) {
112 if (temp._id == null) return false;
113 else if (!(this._id.equals(temp._id)))
114 return false;
115 }
116 else if (temp._id != null)
117 return false;
118 if (this._sequence != null) {
119 if (temp._sequence == null) return false;
120 else if (!(this._sequence.equals(temp._sequence)))
121 return false;
122 }
123 else if (temp._sequence != null)
124 return false;
125 if (this._description != null) {
126 if (temp._description == null) return false;
127 else if (!(this._description.equals(temp._description)))
128 return false;
129 }
130 else if (temp._description != null)
131 return false;
132 if (this._credentials != null) {
133 if (temp._credentials == null) return false;
134 else if (!(this._credentials.equals(temp._credentials)))
135 return false;
136 }
137 else if (temp._credentials != null)
138 return false;
139 if (this._jobExecutionRecord != null) {
140 if (temp._jobExecutionRecord == null) return false;
141 else if (!(this._jobExecutionRecord.equals(temp._jobExecutionRecord)))
142 return false;
143 }
144 else if (temp._jobExecutionRecord != null)
145 return false;
146 return true;
147 }
148 return false;
149 }
150
151 /***
152 * Returns the value of field 'credentials'.
153 *
154 * @return the value of field 'credentials'.
155 */
156 public org.astrogrid.community.beans.v1.Credentials getCredentials()
157 {
158 return this._credentials;
159 }
160
161 /***
162 * Returns the value of field 'description'. The field
163 * 'description' has the following description: An optional
164 * textual description
165 *
166 * @return the value of field 'description'.
167 */
168 public java.lang.String getDescription()
169 {
170 return this._description;
171 }
172
173 /***
174 * Returns the value of field 'id'. The field 'id' has the
175 * following description: used within the job execution system.
176 *
177 * @return the value of field 'id'.
178 */
179 public java.lang.String getId()
180 {
181 return this._id;
182 }
183
184 /***
185 * Returns the value of field 'jobExecutionRecord'. The field
186 * 'jobExecutionRecord' has the following description: Details
187 * of the execution of this workflow
188 *
189 * @return the value of field 'jobExecutionRecord'.
190 */
191 public org.astrogrid.workflow.beans.v1.execution.JobExecutionRecord getJobExecutionRecord()
192 {
193 return this._jobExecutionRecord;
194 }
195
196 /***
197 * Returns the value of field 'name'. The field 'name' has the
198 * following description: descriptive name for this workflow
199 *
200 * @return the value of field 'name'.
201 */
202 public java.lang.String getName()
203 {
204 return this._name;
205 }
206
207 /***
208 * Returns the value of field 'sequence'. The field 'sequence'
209 * has the following description: sequence of activities to
210 * perform
211 *
212 * @return the value of field 'sequence'.
213 */
214 public org.astrogrid.workflow.beans.v1.Sequence getSequence()
215 {
216 return this._sequence;
217 }
218
219 /***
220 * Method isValid
221 */
222 public boolean isValid()
223 {
224 try {
225 validate();
226 }
227 catch (org.exolab.castor.xml.ValidationException vex) {
228 return false;
229 }
230 return true;
231 }
232
233 /***
234 * Method marshal
235 *
236 * @param out
237 */
238 public void marshal(java.io.Writer out)
239 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
240 {
241
242 Marshaller.marshal(this, out);
243 }
244
245 /***
246 * Method marshal
247 *
248 * @param handler
249 */
250 public void marshal(org.xml.sax.ContentHandler handler)
251 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
252 {
253
254 Marshaller.marshal(this, handler);
255 }
256
257 /***
258 * Sets the value of field 'credentials'.
259 *
260 * @param credentials the value of field 'credentials'.
261 */
262 public void setCredentials(org.astrogrid.community.beans.v1.Credentials credentials)
263 {
264 this._credentials = credentials;
265 }
266
267 /***
268 * Sets the value of field 'description'. The field
269 * 'description' has the following description: An optional
270 * textual description
271 *
272 * @param description the value of field 'description'.
273 */
274 public void setDescription(java.lang.String description)
275 {
276 this._description = description;
277 }
278
279 /***
280 * Sets the value of field 'id'. The field 'id' has the
281 * following description: used within the job execution system.
282 *
283 * @param id the value of field 'id'.
284 */
285 public void setId(java.lang.String id)
286 {
287 this._id = id;
288 }
289
290 /***
291 * Sets the value of field 'jobExecutionRecord'. The field
292 * 'jobExecutionRecord' has the following description: Details
293 * of the execution of this workflow
294 *
295 * @param jobExecutionRecord the value of field
296 * 'jobExecutionRecord'.
297 */
298 public void setJobExecutionRecord(org.astrogrid.workflow.beans.v1.execution.JobExecutionRecord jobExecutionRecord)
299 {
300 this._jobExecutionRecord = jobExecutionRecord;
301 }
302
303 /***
304 * Sets the value of field 'name'. The field 'name' has the
305 * following description: descriptive name for this workflow
306 *
307 * @param name the value of field 'name'.
308 */
309 public void setName(java.lang.String name)
310 {
311 this._name = name;
312 }
313
314 /***
315 * Sets the value of field 'sequence'. The field 'sequence' has
316 * the following description: sequence of activities to perform
317 *
318 * @param sequence the value of field 'sequence'.
319 */
320 public void setSequence(org.astrogrid.workflow.beans.v1.Sequence sequence)
321 {
322 this._sequence = sequence;
323 }
324
325 /***
326 * Method unmarshalWorkflow
327 *
328 * @param reader
329 */
330 public static org.astrogrid.workflow.beans.v1.Workflow unmarshalWorkflow(java.io.Reader reader)
331 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
332 {
333 return (org.astrogrid.workflow.beans.v1.Workflow) Unmarshaller.unmarshal(org.astrogrid.workflow.beans.v1.Workflow.class, reader);
334 }
335
336 /***
337 * Method validate
338 */
339 public void validate()
340 throws org.exolab.castor.xml.ValidationException
341 {
342 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
343 validator.validate(this);
344 }
345
346 }