1
2
3
4
5
6
7
8 package org.astrogrid.applications.beans.v1.parameters;
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.applications.beans.v1.parameters.types.ParameterTypes;
19 import org.exolab.castor.xml.MarshalException;
20 import org.exolab.castor.xml.Marshaller;
21 import org.exolab.castor.xml.Unmarshaller;
22 import org.exolab.castor.xml.ValidationException;
23 import org.xml.sax.ContentHandler;
24
25 /***
26 * Class BaseParameterDefinition.
27 *
28 * @version $Revision: 1.36 $ $Date: 2007/01/04 16:26:32 $
29 */
30 public class BaseParameterDefinition extends org.astrogrid.common.bean.BaseBean
31 implements java.io.Serializable
32 {
33
34
35
36
37
38
39 /***
40 * Field _name
41 */
42 private java.lang.String _name;
43
44 /***
45 * Field _type
46 */
47 private org.astrogrid.applications.beans.v1.parameters.types.ParameterTypes _type;
48
49 /***
50 * Field _acceptEncodings
51 */
52 private java.lang.String _acceptEncodings = "standard";
53
54 /***
55 * Field _subType
56 */
57 private java.lang.String _subType = "none";
58
59 /***
60 * The name that is to be used to display this parameter in te U
61 */
62 private java.lang.String _UI_Name;
63
64 /***
65 * A long description of the parameter that might be displayed
66 * in the UI to help the user
67 */
68 private org.astrogrid.applications.beans.v1.parameters.XhtmlDocumentation _UI_Description;
69
70 /***
71 * If the parameter has a UCD then use the reference here - it
72 * could help in workflow typing...
73 */
74 private java.lang.String _UCD;
75
76 /***
77 * a possible default for this type of parameter - should
78 * probably be xs:any, but castor/axis do not deal with this wel
79 */
80 private java.lang.String _defaultValue;
81
82 /***
83 * This would ideally be an enumeration of all the possible
84 * types of units?
85 */
86 private java.lang.String _units;
87
88 /***
89 * For parameters that can only have one of a list of values
90 */
91 private org.astrogrid.applications.beans.v1.parameters.OptionList _optionList;
92
93
94
95
96
97
98 public BaseParameterDefinition() {
99 super();
100 setAcceptEncodings("standard");
101 setSubType("none");
102 }
103
104
105
106
107
108
109 /***
110 * Note: hashCode() has not been overriden
111 *
112 * @param obj
113 */
114 public boolean equals(java.lang.Object obj)
115 {
116 if ( this == obj )
117 return true;
118
119 if (super.equals(obj)==false)
120 return false;
121
122 if (obj instanceof BaseParameterDefinition) {
123
124 BaseParameterDefinition temp = (BaseParameterDefinition)obj;
125 if (this._name != null) {
126 if (temp._name == null) return false;
127 else if (!(this._name.equals(temp._name)))
128 return false;
129 }
130 else if (temp._name != null)
131 return false;
132 if (this._type != null) {
133 if (temp._type == null) return false;
134 else if (!(this._type.equals(temp._type)))
135 return false;
136 }
137 else if (temp._type != null)
138 return false;
139 if (this._acceptEncodings != null) {
140 if (temp._acceptEncodings == null) return false;
141 else if (!(this._acceptEncodings.equals(temp._acceptEncodings)))
142 return false;
143 }
144 else if (temp._acceptEncodings != null)
145 return false;
146 if (this._subType != null) {
147 if (temp._subType == null) return false;
148 else if (!(this._subType.equals(temp._subType)))
149 return false;
150 }
151 else if (temp._subType != null)
152 return false;
153 if (this._UI_Name != null) {
154 if (temp._UI_Name == null) return false;
155 else if (!(this._UI_Name.equals(temp._UI_Name)))
156 return false;
157 }
158 else if (temp._UI_Name != null)
159 return false;
160 if (this._UI_Description != null) {
161 if (temp._UI_Description == null) return false;
162 else if (!(this._UI_Description.equals(temp._UI_Description)))
163 return false;
164 }
165 else if (temp._UI_Description != null)
166 return false;
167 if (this._UCD != null) {
168 if (temp._UCD == null) return false;
169 else if (!(this._UCD.equals(temp._UCD)))
170 return false;
171 }
172 else if (temp._UCD != null)
173 return false;
174 if (this._defaultValue != null) {
175 if (temp._defaultValue == null) return false;
176 else if (!(this._defaultValue.equals(temp._defaultValue)))
177 return false;
178 }
179 else if (temp._defaultValue != null)
180 return false;
181 if (this._units != null) {
182 if (temp._units == null) return false;
183 else if (!(this._units.equals(temp._units)))
184 return false;
185 }
186 else if (temp._units != null)
187 return false;
188 if (this._optionList != null) {
189 if (temp._optionList == null) return false;
190 else if (!(this._optionList.equals(temp._optionList)))
191 return false;
192 }
193 else if (temp._optionList != null)
194 return false;
195 return true;
196 }
197 return false;
198 }
199
200 /***
201 * Returns the value of field 'acceptEncodings'.
202 *
203 * @return the value of field 'acceptEncodings'.
204 */
205 public java.lang.String getAcceptEncodings()
206 {
207 return this._acceptEncodings;
208 }
209
210 /***
211 * Returns the value of field 'defaultValue'. The field
212 * 'defaultValue' has the following description: a possible
213 * default for this type of parameter - should probably be
214 * xs:any, but castor/axis do not deal with this well
215 *
216 * @return the value of field 'defaultValue'.
217 */
218 public java.lang.String getDefaultValue()
219 {
220 return this._defaultValue;
221 }
222
223 /***
224 * Returns the value of field 'name'.
225 *
226 * @return the value of field 'name'.
227 */
228 public java.lang.String getName()
229 {
230 return this._name;
231 }
232
233 /***
234 * Returns the value of field 'optionList'. The field
235 * 'optionList' has the following description: For parameters
236 * that can only have one of a list of values
237 *
238 * @return the value of field 'optionList'.
239 */
240 public org.astrogrid.applications.beans.v1.parameters.OptionList getOptionList()
241 {
242 return this._optionList;
243 }
244
245 /***
246 * Returns the value of field 'subType'.
247 *
248 * @return the value of field 'subType'.
249 */
250 public java.lang.String getSubType()
251 {
252 return this._subType;
253 }
254
255 /***
256 * Returns the value of field 'type'.
257 *
258 * @return the value of field 'type'.
259 */
260 public org.astrogrid.applications.beans.v1.parameters.types.ParameterTypes getType()
261 {
262 return this._type;
263 }
264
265 /***
266 * Returns the value of field 'UCD'. The field 'UCD' has the
267 * following description: If the parameter has a UCD then use
268 * the reference here - it could help in workflow typing...
269 *
270 * @return the value of field 'UCD'.
271 */
272 public java.lang.String getUCD()
273 {
274 return this._UCD;
275 }
276
277 /***
278 * Returns the value of field 'UI_Description'. The field
279 * 'UI_Description' has the following description: A long
280 * description of the parameter that might be displayed in the
281 * UI to help the user
282 *
283 * @return the value of field 'UI_Description'.
284 */
285 public org.astrogrid.applications.beans.v1.parameters.XhtmlDocumentation getUI_Description()
286 {
287 return this._UI_Description;
288 }
289
290 /***
291 * Returns the value of field 'UI_Name'. The field 'UI_Name'
292 * has the following description: The name that is to be used
293 * to display this parameter in te UI
294 *
295 * @return the value of field 'UI_Name'.
296 */
297 public java.lang.String getUI_Name()
298 {
299 return this._UI_Name;
300 }
301
302 /***
303 * Returns the value of field 'units'. The field 'units' has
304 * the following description: This would ideally be an
305 * enumeration of all the possible types of units?
306 *
307 * @return the value of field 'units'.
308 */
309 public java.lang.String getUnits()
310 {
311 return this._units;
312 }
313
314 /***
315 * Method isValid
316 */
317 public boolean isValid()
318 {
319 try {
320 validate();
321 }
322 catch (org.exolab.castor.xml.ValidationException vex) {
323 return false;
324 }
325 return true;
326 }
327
328 /***
329 * Method marshal
330 *
331 * @param out
332 */
333 public void marshal(java.io.Writer out)
334 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
335 {
336
337 Marshaller.marshal(this, out);
338 }
339
340 /***
341 * Method marshal
342 *
343 * @param handler
344 */
345 public void marshal(org.xml.sax.ContentHandler handler)
346 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
347 {
348
349 Marshaller.marshal(this, handler);
350 }
351
352 /***
353 * Sets the value of field 'acceptEncodings'.
354 *
355 * @param acceptEncodings the value of field 'acceptEncodings'.
356 */
357 public void setAcceptEncodings(java.lang.String acceptEncodings)
358 {
359 this._acceptEncodings = acceptEncodings;
360 }
361
362 /***
363 * Sets the value of field 'defaultValue'. The field
364 * 'defaultValue' has the following description: a possible
365 * default for this type of parameter - should probably be
366 * xs:any, but castor/axis do not deal with this well
367 *
368 * @param defaultValue the value of field 'defaultValue'.
369 */
370 public void setDefaultValue(java.lang.String defaultValue)
371 {
372 this._defaultValue = defaultValue;
373 }
374
375 /***
376 * Sets the value of field 'name'.
377 *
378 * @param name the value of field 'name'.
379 */
380 public void setName(java.lang.String name)
381 {
382 this._name = name;
383 }
384
385 /***
386 * Sets the value of field 'optionList'. The field 'optionList'
387 * has the following description: For parameters that can only
388 * have one of a list of values
389 *
390 * @param optionList the value of field 'optionList'.
391 */
392 public void setOptionList(org.astrogrid.applications.beans.v1.parameters.OptionList optionList)
393 {
394 this._optionList = optionList;
395 }
396
397 /***
398 * Sets the value of field 'subType'.
399 *
400 * @param subType the value of field 'subType'.
401 */
402 public void setSubType(java.lang.String subType)
403 {
404 this._subType = subType;
405 }
406
407 /***
408 * Sets the value of field 'type'.
409 *
410 * @param type the value of field 'type'.
411 */
412 public void setType(org.astrogrid.applications.beans.v1.parameters.types.ParameterTypes type)
413 {
414 this._type = type;
415 }
416
417 /***
418 * Sets the value of field 'UCD'. The field 'UCD' has the
419 * following description: If the parameter has a UCD then use
420 * the reference here - it could help in workflow typing...
421 *
422 * @param UCD the value of field 'UCD'.
423 */
424 public void setUCD(java.lang.String UCD)
425 {
426 this._UCD = UCD;
427 }
428
429 /***
430 * Sets the value of field 'UI_Description'. The field
431 * 'UI_Description' has the following description: A long
432 * description of the parameter that might be displayed in the
433 * UI to help the user
434 *
435 * @param UI_Description the value of field 'UI_Description'.
436 */
437 public void setUI_Description(org.astrogrid.applications.beans.v1.parameters.XhtmlDocumentation UI_Description)
438 {
439 this._UI_Description = UI_Description;
440 }
441
442 /***
443 * Sets the value of field 'UI_Name'. The field 'UI_Name' has
444 * the following description: The name that is to be used to
445 * display this parameter in te UI
446 *
447 * @param UI_Name the value of field 'UI_Name'.
448 */
449 public void setUI_Name(java.lang.String UI_Name)
450 {
451 this._UI_Name = UI_Name;
452 }
453
454 /***
455 * Sets the value of field 'units'. The field 'units' has the
456 * following description: This would ideally be an enumeration
457 * of all the possible types of units?
458 *
459 * @param units the value of field 'units'.
460 */
461 public void setUnits(java.lang.String units)
462 {
463 this._units = units;
464 }
465
466 /***
467 * Method unmarshalBaseParameterDefinition
468 *
469 * @param reader
470 */
471 public static org.astrogrid.applications.beans.v1.parameters.BaseParameterDefinition unmarshalBaseParameterDefinition(java.io.Reader reader)
472 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
473 {
474 return (org.astrogrid.applications.beans.v1.parameters.BaseParameterDefinition) Unmarshaller.unmarshal(org.astrogrid.applications.beans.v1.parameters.BaseParameterDefinition.class, reader);
475 }
476
477 /***
478 * Method validate
479 */
480 public void validate()
481 throws org.exolab.castor.xml.ValidationException
482 {
483 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
484 validator.validate(this);
485 }
486
487 }