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.kernel.util.HtmlUtil;
28 import com.liferay.portal.model.Image;
29 import com.liferay.portal.model.ImageSoap;
30
31 import com.liferay.portlet.expando.model.ExpandoBridge;
32 import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
33
34 import java.io.Serializable;
35
36 import java.lang.reflect.Proxy;
37
38 import java.sql.Types;
39
40 import java.util.ArrayList;
41 import java.util.Date;
42 import java.util.List;
43
44
64 public class ImageModelImpl extends BaseModelImpl {
65 public static final String TABLE_NAME = "Image";
66 public static final Object[][] TABLE_COLUMNS = {
67 { "imageId", new Integer(Types.BIGINT) },
68
69
70 { "modifiedDate", new Integer(Types.TIMESTAMP) },
71
72
73 { "text_", new Integer(Types.CLOB) },
74
75
76 { "type_", new Integer(Types.VARCHAR) },
77
78
79 { "height", new Integer(Types.INTEGER) },
80
81
82 { "width", new Integer(Types.INTEGER) },
83
84
85 { "size_", new Integer(Types.INTEGER) }
86 };
87 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)";
88 public static final String TABLE_SQL_DROP = "drop table Image";
89 public static final String DATA_SOURCE = "liferayDataSource";
90 public static final String SESSION_FACTORY = "liferaySessionFactory";
91 public static final String TX_MANAGER = "liferayTransactionManager";
92 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
93 "value.object.finder.cache.enabled.com.liferay.portal.model.Image"),
94 true);
95
96 public static Image toModel(ImageSoap soapModel) {
97 Image model = new ImageImpl();
98
99 model.setImageId(soapModel.getImageId());
100 model.setModifiedDate(soapModel.getModifiedDate());
101 model.setText(soapModel.getText());
102 model.setType(soapModel.getType());
103 model.setHeight(soapModel.getHeight());
104 model.setWidth(soapModel.getWidth());
105 model.setSize(soapModel.getSize());
106
107 return model;
108 }
109
110 public static List<Image> toModels(ImageSoap[] soapModels) {
111 List<Image> models = new ArrayList<Image>(soapModels.length);
112
113 for (ImageSoap soapModel : soapModels) {
114 models.add(toModel(soapModel));
115 }
116
117 return models;
118 }
119
120 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
121 "lock.expiration.time.com.liferay.portal.model.Image"));
122
123 public ImageModelImpl() {
124 }
125
126 public long getPrimaryKey() {
127 return _imageId;
128 }
129
130 public void setPrimaryKey(long pk) {
131 setImageId(pk);
132 }
133
134 public Serializable getPrimaryKeyObj() {
135 return new Long(_imageId);
136 }
137
138 public long getImageId() {
139 return _imageId;
140 }
141
142 public void setImageId(long imageId) {
143 if (imageId != _imageId) {
144 _imageId = imageId;
145 }
146 }
147
148 public Date getModifiedDate() {
149 return _modifiedDate;
150 }
151
152 public void setModifiedDate(Date modifiedDate) {
153 if (((modifiedDate == null) && (_modifiedDate != null)) ||
154 ((modifiedDate != null) && (_modifiedDate == null)) ||
155 ((modifiedDate != null) && (_modifiedDate != null) &&
156 !modifiedDate.equals(_modifiedDate))) {
157 _modifiedDate = modifiedDate;
158 }
159 }
160
161 public String getText() {
162 return GetterUtil.getString(_text);
163 }
164
165 public void setText(String text) {
166 if (((text == null) && (_text != null)) ||
167 ((text != null) && (_text == null)) ||
168 ((text != null) && (_text != null) && !text.equals(_text))) {
169 _text = text;
170 }
171 }
172
173 public String getType() {
174 return GetterUtil.getString(_type);
175 }
176
177 public void setType(String type) {
178 if (((type == null) && (_type != null)) ||
179 ((type != null) && (_type == null)) ||
180 ((type != null) && (_type != null) && !type.equals(_type))) {
181 _type = type;
182 }
183 }
184
185 public int getHeight() {
186 return _height;
187 }
188
189 public void setHeight(int height) {
190 if (height != _height) {
191 _height = height;
192 }
193 }
194
195 public int getWidth() {
196 return _width;
197 }
198
199 public void setWidth(int width) {
200 if (width != _width) {
201 _width = width;
202 }
203 }
204
205 public int getSize() {
206 return _size;
207 }
208
209 public void setSize(int size) {
210 if (size != _size) {
211 _size = size;
212 }
213 }
214
215 public Image toEscapedModel() {
216 if (isEscapedModel()) {
217 return (Image)this;
218 }
219 else {
220 Image model = new ImageImpl();
221
222 model.setNew(isNew());
223 model.setEscapedModel(true);
224
225 model.setImageId(getImageId());
226 model.setModifiedDate(getModifiedDate());
227 model.setText(HtmlUtil.escape(getText()));
228 model.setType(HtmlUtil.escape(getType()));
229 model.setHeight(getHeight());
230 model.setWidth(getWidth());
231 model.setSize(getSize());
232
233 model = (Image)Proxy.newProxyInstance(Image.class.getClassLoader(),
234 new Class[] { Image.class }, new ReadOnlyBeanHandler(model));
235
236 return model;
237 }
238 }
239
240 public ExpandoBridge getExpandoBridge() {
241 if (_expandoBridge == null) {
242 _expandoBridge = new ExpandoBridgeImpl(Image.class.getName(),
243 getPrimaryKey());
244 }
245
246 return _expandoBridge;
247 }
248
249 public Object clone() {
250 ImageImpl clone = new ImageImpl();
251
252 clone.setImageId(getImageId());
253 clone.setModifiedDate(getModifiedDate());
254 clone.setText(getText());
255 clone.setType(getType());
256 clone.setHeight(getHeight());
257 clone.setWidth(getWidth());
258 clone.setSize(getSize());
259
260 return clone;
261 }
262
263 public int compareTo(Object obj) {
264 if (obj == null) {
265 return -1;
266 }
267
268 ImageImpl image = (ImageImpl)obj;
269
270 int value = 0;
271
272 if (getImageId() < image.getImageId()) {
273 value = -1;
274 }
275 else if (getImageId() > image.getImageId()) {
276 value = 1;
277 }
278 else {
279 value = 0;
280 }
281
282 if (value != 0) {
283 return value;
284 }
285
286 return 0;
287 }
288
289 public boolean equals(Object obj) {
290 if (obj == null) {
291 return false;
292 }
293
294 ImageImpl image = null;
295
296 try {
297 image = (ImageImpl)obj;
298 }
299 catch (ClassCastException cce) {
300 return false;
301 }
302
303 long pk = image.getPrimaryKey();
304
305 if (getPrimaryKey() == pk) {
306 return true;
307 }
308 else {
309 return false;
310 }
311 }
312
313 public int hashCode() {
314 return (int)getPrimaryKey();
315 }
316
317 private long _imageId;
318 private Date _modifiedDate;
319 private String _text;
320 private String _type;
321 private int _height;
322 private int _width;
323 private int _size;
324 private transient ExpandoBridge _expandoBridge;
325 }