KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > blandware > atleap > model > core > ResourceData


1 /*
2  * Copyright 2004 Blandware (http://www.blandware.com)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package com.blandware.atleap.model.core;
17
18 import java.util.Arrays JavaDoc;
19
20
21 /**
22  * <p>Contains BLOB with resource data that corresponds to some content resource.</p>
23  * <p><a HREF="ResourceData.java.htm"><i>View Source</i></a>
24  * </p>
25  * <p/>
26  *
27  * @author Sergey Zubtcovskii <a HREF="mailto:sergey.zubtcovskii@blandware.com">&lt;sergey.zubtcovskii@blandware.com&gt;</a>
28  * @version $Revision: 1.13 $ $Date: 2005/10/19 07:27:42 $
29  * @see ContentResource
30  * @hibernate.class table="`al_core_resource_data`" lazy="true"
31  */

32 public class ResourceData extends BaseObject {
33
34     //~ Instance variables
35

36     /**
37      * The ID of this resource data
38      */

39     protected Long JavaDoc id;
40     /**
41      * Binary data
42      */

43     protected byte[] data;
44
45
46     //~ Constructors
47

48     /**
49      * Creates new instance of ResourceData
50      */

51     public ResourceData() {
52     }
53
54     /**
55      * Creates new instance of ResourceData
56      *
57      * @param data Data itself
58      */

59     public ResourceData(byte[] data) {
60         this.data = data;
61     }
62
63     //~ Methods
64

65     /**
66      * Returns the id of this resource data
67      *
68      * @return id
69      * @hibernate.id column="`id`"
70      * generator-class="increment" unsaved-value="null"
71      */

72     public Long JavaDoc getId() {
73         return id;
74     }
75
76     /**
77      * Sets the id of this resource data
78      *
79      * @param id the id to set
80      */

81     public void setId(Long JavaDoc id) {
82         this.id = id;
83     }
84
85     /**
86      * Returns the binary data itself
87      *
88      * @return byte array representing binary data
89      * @hibernate.property type="com.blandware.atleap.persistence.hibernate.util.BinaryBlobType" column="`raw_data`" not-null="true" unique="false" length="16777215"
90      *
91      */

92     public byte[] getData() {
93         return data;
94     }
95
96     /**
97      * Sets the binary data itself
98      *
99      * @param data byte array representing binary data
100      */

101     public void setData(byte[] data) {
102         this.data = data;
103     }
104
105     public boolean equals(Object JavaDoc o) {
106         if ( this == o ) {
107             return true;
108         }
109         if ( !(o instanceof ResourceData) ) {
110             return false;
111         }
112
113         final ResourceData resourceData = (ResourceData) o;
114
115         if ( !Arrays.equals(data, resourceData.data) ) {
116             return false;
117         }
118
119         return true;
120     }
121
122     public int hashCode() {
123         return 0;
124     }
125
126 }
127
Popular Tags