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