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