001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.model.impl;
022:
023: import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
024: import com.liferay.portal.kernel.util.GetterUtil;
025: import com.liferay.portal.model.Image;
026: import com.liferay.portal.util.PropsUtil;
027:
028: import com.liferay.util.Html;
029:
030: import java.io.Serializable;
031:
032: import java.lang.reflect.Proxy;
033:
034: import java.sql.Types;
035:
036: import java.util.Date;
037:
038: /**
039: * <a href="ImageModelImpl.java.html"><b><i>View Source</i></b></a>
040: *
041: * <p>
042: * ServiceBuilder generated this class. Modifications in this class will be
043: * overwritten the next time is generated.
044: * </p>
045: *
046: * <p>
047: * This class is a model that represents the <code>Image</code> table
048: * in the database.
049: * </p>
050: *
051: * @author Brian Wing Shun Chan
052: *
053: * @see com.liferay.portal.service.model.Image
054: * @see com.liferay.portal.service.model.ImageModel
055: * @see com.liferay.portal.service.model.impl.ImageImpl
056: *
057: */
058: public class ImageModelImpl extends BaseModelImpl {
059: public static final String TABLE_NAME = "Image";
060: public static final Object[][] TABLE_COLUMNS = {
061: { "imageId", new Integer(Types.BIGINT) },
062:
063: { "modifiedDate", new Integer(Types.TIMESTAMP) },
064:
065: { "text_", new Integer(Types.CLOB) },
066:
067: { "type_", new Integer(Types.VARCHAR) },
068:
069: { "height", new Integer(Types.INTEGER) },
070:
071: { "width", new Integer(Types.INTEGER) },
072:
073: { "size_", new Integer(Types.INTEGER) } };
074: 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)";
075: public static final String TABLE_SQL_DROP = "drop table Image";
076: public static final boolean CACHE_ENABLED = GetterUtil
077: .getBoolean(
078: PropsUtil
079: .get("value.object.finder.cache.enabled.com.liferay.portal.model.Image"),
080: true);
081: public static final long LOCK_EXPIRATION_TIME = GetterUtil
082: .getLong(PropsUtil
083: .get("lock.expiration.time.com.liferay.portal.model.Image"));
084:
085: public ImageModelImpl() {
086: }
087:
088: public long getPrimaryKey() {
089: return _imageId;
090: }
091:
092: public void setPrimaryKey(long pk) {
093: setImageId(pk);
094: }
095:
096: public Serializable getPrimaryKeyObj() {
097: return new Long(_imageId);
098: }
099:
100: public long getImageId() {
101: return _imageId;
102: }
103:
104: public void setImageId(long imageId) {
105: if (imageId != _imageId) {
106: _imageId = imageId;
107: }
108: }
109:
110: public Date getModifiedDate() {
111: return _modifiedDate;
112: }
113:
114: public void setModifiedDate(Date modifiedDate) {
115: if (((modifiedDate == null) && (_modifiedDate != null))
116: || ((modifiedDate != null) && (_modifiedDate == null))
117: || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate
118: .equals(_modifiedDate))) {
119: _modifiedDate = modifiedDate;
120: }
121: }
122:
123: public String getText() {
124: return GetterUtil.getString(_text);
125: }
126:
127: public void setText(String text) {
128: if (((text == null) && (_text != null))
129: || ((text != null) && (_text == null))
130: || ((text != null) && (_text != null) && !text
131: .equals(_text))) {
132: _text = text;
133: }
134: }
135:
136: public String getType() {
137: return GetterUtil.getString(_type);
138: }
139:
140: public void setType(String type) {
141: if (((type == null) && (_type != null))
142: || ((type != null) && (_type == null))
143: || ((type != null) && (_type != null) && !type
144: .equals(_type))) {
145: _type = type;
146: }
147: }
148:
149: public int getHeight() {
150: return _height;
151: }
152:
153: public void setHeight(int height) {
154: if (height != _height) {
155: _height = height;
156: }
157: }
158:
159: public int getWidth() {
160: return _width;
161: }
162:
163: public void setWidth(int width) {
164: if (width != _width) {
165: _width = width;
166: }
167: }
168:
169: public int getSize() {
170: return _size;
171: }
172:
173: public void setSize(int size) {
174: if (size != _size) {
175: _size = size;
176: }
177: }
178:
179: public Image toEscapedModel() {
180: if (isEscapedModel()) {
181: return (Image) this ;
182: } else {
183: Image model = new ImageImpl();
184:
185: model.setEscapedModel(true);
186:
187: model.setImageId(getImageId());
188: model.setModifiedDate(getModifiedDate());
189: model.setText(Html.escape(getText()));
190: model.setType(Html.escape(getType()));
191: model.setHeight(getHeight());
192: model.setWidth(getWidth());
193: model.setSize(getSize());
194:
195: model = (Image) Proxy.newProxyInstance(Image.class
196: .getClassLoader(), new Class[] { Image.class },
197: new ReadOnlyBeanHandler(model));
198:
199: return model;
200: }
201: }
202:
203: public Object clone() {
204: ImageImpl clone = new ImageImpl();
205:
206: clone.setImageId(getImageId());
207: clone.setModifiedDate(getModifiedDate());
208: clone.setText(getText());
209: clone.setType(getType());
210: clone.setHeight(getHeight());
211: clone.setWidth(getWidth());
212: clone.setSize(getSize());
213:
214: return clone;
215: }
216:
217: public int compareTo(Object obj) {
218: if (obj == null) {
219: return -1;
220: }
221:
222: ImageImpl image = (ImageImpl) obj;
223:
224: int value = 0;
225:
226: if (getImageId() < image.getImageId()) {
227: value = -1;
228: } else if (getImageId() > image.getImageId()) {
229: value = 1;
230: } else {
231: value = 0;
232: }
233:
234: if (value != 0) {
235: return value;
236: }
237:
238: return 0;
239: }
240:
241: public boolean equals(Object obj) {
242: if (obj == null) {
243: return false;
244: }
245:
246: ImageImpl image = null;
247:
248: try {
249: image = (ImageImpl) obj;
250: } catch (ClassCastException cce) {
251: return false;
252: }
253:
254: long pk = image.getPrimaryKey();
255:
256: if (getPrimaryKey() == pk) {
257: return true;
258: } else {
259: return false;
260: }
261: }
262:
263: public int hashCode() {
264: return (int) getPrimaryKey();
265: }
266:
267: private long _imageId;
268: private Date _modifiedDate;
269: private String _text;
270: private String _type;
271: private int _height;
272: private int _width;
273: private int _size;
274: }
|