1
22
23 package com.liferay.portal.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.model.Image;
28 import com.liferay.portal.util.PropsUtil;
29
30 import com.liferay.util.Html;
31
32 import java.io.Serializable;
33
34 import java.lang.reflect.Proxy;
35
36 import java.sql.Types;
37
38 import java.util.Date;
39
40
60 public class ImageModelImpl extends BaseModelImpl {
61 public static final String TABLE_NAME = "Image";
62 public static final Object[][] TABLE_COLUMNS = {
63 { "imageId", new Integer(Types.BIGINT) },
64
65
66 { "modifiedDate", new Integer(Types.TIMESTAMP) },
67
68
69 { "text_", new Integer(Types.CLOB) },
70
71
72 { "type_", new Integer(Types.VARCHAR) },
73
74
75 { "height", new Integer(Types.INTEGER) },
76
77
78 { "width", new Integer(Types.INTEGER) },
79
80
81 { "size_", new Integer(Types.INTEGER) }
82 };
83 public static final String TABLE_SQL_CREATE = "create table Image (imageId LONG not null primary key,modifiedDate DATE null,text_ TEXT null,type_ VARCHAR(75) null,height INTEGER,width INTEGER,size_ INTEGER)";
84 public static final String TABLE_SQL_DROP = "drop table Image";
85 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
86 "value.object.finder.cache.enabled.com.liferay.portal.model.Image"),
87 true);
88 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
89 "lock.expiration.time.com.liferay.portal.model.Image"));
90
91 public ImageModelImpl() {
92 }
93
94 public long getPrimaryKey() {
95 return _imageId;
96 }
97
98 public void setPrimaryKey(long pk) {
99 setImageId(pk);
100 }
101
102 public Serializable getPrimaryKeyObj() {
103 return new Long(_imageId);
104 }
105
106 public long getImageId() {
107 return _imageId;
108 }
109
110 public void setImageId(long imageId) {
111 if (imageId != _imageId) {
112 _imageId = imageId;
113 }
114 }
115
116 public Date getModifiedDate() {
117 return _modifiedDate;
118 }
119
120 public void setModifiedDate(Date modifiedDate) {
121 if (((modifiedDate == null) && (_modifiedDate != null)) ||
122 ((modifiedDate != null) && (_modifiedDate == null)) ||
123 ((modifiedDate != null) && (_modifiedDate != null) &&
124 !modifiedDate.equals(_modifiedDate))) {
125 _modifiedDate = modifiedDate;
126 }
127 }
128
129 public String getText() {
130 return GetterUtil.getString(_text);
131 }
132
133 public void setText(String text) {
134 if (((text == null) && (_text != null)) ||
135 ((text != null) && (_text == null)) ||
136 ((text != null) && (_text != null) && !text.equals(_text))) {
137 _text = text;
138 }
139 }
140
141 public String getType() {
142 return GetterUtil.getString(_type);
143 }
144
145 public void setType(String type) {
146 if (((type == null) && (_type != null)) ||
147 ((type != null) && (_type == null)) ||
148 ((type != null) && (_type != null) && !type.equals(_type))) {
149 _type = type;
150 }
151 }
152
153 public int getHeight() {
154 return _height;
155 }
156
157 public void setHeight(int height) {
158 if (height != _height) {
159 _height = height;
160 }
161 }
162
163 public int getWidth() {
164 return _width;
165 }
166
167 public void setWidth(int width) {
168 if (width != _width) {
169 _width = width;
170 }
171 }
172
173 public int getSize() {
174 return _size;
175 }
176
177 public void setSize(int size) {
178 if (size != _size) {
179 _size = size;
180 }
181 }
182
183 public Image toEscapedModel() {
184 if (isEscapedModel()) {
185 return (Image)this;
186 }
187 else {
188 Image model = new ImageImpl();
189
190 model.setEscapedModel(true);
191
192 model.setImageId(getImageId());
193 model.setModifiedDate(getModifiedDate());
194 model.setText(Html.escape(getText()));
195 model.setType(Html.escape(getType()));
196 model.setHeight(getHeight());
197 model.setWidth(getWidth());
198 model.setSize(getSize());
199
200 model = (Image)Proxy.newProxyInstance(Image.class.getClassLoader(),
201 new Class[] { Image.class }, new ReadOnlyBeanHandler(model));
202
203 return model;
204 }
205 }
206
207 public Object clone() {
208 ImageImpl clone = new ImageImpl();
209
210 clone.setImageId(getImageId());
211 clone.setModifiedDate(getModifiedDate());
212 clone.setText(getText());
213 clone.setType(getType());
214 clone.setHeight(getHeight());
215 clone.setWidth(getWidth());
216 clone.setSize(getSize());
217
218 return clone;
219 }
220
221 public int compareTo(Object obj) {
222 if (obj == null) {
223 return -1;
224 }
225
226 ImageImpl image = (ImageImpl)obj;
227
228 int value = 0;
229
230 if (getImageId() < image.getImageId()) {
231 value = -1;
232 }
233 else if (getImageId() > image.getImageId()) {
234 value = 1;
235 }
236 else {
237 value = 0;
238 }
239
240 if (value != 0) {
241 return value;
242 }
243
244 return 0;
245 }
246
247 public boolean equals(Object obj) {
248 if (obj == null) {
249 return false;
250 }
251
252 ImageImpl image = null;
253
254 try {
255 image = (ImageImpl)obj;
256 }
257 catch (ClassCastException cce) {
258 return false;
259 }
260
261 long pk = image.getPrimaryKey();
262
263 if (getPrimaryKey() == pk) {
264 return true;
265 }
266 else {
267 return false;
268 }
269 }
270
271 public int hashCode() {
272 return (int)getPrimaryKey();
273 }
274
275 private long _imageId;
276 private Date _modifiedDate;
277 private String _text;
278 private String _type;
279 private int _height;
280 private int _width;
281 private int _size;
282 }