KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dspace > checker > DSpaceBitstreamInfo


1 /*
2  * Copyright (c) 2004-2005, Hewlett-Packard Company and Massachusetts
3  * Institute of Technology. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  * - Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * - Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * - Neither the name of the Hewlett-Packard Company nor the name of the
17  * Massachusetts Institute of Technology nor the names of their
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
30  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
31  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
32  * DAMAGE.
33  */

34 package org.dspace.checker;
35
36 /**
37  * Value Object that holds bitstream information that will be used for dspace
38  * bitstream.
39  *
40  * @author Jim Downing
41  * @author Grace Carpenter
42  * @author Nathan Sarr
43  *
44  */

45 public final class DSpaceBitstreamInfo
46 {
47     /** database bitstream id. */
48     private int bitstreamId;
49
50     /** format */
51     private String JavaDoc bitstreamFormat;
52
53     /** name given to the bitstream. */
54     private String JavaDoc name;
55
56     /** Stored size of the bitstream. */
57     private int size;
58
59     /** the check sum value stored in the database. */
60     private String JavaDoc storedChecksum;
61
62     /** checksum algorithm (usually MD5 for now). */
63     private String JavaDoc checksumAlgorithm;
64
65     /** Bitstream Format Description */
66     private String JavaDoc userFormatDescription;
67
68     /** source name of the file. */
69     private String JavaDoc source;
70
71     /** file location in the assetstore. */
72     private String JavaDoc internalId;
73
74     /** deleted flag. */
75     private boolean deleted;
76
77     /** store number. */
78     private int storeNumber;
79
80     /**
81      * Blanked off no-op default constructor.
82      */

83     private DSpaceBitstreamInfo()
84     {
85         ;
86     }
87
88     /**
89      * Minimal constructor.
90      *
91      * @param bid
92      * Bitstream identifier
93      */

94     public DSpaceBitstreamInfo(int bid)
95     {
96         deleted = false;
97         storeNumber = -1;
98         size = -1;
99         bitstreamFormat = null;
100         userFormatDescription = null;
101         internalId = null;
102         source = null;
103         checksumAlgorithm = null;
104         storedChecksum = null;
105         name = null;
106         this.bitstreamId = bid;
107     }
108
109     /**
110      * Complete constructor.
111      *
112      * @param del
113      * Deleted
114      * @param storeNo
115      * Bitstream storeNumber
116      * @param sz
117      * Bitstream size
118      * @param bitstrmFmt
119      * Bitstream format
120      * @param bitstrmId
121      * Bitstream id
122      * @param usrFmtDesc
123      * Bitstream format description
124      * @param intrnlId
125      * Bitstream DSpace internal id
126      * @param src
127      * Bitstream source
128      * @param chksumAlgorthm
129      * Algorithm used to check bitstream
130      * @param chksum
131      * Hash digest obtained
132      * @param nm
133      * Name of bitstream
134      * @param desc
135      * Bitstream description
136      */

137     public DSpaceBitstreamInfo(boolean del, int storeNo, int sz,
138             String JavaDoc bitstrmFmt, int bitstrmId, String JavaDoc usrFmtDesc,
139             String JavaDoc intrnlId, String JavaDoc src, String JavaDoc chksumAlgorthm, String JavaDoc chksum,
140             String JavaDoc nm, String JavaDoc desc)
141     {
142         this.deleted = del;
143         this.storeNumber = storeNo;
144         this.size = sz;
145         this.bitstreamFormat = bitstrmFmt;
146         this.bitstreamId = bitstrmId;
147         this.userFormatDescription = usrFmtDesc;
148         this.internalId = intrnlId;
149         this.source = src;
150         this.checksumAlgorithm = chksumAlgorthm;
151         this.storedChecksum = chksum;
152         this.name = nm;
153     }
154
155     /**
156      * Get the deleted flag.
157      *
158      * @return boolean
159      */

160     public boolean getDeleted()
161     {
162         return deleted;
163     }
164
165     /**
166      * Set the deleted flag.
167      *
168      * @param deleted
169      * deleted flag
170      */

171     public void setDeleted(boolean deleted)
172     {
173         this.deleted = deleted;
174     }
175
176     /**
177      * Get the store number.
178      *
179      * @return int
180      */

181     public int getStoreNumber()
182     {
183         return storeNumber;
184     }
185
186     /**
187      * Set the store number.
188      *
189      * @param storeNumber
190      * the store number
191      */

192     public void setStoreNumber(int storeNumber)
193     {
194         this.storeNumber = storeNumber;
195     }
196
197     /**
198      * Get the size.
199      *
200      * @return int
201      */

202     public int getSize()
203     {
204         return size;
205     }
206
207     /**
208      * Set the size.
209      *
210      * @param size
211      * the bitstream size
212      */

213     public void setSize(int size)
214     {
215         this.size = size;
216     }
217
218     /**
219      * Get the Bitstream Format id.
220      *
221      * @return int
222      */

223     public String JavaDoc getBitstreamFormatId()
224     {
225         return bitstreamFormat;
226     }
227
228     /**
229      * Set the Bitstream Format id.
230      *
231      * @param bitstrmFmt
232      * id of the bitstream format
233      */

234     public void setBitstreamFormatId(String JavaDoc bitstrmFmt)
235     {
236         this.bitstreamFormat = bitstrmFmt;
237     }
238
239     /**
240      * Get the Bitstream id.
241      *
242      * @return int
243      */

244     public int getBitstreamId()
245     {
246         return bitstreamId;
247     }
248
249     /**
250      * Get the user format description.
251      *
252      * @return String
253      */

254     public String JavaDoc getUserFormatDescription()
255     {
256         return userFormatDescription;
257     }
258
259     /**
260      * Set the user format description.
261      *
262      * @param userFormatDescription
263      * the userFormatDescription
264      */

265     public void setUserFormatDescription(String JavaDoc userFormatDescription)
266     {
267         this.userFormatDescription = userFormatDescription;
268     }
269
270     /**
271      * Get the Internal Id.
272      *
273      * @return String
274      */

275     public String JavaDoc getInternalId()
276     {
277         return internalId;
278     }
279
280     /**
281      * Set the Internal Id.
282      *
283      * @param internalId
284      * the DSpace internal sequence id for the bitstream.
285      */

286     public void setInternalId(String JavaDoc internalId)
287     {
288         this.internalId = internalId;
289     }
290
291     /**
292      * Get the source.
293      *
294      * @return String
295      */

296     public String JavaDoc getSource()
297     {
298         return source;
299     }
300
301     /**
302      * Set the source.
303      *
304      * @param source
305      * The bitstream source.
306      */

307     public void setSource(String JavaDoc source)
308     {
309         this.source = source;
310     }
311
312     /**
313      * Get the checksum algorithm.
314      *
315      * @return String
316      */

317     public String JavaDoc getChecksumAlgorithm()
318     {
319         return checksumAlgorithm;
320     }
321
322     /**
323      * Set the checksum algorithm.
324      *
325      * @param checksumAlgorithm
326      * the algorithm used for checking this bitstream
327      */

328     public void setChecksumAlgorithm(String JavaDoc checksumAlgorithm)
329     {
330         this.checksumAlgorithm = checksumAlgorithm;
331     }
332
333     /**
334      * Get the checksum.
335      *
336      * @return String
337      */

338     public String JavaDoc getStoredChecksum()
339     {
340         return storedChecksum;
341     }
342
343     /**
344      * Set the checksum.
345      *
346      * @param checksum
347      * The last stored checksum for this bitstream.
348      */

349     public void setStoredChecksum(String JavaDoc checksum)
350     {
351         this.storedChecksum = checksum;
352     }
353
354     /**
355      * Get the name of the bitstream.
356      *
357      * @return String
358      */

359     public String JavaDoc getName()
360     {
361         return name;
362     }
363
364     /**
365      * Set the name of the bitstream.
366      *
367      * @param nm
368      * The name of this bitstream.
369      */

370     public void getName(String JavaDoc nm)
371     {
372         this.name = nm;
373     }
374
375     /**
376      * The name of the bitstream.
377      *
378      * @param name
379      * The name to set.
380      */

381     public void setName(String JavaDoc name)
382     {
383         this.name = name;
384     }
385
386     /**
387      * Identity entirely dependent upon <code>bitstreamId</code>.
388      *
389      * @see java.lang.Object#equals(java.lang.Object)
390      */

391     public boolean equals(Object JavaDoc o)
392     {
393         if (this == o)
394         {
395             return true;
396         }
397
398         if (!(o instanceof DSpaceBitstreamInfo))
399         {
400             return false;
401         }
402
403         DSpaceBitstreamInfo other = (DSpaceBitstreamInfo) o;
404
405         return (this.bitstreamId == other.bitstreamId);
406     }
407
408     /**
409      * HashCode method uses <code>bitstreamId</code> as hashing function.
410      *
411      * @see java.lang.Object#hashCode()
412      */

413     public int hashCode()
414     {
415         return bitstreamId;
416     }
417
418     /**
419      * Describes this BitstreamInfo.
420      *
421      * @see java.lang.Object#toString()
422      */

423     public String JavaDoc toString()
424     {
425         return new StringBuffer JavaDoc("DSpace Bitstream Information for id ").append(
426                 bitstreamId).toString();
427     }
428 }
429
Popular Tags