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.journal.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.journal.model.JournalArticleImage;
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: /**
039: * <a href="JournalArticleImageModelImpl.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>JournalArticleImage</code> table
048: * in the database.
049: * </p>
050: *
051: * @author Brian Wing Shun Chan
052: *
053: * @see com.liferay.portlet.journal.service.model.JournalArticleImage
054: * @see com.liferay.portlet.journal.service.model.JournalArticleImageModel
055: * @see com.liferay.portlet.journal.service.model.impl.JournalArticleImageImpl
056: *
057: */
058: public class JournalArticleImageModelImpl extends BaseModelImpl {
059: public static final String TABLE_NAME = "JournalArticleImage";
060: public static final Object[][] TABLE_COLUMNS = {
061: { "articleImageId", new Integer(Types.BIGINT) },
062:
063: { "groupId", new Integer(Types.BIGINT) },
064:
065: { "articleId", new Integer(Types.VARCHAR) },
066:
067: { "version", new Integer(Types.DOUBLE) },
068:
069: { "elName", new Integer(Types.VARCHAR) },
070:
071: { "languageId", new Integer(Types.VARCHAR) },
072:
073: { "tempImage", new Integer(Types.BOOLEAN) } };
074: public static final String TABLE_SQL_CREATE = "create table JournalArticleImage (articleImageId LONG not null primary key,groupId LONG,articleId VARCHAR(75) null,version DOUBLE,elName VARCHAR(75) null,languageId VARCHAR(75) null,tempImage BOOLEAN)";
075: public static final String TABLE_SQL_DROP = "drop table JournalArticleImage";
076: public static final boolean CACHE_ENABLED = GetterUtil
077: .getBoolean(
078: PropsUtil
079: .get("value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalArticleImage"),
080: true);
081: public static final long LOCK_EXPIRATION_TIME = GetterUtil
082: .getLong(PropsUtil
083: .get("lock.expiration.time.com.liferay.portlet.journal.model.JournalArticleImage"));
084:
085: public JournalArticleImageModelImpl() {
086: }
087:
088: public long getPrimaryKey() {
089: return _articleImageId;
090: }
091:
092: public void setPrimaryKey(long pk) {
093: setArticleImageId(pk);
094: }
095:
096: public Serializable getPrimaryKeyObj() {
097: return new Long(_articleImageId);
098: }
099:
100: public long getArticleImageId() {
101: return _articleImageId;
102: }
103:
104: public void setArticleImageId(long articleImageId) {
105: if (articleImageId != _articleImageId) {
106: _articleImageId = articleImageId;
107: }
108: }
109:
110: public long getGroupId() {
111: return _groupId;
112: }
113:
114: public void setGroupId(long groupId) {
115: if (groupId != _groupId) {
116: _groupId = groupId;
117: }
118: }
119:
120: public String getArticleId() {
121: return GetterUtil.getString(_articleId);
122: }
123:
124: public void setArticleId(String articleId) {
125: if (((articleId == null) && (_articleId != null))
126: || ((articleId != null) && (_articleId == null))
127: || ((articleId != null) && (_articleId != null) && !articleId
128: .equals(_articleId))) {
129: _articleId = articleId;
130: }
131: }
132:
133: public double getVersion() {
134: return _version;
135: }
136:
137: public void setVersion(double version) {
138: if (version != _version) {
139: _version = version;
140: }
141: }
142:
143: public String getElName() {
144: return GetterUtil.getString(_elName);
145: }
146:
147: public void setElName(String elName) {
148: if (((elName == null) && (_elName != null))
149: || ((elName != null) && (_elName == null))
150: || ((elName != null) && (_elName != null) && !elName
151: .equals(_elName))) {
152: _elName = elName;
153: }
154: }
155:
156: public String getLanguageId() {
157: return GetterUtil.getString(_languageId);
158: }
159:
160: public void setLanguageId(String languageId) {
161: if (((languageId == null) && (_languageId != null))
162: || ((languageId != null) && (_languageId == null))
163: || ((languageId != null) && (_languageId != null) && !languageId
164: .equals(_languageId))) {
165: _languageId = languageId;
166: }
167: }
168:
169: public boolean getTempImage() {
170: return _tempImage;
171: }
172:
173: public boolean isTempImage() {
174: return _tempImage;
175: }
176:
177: public void setTempImage(boolean tempImage) {
178: if (tempImage != _tempImage) {
179: _tempImage = tempImage;
180: }
181: }
182:
183: public JournalArticleImage toEscapedModel() {
184: if (isEscapedModel()) {
185: return (JournalArticleImage) this ;
186: } else {
187: JournalArticleImage model = new JournalArticleImageImpl();
188:
189: model.setEscapedModel(true);
190:
191: model.setArticleImageId(getArticleImageId());
192: model.setGroupId(getGroupId());
193: model.setArticleId(Html.escape(getArticleId()));
194: model.setVersion(getVersion());
195: model.setElName(Html.escape(getElName()));
196: model.setLanguageId(Html.escape(getLanguageId()));
197: model.setTempImage(getTempImage());
198:
199: model = (JournalArticleImage) Proxy.newProxyInstance(
200: JournalArticleImage.class.getClassLoader(),
201: new Class[] { JournalArticleImage.class },
202: new ReadOnlyBeanHandler(model));
203:
204: return model;
205: }
206: }
207:
208: public Object clone() {
209: JournalArticleImageImpl clone = new JournalArticleImageImpl();
210:
211: clone.setArticleImageId(getArticleImageId());
212: clone.setGroupId(getGroupId());
213: clone.setArticleId(getArticleId());
214: clone.setVersion(getVersion());
215: clone.setElName(getElName());
216: clone.setLanguageId(getLanguageId());
217: clone.setTempImage(getTempImage());
218:
219: return clone;
220: }
221:
222: public int compareTo(Object obj) {
223: if (obj == null) {
224: return -1;
225: }
226:
227: JournalArticleImageImpl journalArticleImage = (JournalArticleImageImpl) obj;
228:
229: long pk = journalArticleImage.getPrimaryKey();
230:
231: if (getPrimaryKey() < pk) {
232: return -1;
233: } else if (getPrimaryKey() > pk) {
234: return 1;
235: } else {
236: return 0;
237: }
238: }
239:
240: public boolean equals(Object obj) {
241: if (obj == null) {
242: return false;
243: }
244:
245: JournalArticleImageImpl journalArticleImage = null;
246:
247: try {
248: journalArticleImage = (JournalArticleImageImpl) obj;
249: } catch (ClassCastException cce) {
250: return false;
251: }
252:
253: long pk = journalArticleImage.getPrimaryKey();
254:
255: if (getPrimaryKey() == pk) {
256: return true;
257: } else {
258: return false;
259: }
260: }
261:
262: public int hashCode() {
263: return (int) getPrimaryKey();
264: }
265:
266: private long _articleImageId;
267: private long _groupId;
268: private String _articleId;
269: private double _version;
270: private String _elName;
271: private String _languageId;
272: private boolean _tempImage;
273: }
|