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 * Action to take when an error occurs in the wrapped try block
26 * variable specified by 'var' attribute will contain details of
27 * the error.
28 *
29 *
30 * @version $Revision: 1.10 $ $Date: 2007/01/04 16:26:27 $
31 */
32 public class Catch extends org.astrogrid.common.bean.BaseBean
33 implements java.io.Serializable
34 {
35
36
37
38
39
40
41 /***
42 * name of the variable to define to contain the thrown error
43 */
44 private java.lang.String _var;
45
46 /***
47 * Head of the substitution group
48 */
49 private org.astrogrid.workflow.beans.v1.AbstractActivity _activity;
50
51
52
53
54
55
56 public Catch() {
57 super();
58 }
59
60
61
62
63
64
65 /***
66 * Note: hashCode() has not been overriden
67 *
68 * @param obj
69 */
70 public boolean equals(java.lang.Object obj)
71 {
72 if ( this == obj )
73 return true;
74
75 if (super.equals(obj)==false)
76 return false;
77
78 if (obj instanceof Catch) {
79
80 Catch temp = (Catch)obj;
81 if (this._var != null) {
82 if (temp._var == null) return false;
83 else if (!(this._var.equals(temp._var)))
84 return false;
85 }
86 else if (temp._var != null)
87 return false;
88 if (this._activity != null) {
89 if (temp._activity == null) return false;
90 else if (!(this._activity.equals(temp._activity)))
91 return false;
92 }
93 else if (temp._activity != null)
94 return false;
95 return true;
96 }
97 return false;
98 }
99
100 /***
101 * Returns the value of field 'activity'. The field 'activity'
102 * has the following description: Head of the substitution
103 * group
104 *
105 * @return the value of field 'activity'.
106 */
107 public org.astrogrid.workflow.beans.v1.AbstractActivity getActivity()
108 {
109 return this._activity;
110 }
111
112 /***
113 * Returns the value of field 'var'. The field 'var' has the
114 * following description: name of the variable to define to
115 * contain the thrown error
116 *
117 * @return the value of field 'var'.
118 */
119 public java.lang.String getVar()
120 {
121 return this._var;
122 }
123
124 /***
125 * Method isValid
126 */
127 public boolean isValid()
128 {
129 try {
130 validate();
131 }
132 catch (org.exolab.castor.xml.ValidationException vex) {
133 return false;
134 }
135 return true;
136 }
137
138 /***
139 * Method marshal
140 *
141 * @param out
142 */
143 public void marshal(java.io.Writer out)
144 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
145 {
146
147 Marshaller.marshal(this, out);
148 }
149
150 /***
151 * Method marshal
152 *
153 * @param handler
154 */
155 public void marshal(org.xml.sax.ContentHandler handler)
156 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
157 {
158
159 Marshaller.marshal(this, handler);
160 }
161
162 /***
163 * Sets the value of field 'activity'. The field 'activity' has
164 * the following description: Head of the substitution group
165 *
166 * @param activity the value of field 'activity'.
167 */
168 public void setActivity(org.astrogrid.workflow.beans.v1.AbstractActivity activity)
169 {
170 this._activity = activity;
171 }
172
173 /***
174 * Sets the value of field 'var'. The field 'var' has the
175 * following description: name of the variable to define to
176 * contain the thrown error
177 *
178 * @param var the value of field 'var'.
179 */
180 public void setVar(java.lang.String var)
181 {
182 this._var = var;
183 }
184
185 /***
186 * Method unmarshalCatch
187 *
188 * @param reader
189 */
190 public static org.astrogrid.workflow.beans.v1.Catch unmarshalCatch(java.io.Reader reader)
191 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
192 {
193 return (org.astrogrid.workflow.beans.v1.Catch) Unmarshaller.unmarshal(org.astrogrid.workflow.beans.v1.Catch.class, reader);
194 }
195
196 /***
197 * Method validate
198 */
199 public void validate()
200 throws org.exolab.castor.xml.ValidationException
201 {
202 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
203 validator.validate(this);
204 }
205
206 }