001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.journal.model.impl;
016    
017    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018    import com.liferay.portal.kernel.util.GetterUtil;
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.impl.BaseModelImpl;
022    import com.liferay.portal.service.ServiceContext;
023    
024    import com.liferay.portlet.expando.model.ExpandoBridge;
025    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
026    import com.liferay.portlet.journal.model.JournalArticleImage;
027    import com.liferay.portlet.journal.model.JournalArticleImageModel;
028    
029    import java.io.Serializable;
030    
031    import java.lang.reflect.Proxy;
032    
033    import java.sql.Types;
034    
035    /**
036     * The base model implementation for the JournalArticleImage service. Represents a row in the "JournalArticleImage" database table, with each column mapped to a property of this class.
037     *
038     * <p>
039     * This implementation and its corresponding interface {@link com.liferay.portlet.journal.model.JournalArticleImageModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link JournalArticleImageImpl}.
040     * </p>
041     *
042     * <p>
043     * Never modify or reference this class directly. All methods that expect a journal article image model instance should use the {@link com.liferay.portlet.journal.model.JournalArticleImage} interface instead.
044     * </p>
045     *
046     * @author Brian Wing Shun Chan
047     * @see JournalArticleImageImpl
048     * @see com.liferay.portlet.journal.model.JournalArticleImage
049     * @see com.liferay.portlet.journal.model.JournalArticleImageModel
050     * @generated
051     */
052    public class JournalArticleImageModelImpl extends BaseModelImpl<JournalArticleImage>
053            implements JournalArticleImageModel {
054            public static final String TABLE_NAME = "JournalArticleImage";
055            public static final Object[][] TABLE_COLUMNS = {
056                            { "articleImageId", new Integer(Types.BIGINT) },
057                            { "groupId", new Integer(Types.BIGINT) },
058                            { "articleId", new Integer(Types.VARCHAR) },
059                            { "version", new Integer(Types.DOUBLE) },
060                            { "elInstanceId", new Integer(Types.VARCHAR) },
061                            { "elName", new Integer(Types.VARCHAR) },
062                            { "languageId", new Integer(Types.VARCHAR) },
063                            { "tempImage", new Integer(Types.BOOLEAN) }
064                    };
065            public static final String TABLE_SQL_CREATE = "create table JournalArticleImage (articleImageId LONG not null primary key,groupId LONG,articleId VARCHAR(75) null,version DOUBLE,elInstanceId VARCHAR(75) null,elName VARCHAR(75) null,languageId VARCHAR(75) null,tempImage BOOLEAN)";
066            public static final String TABLE_SQL_DROP = "drop table JournalArticleImage";
067            public static final String DATA_SOURCE = "liferayDataSource";
068            public static final String SESSION_FACTORY = "liferaySessionFactory";
069            public static final String TX_MANAGER = "liferayTransactionManager";
070            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
071                                    "value.object.entity.cache.enabled.com.liferay.portlet.journal.model.JournalArticleImage"),
072                            true);
073            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
074                                    "value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalArticleImage"),
075                            true);
076            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
077                                    "lock.expiration.time.com.liferay.portlet.journal.model.JournalArticleImage"));
078    
079            public JournalArticleImageModelImpl() {
080            }
081    
082            public long getPrimaryKey() {
083                    return _articleImageId;
084            }
085    
086            public void setPrimaryKey(long pk) {
087                    setArticleImageId(pk);
088            }
089    
090            public Serializable getPrimaryKeyObj() {
091                    return new Long(_articleImageId);
092            }
093    
094            public long getArticleImageId() {
095                    return _articleImageId;
096            }
097    
098            public void setArticleImageId(long articleImageId) {
099                    _articleImageId = articleImageId;
100            }
101    
102            public long getGroupId() {
103                    return _groupId;
104            }
105    
106            public void setGroupId(long groupId) {
107                    _groupId = groupId;
108    
109                    if (!_setOriginalGroupId) {
110                            _setOriginalGroupId = true;
111    
112                            _originalGroupId = groupId;
113                    }
114            }
115    
116            public long getOriginalGroupId() {
117                    return _originalGroupId;
118            }
119    
120            public String getArticleId() {
121                    if (_articleId == null) {
122                            return StringPool.BLANK;
123                    }
124                    else {
125                            return _articleId;
126                    }
127            }
128    
129            public void setArticleId(String articleId) {
130                    _articleId = articleId;
131    
132                    if (_originalArticleId == null) {
133                            _originalArticleId = articleId;
134                    }
135            }
136    
137            public String getOriginalArticleId() {
138                    return GetterUtil.getString(_originalArticleId);
139            }
140    
141            public double getVersion() {
142                    return _version;
143            }
144    
145            public void setVersion(double version) {
146                    _version = version;
147    
148                    if (!_setOriginalVersion) {
149                            _setOriginalVersion = true;
150    
151                            _originalVersion = version;
152                    }
153            }
154    
155            public double getOriginalVersion() {
156                    return _originalVersion;
157            }
158    
159            public String getElInstanceId() {
160                    if (_elInstanceId == null) {
161                            return StringPool.BLANK;
162                    }
163                    else {
164                            return _elInstanceId;
165                    }
166            }
167    
168            public void setElInstanceId(String elInstanceId) {
169                    _elInstanceId = elInstanceId;
170    
171                    if (_originalElInstanceId == null) {
172                            _originalElInstanceId = elInstanceId;
173                    }
174            }
175    
176            public String getOriginalElInstanceId() {
177                    return GetterUtil.getString(_originalElInstanceId);
178            }
179    
180            public String getElName() {
181                    if (_elName == null) {
182                            return StringPool.BLANK;
183                    }
184                    else {
185                            return _elName;
186                    }
187            }
188    
189            public void setElName(String elName) {
190                    _elName = elName;
191    
192                    if (_originalElName == null) {
193                            _originalElName = elName;
194                    }
195            }
196    
197            public String getOriginalElName() {
198                    return GetterUtil.getString(_originalElName);
199            }
200    
201            public String getLanguageId() {
202                    if (_languageId == null) {
203                            return StringPool.BLANK;
204                    }
205                    else {
206                            return _languageId;
207                    }
208            }
209    
210            public void setLanguageId(String languageId) {
211                    _languageId = languageId;
212    
213                    if (_originalLanguageId == null) {
214                            _originalLanguageId = languageId;
215                    }
216            }
217    
218            public String getOriginalLanguageId() {
219                    return GetterUtil.getString(_originalLanguageId);
220            }
221    
222            public boolean getTempImage() {
223                    return _tempImage;
224            }
225    
226            public boolean isTempImage() {
227                    return _tempImage;
228            }
229    
230            public void setTempImage(boolean tempImage) {
231                    _tempImage = tempImage;
232            }
233    
234            public JournalArticleImage toEscapedModel() {
235                    if (isEscapedModel()) {
236                            return (JournalArticleImage)this;
237                    }
238                    else {
239                            return (JournalArticleImage)Proxy.newProxyInstance(JournalArticleImage.class.getClassLoader(),
240                                    new Class[] { JournalArticleImage.class },
241                                    new AutoEscapeBeanHandler(this));
242                    }
243            }
244    
245            public ExpandoBridge getExpandoBridge() {
246                    if (_expandoBridge == null) {
247                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
248                                            JournalArticleImage.class.getName(), getPrimaryKey());
249                    }
250    
251                    return _expandoBridge;
252            }
253    
254            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
255                    getExpandoBridge().setAttributes(serviceContext);
256            }
257    
258            public Object clone() {
259                    JournalArticleImageImpl clone = new JournalArticleImageImpl();
260    
261                    clone.setArticleImageId(getArticleImageId());
262                    clone.setGroupId(getGroupId());
263                    clone.setArticleId(getArticleId());
264                    clone.setVersion(getVersion());
265                    clone.setElInstanceId(getElInstanceId());
266                    clone.setElName(getElName());
267                    clone.setLanguageId(getLanguageId());
268                    clone.setTempImage(getTempImage());
269    
270                    return clone;
271            }
272    
273            public int compareTo(JournalArticleImage journalArticleImage) {
274                    long pk = journalArticleImage.getPrimaryKey();
275    
276                    if (getPrimaryKey() < pk) {
277                            return -1;
278                    }
279                    else if (getPrimaryKey() > pk) {
280                            return 1;
281                    }
282                    else {
283                            return 0;
284                    }
285            }
286    
287            public boolean equals(Object obj) {
288                    if (obj == null) {
289                            return false;
290                    }
291    
292                    JournalArticleImage journalArticleImage = null;
293    
294                    try {
295                            journalArticleImage = (JournalArticleImage)obj;
296                    }
297                    catch (ClassCastException cce) {
298                            return false;
299                    }
300    
301                    long pk = journalArticleImage.getPrimaryKey();
302    
303                    if (getPrimaryKey() == pk) {
304                            return true;
305                    }
306                    else {
307                            return false;
308                    }
309            }
310    
311            public int hashCode() {
312                    return (int)getPrimaryKey();
313            }
314    
315            public String toString() {
316                    StringBundler sb = new StringBundler(17);
317    
318                    sb.append("{articleImageId=");
319                    sb.append(getArticleImageId());
320                    sb.append(", groupId=");
321                    sb.append(getGroupId());
322                    sb.append(", articleId=");
323                    sb.append(getArticleId());
324                    sb.append(", version=");
325                    sb.append(getVersion());
326                    sb.append(", elInstanceId=");
327                    sb.append(getElInstanceId());
328                    sb.append(", elName=");
329                    sb.append(getElName());
330                    sb.append(", languageId=");
331                    sb.append(getLanguageId());
332                    sb.append(", tempImage=");
333                    sb.append(getTempImage());
334                    sb.append("}");
335    
336                    return sb.toString();
337            }
338    
339            public String toXmlString() {
340                    StringBundler sb = new StringBundler(28);
341    
342                    sb.append("<model><model-name>");
343                    sb.append("com.liferay.portlet.journal.model.JournalArticleImage");
344                    sb.append("</model-name>");
345    
346                    sb.append(
347                            "<column><column-name>articleImageId</column-name><column-value><![CDATA[");
348                    sb.append(getArticleImageId());
349                    sb.append("]]></column-value></column>");
350                    sb.append(
351                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
352                    sb.append(getGroupId());
353                    sb.append("]]></column-value></column>");
354                    sb.append(
355                            "<column><column-name>articleId</column-name><column-value><![CDATA[");
356                    sb.append(getArticleId());
357                    sb.append("]]></column-value></column>");
358                    sb.append(
359                            "<column><column-name>version</column-name><column-value><![CDATA[");
360                    sb.append(getVersion());
361                    sb.append("]]></column-value></column>");
362                    sb.append(
363                            "<column><column-name>elInstanceId</column-name><column-value><![CDATA[");
364                    sb.append(getElInstanceId());
365                    sb.append("]]></column-value></column>");
366                    sb.append(
367                            "<column><column-name>elName</column-name><column-value><![CDATA[");
368                    sb.append(getElName());
369                    sb.append("]]></column-value></column>");
370                    sb.append(
371                            "<column><column-name>languageId</column-name><column-value><![CDATA[");
372                    sb.append(getLanguageId());
373                    sb.append("]]></column-value></column>");
374                    sb.append(
375                            "<column><column-name>tempImage</column-name><column-value><![CDATA[");
376                    sb.append(getTempImage());
377                    sb.append("]]></column-value></column>");
378    
379                    sb.append("</model>");
380    
381                    return sb.toString();
382            }
383    
384            private long _articleImageId;
385            private long _groupId;
386            private long _originalGroupId;
387            private boolean _setOriginalGroupId;
388            private String _articleId;
389            private String _originalArticleId;
390            private double _version;
391            private double _originalVersion;
392            private boolean _setOriginalVersion;
393            private String _elInstanceId;
394            private String _originalElInstanceId;
395            private String _elName;
396            private String _originalElName;
397            private String _languageId;
398            private String _originalLanguageId;
399            private boolean _tempImage;
400            private transient ExpandoBridge _expandoBridge;
401    }