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.portlet.imagegallery.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.impl.BaseModelImpl;
026: import com.liferay.portal.util.PropsUtil;
027:
028: import com.liferay.portlet.imagegallery.model.IGImage;
029:
030: import com.liferay.util.Html;
031:
032: import java.io.Serializable;
033:
034: import java.lang.reflect.Proxy;
035:
036: import java.sql.Types;
037:
038: import java.util.Date;
039:
040: /**
041: * <a href="IGImageModelImpl.java.html"><b><i>View Source</i></b></a>
042: *
043: * <p>
044: * ServiceBuilder generated this class. Modifications in this class will be
045: * overwritten the next time is generated.
046: * </p>
047: *
048: * <p>
049: * This class is a model that represents the <code>IGImage</code> table
050: * in the database.
051: * </p>
052: *
053: * @author Brian Wing Shun Chan
054: *
055: * @see com.liferay.portlet.imagegallery.service.model.IGImage
056: * @see com.liferay.portlet.imagegallery.service.model.IGImageModel
057: * @see com.liferay.portlet.imagegallery.service.model.impl.IGImageImpl
058: *
059: */
060: public class IGImageModelImpl extends BaseModelImpl {
061: public static final String TABLE_NAME = "IGImage";
062: public static final Object[][] TABLE_COLUMNS = {
063: { "uuid_", new Integer(Types.VARCHAR) },
064:
065: { "imageId", new Integer(Types.BIGINT) },
066:
067: { "companyId", new Integer(Types.BIGINT) },
068:
069: { "userId", new Integer(Types.BIGINT) },
070:
071: { "createDate", new Integer(Types.TIMESTAMP) },
072:
073: { "modifiedDate", new Integer(Types.TIMESTAMP) },
074:
075: { "folderId", new Integer(Types.BIGINT) },
076:
077: { "description", new Integer(Types.VARCHAR) },
078:
079: { "smallImageId", new Integer(Types.BIGINT) },
080:
081: { "largeImageId", new Integer(Types.BIGINT) } };
082: public static final String TABLE_SQL_CREATE = "create table IGImage (uuid_ VARCHAR(75) null,imageId LONG not null primary key,companyId LONG,userId LONG,createDate DATE null,modifiedDate DATE null,folderId LONG,description STRING null,smallImageId LONG,largeImageId LONG)";
083: public static final String TABLE_SQL_DROP = "drop table IGImage";
084: public static final boolean CACHE_ENABLED = GetterUtil
085: .getBoolean(
086: PropsUtil
087: .get("value.object.finder.cache.enabled.com.liferay.portlet.imagegallery.model.IGImage"),
088: true);
089: public static final long LOCK_EXPIRATION_TIME = GetterUtil
090: .getLong(PropsUtil
091: .get("lock.expiration.time.com.liferay.portlet.imagegallery.model.IGImage"));
092:
093: public IGImageModelImpl() {
094: }
095:
096: public long getPrimaryKey() {
097: return _imageId;
098: }
099:
100: public void setPrimaryKey(long pk) {
101: setImageId(pk);
102: }
103:
104: public Serializable getPrimaryKeyObj() {
105: return new Long(_imageId);
106: }
107:
108: public String getUuid() {
109: return GetterUtil.getString(_uuid);
110: }
111:
112: public void setUuid(String uuid) {
113: if ((uuid != null) && (uuid != _uuid)) {
114: _uuid = uuid;
115: }
116: }
117:
118: public long getImageId() {
119: return _imageId;
120: }
121:
122: public void setImageId(long imageId) {
123: if (imageId != _imageId) {
124: _imageId = imageId;
125: }
126: }
127:
128: public long getCompanyId() {
129: return _companyId;
130: }
131:
132: public void setCompanyId(long companyId) {
133: if (companyId != _companyId) {
134: _companyId = companyId;
135: }
136: }
137:
138: public long getUserId() {
139: return _userId;
140: }
141:
142: public void setUserId(long userId) {
143: if (userId != _userId) {
144: _userId = userId;
145: }
146: }
147:
148: public Date getCreateDate() {
149: return _createDate;
150: }
151:
152: public void setCreateDate(Date createDate) {
153: if (((createDate == null) && (_createDate != null))
154: || ((createDate != null) && (_createDate == null))
155: || ((createDate != null) && (_createDate != null) && !createDate
156: .equals(_createDate))) {
157: _createDate = createDate;
158: }
159: }
160:
161: public Date getModifiedDate() {
162: return _modifiedDate;
163: }
164:
165: public void setModifiedDate(Date modifiedDate) {
166: if (((modifiedDate == null) && (_modifiedDate != null))
167: || ((modifiedDate != null) && (_modifiedDate == null))
168: || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate
169: .equals(_modifiedDate))) {
170: _modifiedDate = modifiedDate;
171: }
172: }
173:
174: public long getFolderId() {
175: return _folderId;
176: }
177:
178: public void setFolderId(long folderId) {
179: if (folderId != _folderId) {
180: _folderId = folderId;
181: }
182: }
183:
184: public String getDescription() {
185: return GetterUtil.getString(_description);
186: }
187:
188: public void setDescription(String description) {
189: if (((description == null) && (_description != null))
190: || ((description != null) && (_description == null))
191: || ((description != null) && (_description != null) && !description
192: .equals(_description))) {
193: _description = description;
194: }
195: }
196:
197: public long getSmallImageId() {
198: return _smallImageId;
199: }
200:
201: public void setSmallImageId(long smallImageId) {
202: if (smallImageId != _smallImageId) {
203: _smallImageId = smallImageId;
204: }
205: }
206:
207: public long getLargeImageId() {
208: return _largeImageId;
209: }
210:
211: public void setLargeImageId(long largeImageId) {
212: if (largeImageId != _largeImageId) {
213: _largeImageId = largeImageId;
214: }
215: }
216:
217: public IGImage toEscapedModel() {
218: if (isEscapedModel()) {
219: return (IGImage) this ;
220: } else {
221: IGImage model = new IGImageImpl();
222:
223: model.setEscapedModel(true);
224:
225: model.setUuid(Html.escape(getUuid()));
226: model.setImageId(getImageId());
227: model.setCompanyId(getCompanyId());
228: model.setUserId(getUserId());
229: model.setCreateDate(getCreateDate());
230: model.setModifiedDate(getModifiedDate());
231: model.setFolderId(getFolderId());
232: model.setDescription(Html.escape(getDescription()));
233: model.setSmallImageId(getSmallImageId());
234: model.setLargeImageId(getLargeImageId());
235:
236: model = (IGImage) Proxy.newProxyInstance(IGImage.class
237: .getClassLoader(), new Class[] { IGImage.class },
238: new ReadOnlyBeanHandler(model));
239:
240: return model;
241: }
242: }
243:
244: public Object clone() {
245: IGImageImpl clone = new IGImageImpl();
246:
247: clone.setUuid(getUuid());
248: clone.setImageId(getImageId());
249: clone.setCompanyId(getCompanyId());
250: clone.setUserId(getUserId());
251: clone.setCreateDate(getCreateDate());
252: clone.setModifiedDate(getModifiedDate());
253: clone.setFolderId(getFolderId());
254: clone.setDescription(getDescription());
255: clone.setSmallImageId(getSmallImageId());
256: clone.setLargeImageId(getLargeImageId());
257:
258: return clone;
259: }
260:
261: public int compareTo(Object obj) {
262: if (obj == null) {
263: return -1;
264: }
265:
266: IGImageImpl igImage = (IGImageImpl) obj;
267:
268: int value = 0;
269:
270: if (getImageId() < igImage.getImageId()) {
271: value = -1;
272: } else if (getImageId() > igImage.getImageId()) {
273: value = 1;
274: } else {
275: value = 0;
276: }
277:
278: if (value != 0) {
279: return value;
280: }
281:
282: return 0;
283: }
284:
285: public boolean equals(Object obj) {
286: if (obj == null) {
287: return false;
288: }
289:
290: IGImageImpl igImage = null;
291:
292: try {
293: igImage = (IGImageImpl) obj;
294: } catch (ClassCastException cce) {
295: return false;
296: }
297:
298: long pk = igImage.getPrimaryKey();
299:
300: if (getPrimaryKey() == pk) {
301: return true;
302: } else {
303: return false;
304: }
305: }
306:
307: public int hashCode() {
308: return (int) getPrimaryKey();
309: }
310:
311: private String _uuid;
312: private long _imageId;
313: private long _companyId;
314: private long _userId;
315: private Date _createDate;
316: private Date _modifiedDate;
317: private long _folderId;
318: private String _description;
319: private long _smallImageId;
320: private long _largeImageId;
321: }
|