refactored org to uk
[vamsas.git] / src / uk / ac / vamsas / objects / core / Attachment.java
1 /*\r
2  * This class was automatically generated with \r
3  * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
4  * Schema.\r
5  * $Id$\r
6  */\r
7 \r
8 package uk.ac.vamsas.objects.core;\r
9 \r
10   //---------------------------------/\r
11  //- Imported classes and packages -/\r
12 //---------------------------------/\r
13 \r
14 import java.io.IOException;\r
15 import java.io.Reader;\r
16 import java.io.Serializable;\r
17 import java.io.Writer;\r
18 import org.exolab.castor.xml.MarshalException;\r
19 import org.exolab.castor.xml.Marshaller;\r
20 import org.exolab.castor.xml.Unmarshaller;\r
21 import org.exolab.castor.xml.ValidationException;\r
22 import org.xml.sax.ContentHandler;\r
23 \r
24 /**\r
25  * Class Attachment.\r
26  * \r
27  * @version $Revision$ $Date$\r
28  */\r
29 public class Attachment extends uk.ac.vamsas.objects.core.AppData \r
30 implements java.io.Serializable\r
31 {\r
32 \r
33 \r
34       //--------------------------/\r
35      //- Class/Member Variables -/\r
36     //--------------------------/\r
37 \r
38     /**\r
39      * true implies data will be decompresses with Zip\r
40      *  before presenting to application \r
41      */\r
42     private boolean _compressed = false;\r
43 \r
44     /**\r
45      * keeps track of state for field: _compressed\r
46      */\r
47     private boolean _has_compressed;\r
48 \r
49     /**\r
50      * Type of arbitrary data - TODO: decide format - use\r
51      *  (extended) MIME types ? \r
52      */\r
53     private java.lang.String _type;\r
54 \r
55     /**\r
56      * Object the arbitrary data is associated with\r
57      *  \r
58      */\r
59     private java.lang.Object _objectref;\r
60 \r
61     /**\r
62      * Primary Key for vamsas object referencing\r
63      *  \r
64      */\r
65     private java.lang.String _id;\r
66 \r
67 \r
68       //----------------/\r
69      //- Constructors -/\r
70     //----------------/\r
71 \r
72     public Attachment() \r
73      {\r
74         super();\r
75     } //-- uk.ac.vamsas.objects.core.Attachment()\r
76 \r
77 \r
78       //-----------/\r
79      //- Methods -/\r
80     //-----------/\r
81 \r
82     /**\r
83      * Method deleteCompressed\r
84      * \r
85      */\r
86     public void deleteCompressed()\r
87     {\r
88         this._has_compressed= false;\r
89     } //-- void deleteCompressed() \r
90 \r
91     /**\r
92      * Note: hashCode() has not been overriden\r
93      * \r
94      * @param obj\r
95      * @return boolean\r
96      */\r
97     public boolean equals(java.lang.Object obj)\r
98     {\r
99         if ( this == obj )\r
100             return true;\r
101         \r
102         if (super.equals(obj)==false)\r
103             return false;\r
104         \r
105         if (obj instanceof Attachment) {\r
106         \r
107             Attachment temp = (Attachment)obj;\r
108             if (this._compressed != temp._compressed)\r
109                 return false;\r
110             if (this._has_compressed != temp._has_compressed)\r
111                 return false;\r
112             if (this._type != null) {\r
113                 if (temp._type == null) return false;\r
114                 else if (!(this._type.equals(temp._type))) \r
115                     return false;\r
116             }\r
117             else if (temp._type != null)\r
118                 return false;\r
119             if (this._objectref != null) {\r
120                 if (temp._objectref == null) return false;\r
121                 else if (!(this._objectref.equals(temp._objectref))) \r
122                     return false;\r
123             }\r
124             else if (temp._objectref != null)\r
125                 return false;\r
126             if (this._id != null) {\r
127                 if (temp._id == null) return false;\r
128                 else if (!(this._id.equals(temp._id))) \r
129                     return false;\r
130             }\r
131             else if (temp._id != null)\r
132                 return false;\r
133             return true;\r
134         }\r
135         return false;\r
136     } //-- boolean equals(java.lang.Object) \r
137 \r
138     /**\r
139      * Returns the value of field 'compressed'. The field\r
140      * 'compressed' has the following description: true implies\r
141      * data will be decompresses with Zip\r
142      *  before presenting to application \r
143      * \r
144      * @return boolean\r
145      * @return the value of field 'compressed'.\r
146      */\r
147     public boolean getCompressed()\r
148     {\r
149         return this._compressed;\r
150     } //-- boolean getCompressed() \r
151 \r
152     /**\r
153      * Returns the value of field 'id'. The field 'id' has the\r
154      * following description: Primary Key for vamsas object\r
155      * referencing\r
156      *  \r
157      * \r
158      * @return String\r
159      * @return the value of field 'id'.\r
160      */\r
161     public java.lang.String getId()\r
162     {\r
163         return this._id;\r
164     } //-- java.lang.String getId() \r
165 \r
166     /**\r
167      * Returns the value of field 'objectref'. The field\r
168      * 'objectref' has the following description: Object the\r
169      * arbitrary data is associated with\r
170      *  \r
171      * \r
172      * @return Object\r
173      * @return the value of field 'objectref'.\r
174      */\r
175     public java.lang.Object getObjectref()\r
176     {\r
177         return this._objectref;\r
178     } //-- java.lang.Object getObjectref() \r
179 \r
180     /**\r
181      * Returns the value of field 'type'. The field 'type' has the\r
182      * following description: Type of arbitrary data - TODO: decide\r
183      * format - use\r
184      *  (extended) MIME types ? \r
185      * \r
186      * @return String\r
187      * @return the value of field 'type'.\r
188      */\r
189     public java.lang.String getType()\r
190     {\r
191         return this._type;\r
192     } //-- java.lang.String getType() \r
193 \r
194     /**\r
195      * Method hasCompressed\r
196      * \r
197      * \r
198      * \r
199      * @return boolean\r
200      */\r
201     public boolean hasCompressed()\r
202     {\r
203         return this._has_compressed;\r
204     } //-- boolean hasCompressed() \r
205 \r
206     /**\r
207      * Method isValid\r
208      * \r
209      * \r
210      * \r
211      * @return boolean\r
212      */\r
213     public boolean isValid()\r
214     {\r
215         try {\r
216             validate();\r
217         }\r
218         catch (org.exolab.castor.xml.ValidationException vex) {\r
219             return false;\r
220         }\r
221         return true;\r
222     } //-- boolean isValid() \r
223 \r
224     /**\r
225      * Method marshal\r
226      * \r
227      * \r
228      * \r
229      * @param out\r
230      */\r
231     public void marshal(java.io.Writer out)\r
232         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
233     {\r
234         \r
235         Marshaller.marshal(this, out);\r
236     } //-- void marshal(java.io.Writer) \r
237 \r
238     /**\r
239      * Method marshal\r
240      * \r
241      * \r
242      * \r
243      * @param handler\r
244      */\r
245     public void marshal(org.xml.sax.ContentHandler handler)\r
246         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
247     {\r
248         \r
249         Marshaller.marshal(this, handler);\r
250     } //-- void marshal(org.xml.sax.ContentHandler) \r
251 \r
252     /**\r
253      * Sets the value of field 'compressed'. The field 'compressed'\r
254      * has the following description: true implies data will be\r
255      * decompresses with Zip\r
256      *  before presenting to application \r
257      * \r
258      * @param compressed the value of field 'compressed'.\r
259      */\r
260     public void setCompressed(boolean compressed)\r
261     {\r
262         this._compressed = compressed;\r
263         this._has_compressed = true;\r
264     } //-- void setCompressed(boolean) \r
265 \r
266     /**\r
267      * Sets the value of field 'id'. The field 'id' has the\r
268      * following description: Primary Key for vamsas object\r
269      * referencing\r
270      *  \r
271      * \r
272      * @param id the value of field 'id'.\r
273      */\r
274     public void setId(java.lang.String id)\r
275     {\r
276         this._id = id;\r
277     } //-- void setId(java.lang.String) \r
278 \r
279     /**\r
280      * Sets the value of field 'objectref'. The field 'objectref'\r
281      * has the following description: Object the arbitrary data is\r
282      * associated with\r
283      *  \r
284      * \r
285      * @param objectref the value of field 'objectref'.\r
286      */\r
287     public void setObjectref(java.lang.Object objectref)\r
288     {\r
289         this._objectref = objectref;\r
290     } //-- void setObjectref(java.lang.Object) \r
291 \r
292     /**\r
293      * Sets the value of field 'type'. The field 'type' has the\r
294      * following description: Type of arbitrary data - TODO: decide\r
295      * format - use\r
296      *  (extended) MIME types ? \r
297      * \r
298      * @param type the value of field 'type'.\r
299      */\r
300     public void setType(java.lang.String type)\r
301     {\r
302         this._type = type;\r
303     } //-- void setType(java.lang.String) \r
304 \r
305     /**\r
306      * Method unmarshal\r
307      * \r
308      * \r
309      * \r
310      * @param reader\r
311      * @return AppData\r
312      */\r
313     public static uk.ac.vamsas.objects.core.AppData unmarshal(java.io.Reader reader)\r
314         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
315     {\r
316         return (uk.ac.vamsas.objects.core.Attachment) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Attachment.class, reader);\r
317     } //-- uk.ac.vamsas.objects.core.AppData unmarshal(java.io.Reader) \r
318 \r
319     /**\r
320      * Method validate\r
321      * \r
322      */\r
323     public void validate()\r
324         throws org.exolab.castor.xml.ValidationException\r
325     {\r
326         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
327         validator.validate(this);\r
328     } //-- void validate() \r
329 \r
330 }\r