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.exolab.castor.xml.MarshalException;
19 import org.exolab.castor.xml.Marshaller;
20 import org.exolab.castor.xml.Unmarshaller;
21 import org.exolab.castor.xml.ValidationException;
22 import org.xml.sax.ContentHandler;
23
24 /***
25 * create a new workflow-variable scope for its body. any variables
26 * defined within
27 * its body will no longer be in scope after the end tag.
28 *
29 *
30 * @version $Revision: 1.10 $ $Date: 2007/01/04 16:26:26 $
31 */
32 public class Scope extends org.astrogrid.workflow.beans.v1.AbstractActivity
33 implements java.io.Serializable
34 {
35
36
37
38
39
40
41 /***
42 * Head of the substitution group
43 */
44 private org.astrogrid.workflow.beans.v1.AbstractActivity _activity;
45
46
47
48
49
50
51 public Scope() {
52 super();
53 }
54
55
56
57
58
59
60 /***
61 * Note: hashCode() has not been overriden
62 *
63 * @param obj
64 */
65 public boolean equals(java.lang.Object obj)
66 {
67 if ( this == obj )
68 return true;
69
70 if (super.equals(obj)==false)
71 return false;
72
73 if (obj instanceof Scope) {
74
75 Scope temp = (Scope)obj;
76 if (this._activity != null) {
77 if (temp._activity == null) return false;
78 else if (!(this._activity.equals(temp._activity)))
79 return false;
80 }
81 else if (temp._activity != null)
82 return false;
83 return true;
84 }
85 return false;
86 }
87
88 /***
89 * Returns the value of field 'activity'. The field 'activity'
90 * has the following description: Head of the substitution
91 * group
92 *
93 * @return the value of field 'activity'.
94 */
95 public org.astrogrid.workflow.beans.v1.AbstractActivity getActivity()
96 {
97 return this._activity;
98 }
99
100 /***
101 * Method isValid
102 */
103 public boolean isValid()
104 {
105 try {
106 validate();
107 }
108 catch (org.exolab.castor.xml.ValidationException vex) {
109 return false;
110 }
111 return true;
112 }
113
114 /***
115 * Method marshal
116 *
117 * @param out
118 */
119 public void marshal(java.io.Writer out)
120 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
121 {
122
123 Marshaller.marshal(this, out);
124 }
125
126 /***
127 * Method marshal
128 *
129 * @param handler
130 */
131 public void marshal(org.xml.sax.ContentHandler handler)
132 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
133 {
134
135 Marshaller.marshal(this, handler);
136 }
137
138 /***
139 * Sets the value of field 'activity'. The field 'activity' has
140 * the following description: Head of the substitution group
141 *
142 * @param activity the value of field 'activity'.
143 */
144 public void setActivity(org.astrogrid.workflow.beans.v1.AbstractActivity activity)
145 {
146 this._activity = activity;
147 }
148
149 /***
150 * Method unmarshalScope
151 *
152 * @param reader
153 */
154 public static org.astrogrid.workflow.beans.v1.Scope unmarshalScope(java.io.Reader reader)
155 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
156 {
157 return (org.astrogrid.workflow.beans.v1.Scope) Unmarshaller.unmarshal(org.astrogrid.workflow.beans.v1.Scope.class, reader);
158 }
159
160 /***
161 * Method validate
162 */
163 public void validate()
164 throws org.exolab.castor.xml.ValidationException
165 {
166 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
167 validator.validate(this);
168 }
169
170 }