1
2
3
4
5
6
7
8 package org.astrogrid.applications.beans.v1.cea.castor;
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 java.util.Date;
19 import org.astrogrid.applications.beans.v1.cea.castor.types.ExecutionPhase;
20 import org.astrogrid.applications.beans.v1.cea.castor.types.LogLevel;
21 import org.exolab.castor.xml.MarshalException;
22 import org.exolab.castor.xml.Marshaller;
23 import org.exolab.castor.xml.Unmarshaller;
24 import org.exolab.castor.xml.ValidationException;
25 import org.xml.sax.ContentHandler;
26
27 /***
28 * A log entry recorded during execution
29 *
30 * @version $Revision: 1.34 $ $Date: 2007/01/04 16:26:32 $
31 */
32 public class MessageType extends org.astrogrid.common.bean.BaseBean
33 implements java.io.Serializable
34 {
35
36
37
38
39
40
41 /***
42 * Field _content
43 */
44 private java.lang.String _content;
45
46 /***
47 * Field _source
48 */
49 private java.lang.String _source;
50
51 /***
52 * Field _timestamp
53 */
54 private java.util.Date _timestamp;
55
56 /***
57 * Field _level
58 */
59 private org.astrogrid.applications.beans.v1.cea.castor.types.LogLevel _level;
60
61 /***
62 * Field _phase
63 */
64 private org.astrogrid.applications.beans.v1.cea.castor.types.ExecutionPhase _phase;
65
66
67
68
69
70
71 public MessageType() {
72 super();
73 }
74
75
76
77
78
79
80 /***
81 * Note: hashCode() has not been overriden
82 *
83 * @param obj
84 */
85 public boolean equals(java.lang.Object obj)
86 {
87 if ( this == obj )
88 return true;
89
90 if (super.equals(obj)==false)
91 return false;
92
93 if (obj instanceof MessageType) {
94
95 MessageType temp = (MessageType)obj;
96 if (this._content != null) {
97 if (temp._content == null) return false;
98 else if (!(this._content.equals(temp._content)))
99 return false;
100 }
101 else if (temp._content != null)
102 return false;
103 if (this._source != null) {
104 if (temp._source == null) return false;
105 else if (!(this._source.equals(temp._source)))
106 return false;
107 }
108 else if (temp._source != null)
109 return false;
110 if (this._timestamp != null) {
111 if (temp._timestamp == null) return false;
112 else if (!(this._timestamp.equals(temp._timestamp)))
113 return false;
114 }
115 else if (temp._timestamp != null)
116 return false;
117 if (this._level != null) {
118 if (temp._level == null) return false;
119 else if (!(this._level.equals(temp._level)))
120 return false;
121 }
122 else if (temp._level != null)
123 return false;
124 if (this._phase != null) {
125 if (temp._phase == null) return false;
126 else if (!(this._phase.equals(temp._phase)))
127 return false;
128 }
129 else if (temp._phase != null)
130 return false;
131 return true;
132 }
133 return false;
134 }
135
136 /***
137 * Returns the value of field 'content'.
138 *
139 * @return the value of field 'content'.
140 */
141 public java.lang.String getContent()
142 {
143 return this._content;
144 }
145
146 /***
147 * Returns the value of field 'level'.
148 *
149 * @return the value of field 'level'.
150 */
151 public org.astrogrid.applications.beans.v1.cea.castor.types.LogLevel getLevel()
152 {
153 return this._level;
154 }
155
156 /***
157 * Returns the value of field 'phase'.
158 *
159 * @return the value of field 'phase'.
160 */
161 public org.astrogrid.applications.beans.v1.cea.castor.types.ExecutionPhase getPhase()
162 {
163 return this._phase;
164 }
165
166 /***
167 * Returns the value of field 'source'.
168 *
169 * @return the value of field 'source'.
170 */
171 public java.lang.String getSource()
172 {
173 return this._source;
174 }
175
176 /***
177 * Returns the value of field 'timestamp'.
178 *
179 * @return the value of field 'timestamp'.
180 */
181 public java.util.Date getTimestamp()
182 {
183 return this._timestamp;
184 }
185
186 /***
187 * Method isValid
188 */
189 public boolean isValid()
190 {
191 try {
192 validate();
193 }
194 catch (org.exolab.castor.xml.ValidationException vex) {
195 return false;
196 }
197 return true;
198 }
199
200 /***
201 * Method marshal
202 *
203 * @param out
204 */
205 public void marshal(java.io.Writer out)
206 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
207 {
208
209 Marshaller.marshal(this, out);
210 }
211
212 /***
213 * Method marshal
214 *
215 * @param handler
216 */
217 public void marshal(org.xml.sax.ContentHandler handler)
218 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
219 {
220
221 Marshaller.marshal(this, handler);
222 }
223
224 /***
225 * Sets the value of field 'content'.
226 *
227 * @param content the value of field 'content'.
228 */
229 public void setContent(java.lang.String content)
230 {
231 this._content = content;
232 }
233
234 /***
235 * Sets the value of field 'level'.
236 *
237 * @param level the value of field 'level'.
238 */
239 public void setLevel(org.astrogrid.applications.beans.v1.cea.castor.types.LogLevel level)
240 {
241 this._level = level;
242 }
243
244 /***
245 * Sets the value of field 'phase'.
246 *
247 * @param phase the value of field 'phase'.
248 */
249 public void setPhase(org.astrogrid.applications.beans.v1.cea.castor.types.ExecutionPhase phase)
250 {
251 this._phase = phase;
252 }
253
254 /***
255 * Sets the value of field 'source'.
256 *
257 * @param source the value of field 'source'.
258 */
259 public void setSource(java.lang.String source)
260 {
261 this._source = source;
262 }
263
264 /***
265 * Sets the value of field 'timestamp'.
266 *
267 * @param timestamp the value of field 'timestamp'.
268 */
269 public void setTimestamp(java.util.Date timestamp)
270 {
271 this._timestamp = timestamp;
272 }
273
274 /***
275 * Method unmarshalMessageType
276 *
277 * @param reader
278 */
279 public static org.astrogrid.applications.beans.v1.cea.castor.MessageType unmarshalMessageType(java.io.Reader reader)
280 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
281 {
282 return (org.astrogrid.applications.beans.v1.cea.castor.MessageType) Unmarshaller.unmarshal(org.astrogrid.applications.beans.v1.cea.castor.MessageType.class, reader);
283 }
284
285 /***
286 * Method validate
287 */
288 public void validate()
289 throws org.exolab.castor.xml.ValidationException
290 {
291 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
292 validator.validate(this);
293 }
294
295 }