001    /**
002     * Copyright (c) 2000-2013 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.ProxyUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.model.CacheModel;
023    import com.liferay.portal.model.impl.BaseModelImpl;
024    import com.liferay.portal.service.ServiceContext;
025    
026    import com.liferay.portlet.expando.model.ExpandoBridge;
027    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
028    import com.liferay.portlet.journal.model.JournalArticleImage;
029    import com.liferay.portlet.journal.model.JournalArticleImageModel;
030    
031    import java.io.Serializable;
032    
033    import java.sql.Types;
034    
035    import java.util.HashMap;
036    import java.util.Map;
037    
038    /**
039     * 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.
040     *
041     * <p>
042     * 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}.
043     * </p>
044     *
045     * @author Brian Wing Shun Chan
046     * @see JournalArticleImageImpl
047     * @see com.liferay.portlet.journal.model.JournalArticleImage
048     * @see com.liferay.portlet.journal.model.JournalArticleImageModel
049     * @generated
050     */
051    public class JournalArticleImageModelImpl extends BaseModelImpl<JournalArticleImage>
052            implements JournalArticleImageModel {
053            /*
054             * NOTE FOR DEVELOPERS:
055             *
056             * 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.
057             */
058            public static final String TABLE_NAME = "JournalArticleImage";
059            public static final Object[][] TABLE_COLUMNS = {
060                            { "articleImageId", Types.BIGINT },
061                            { "groupId", Types.BIGINT },
062                            { "articleId", Types.VARCHAR },
063                            { "version", Types.DOUBLE },
064                            { "elInstanceId", Types.VARCHAR },
065                            { "elName", Types.VARCHAR },
066                            { "languageId", Types.VARCHAR },
067                            { "tempImage", Types.BOOLEAN }
068                    };
069            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)";
070            public static final String TABLE_SQL_DROP = "drop table JournalArticleImage";
071            public static final String DATA_SOURCE = "liferayDataSource";
072            public static final String SESSION_FACTORY = "liferaySessionFactory";
073            public static final String TX_MANAGER = "liferayTransactionManager";
074            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
075                                    "value.object.entity.cache.enabled.com.liferay.portlet.journal.model.JournalArticleImage"),
076                            true);
077            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
078                                    "value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalArticleImage"),
079                            true);
080            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
081                                    "value.object.column.bitmask.enabled.com.liferay.portlet.journal.model.JournalArticleImage"),
082                            true);
083            public static long ARTICLEID_COLUMN_BITMASK = 1L;
084            public static long ELINSTANCEID_COLUMN_BITMASK = 2L;
085            public static long ELNAME_COLUMN_BITMASK = 4L;
086            public static long GROUPID_COLUMN_BITMASK = 8L;
087            public static long LANGUAGEID_COLUMN_BITMASK = 16L;
088            public static long TEMPIMAGE_COLUMN_BITMASK = 32L;
089            public static long VERSION_COLUMN_BITMASK = 64L;
090            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
091                                    "lock.expiration.time.com.liferay.portlet.journal.model.JournalArticleImage"));
092    
093            public JournalArticleImageModelImpl() {
094            }
095    
096            public long getPrimaryKey() {
097                    return _articleImageId;
098            }
099    
100            public void setPrimaryKey(long primaryKey) {
101                    setArticleImageId(primaryKey);
102            }
103    
104            public Serializable getPrimaryKeyObj() {
105                    return new Long(_articleImageId);
106            }
107    
108            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
109                    setPrimaryKey(((Long)primaryKeyObj).longValue());
110            }
111    
112            public Class<?> getModelClass() {
113                    return JournalArticleImage.class;
114            }
115    
116            public String getModelClassName() {
117                    return JournalArticleImage.class.getName();
118            }
119    
120            @Override
121            public Map<String, Object> getModelAttributes() {
122                    Map<String, Object> attributes = new HashMap<String, Object>();
123    
124                    attributes.put("articleImageId", getArticleImageId());
125                    attributes.put("groupId", getGroupId());
126                    attributes.put("articleId", getArticleId());
127                    attributes.put("version", getVersion());
128                    attributes.put("elInstanceId", getElInstanceId());
129                    attributes.put("elName", getElName());
130                    attributes.put("languageId", getLanguageId());
131                    attributes.put("tempImage", getTempImage());
132    
133                    return attributes;
134            }
135    
136            @Override
137            public void setModelAttributes(Map<String, Object> attributes) {
138                    Long articleImageId = (Long)attributes.get("articleImageId");
139    
140                    if (articleImageId != null) {
141                            setArticleImageId(articleImageId);
142                    }
143    
144                    Long groupId = (Long)attributes.get("groupId");
145    
146                    if (groupId != null) {
147                            setGroupId(groupId);
148                    }
149    
150                    String articleId = (String)attributes.get("articleId");
151    
152                    if (articleId != null) {
153                            setArticleId(articleId);
154                    }
155    
156                    Double version = (Double)attributes.get("version");
157    
158                    if (version != null) {
159                            setVersion(version);
160                    }
161    
162                    String elInstanceId = (String)attributes.get("elInstanceId");
163    
164                    if (elInstanceId != null) {
165                            setElInstanceId(elInstanceId);
166                    }
167    
168                    String elName = (String)attributes.get("elName");
169    
170                    if (elName != null) {
171                            setElName(elName);
172                    }
173    
174                    String languageId = (String)attributes.get("languageId");
175    
176                    if (languageId != null) {
177                            setLanguageId(languageId);
178                    }
179    
180                    Boolean tempImage = (Boolean)attributes.get("tempImage");
181    
182                    if (tempImage != null) {
183                            setTempImage(tempImage);
184                    }
185            }
186    
187            public long getArticleImageId() {
188                    return _articleImageId;
189            }
190    
191            public void setArticleImageId(long articleImageId) {
192                    _articleImageId = articleImageId;
193            }
194    
195            public long getGroupId() {
196                    return _groupId;
197            }
198    
199            public void setGroupId(long groupId) {
200                    _columnBitmask |= GROUPID_COLUMN_BITMASK;
201    
202                    if (!_setOriginalGroupId) {
203                            _setOriginalGroupId = true;
204    
205                            _originalGroupId = _groupId;
206                    }
207    
208                    _groupId = groupId;
209            }
210    
211            public long getOriginalGroupId() {
212                    return _originalGroupId;
213            }
214    
215            public String getArticleId() {
216                    if (_articleId == null) {
217                            return StringPool.BLANK;
218                    }
219                    else {
220                            return _articleId;
221                    }
222            }
223    
224            public void setArticleId(String articleId) {
225                    _columnBitmask |= ARTICLEID_COLUMN_BITMASK;
226    
227                    if (_originalArticleId == null) {
228                            _originalArticleId = _articleId;
229                    }
230    
231                    _articleId = articleId;
232            }
233    
234            public String getOriginalArticleId() {
235                    return GetterUtil.getString(_originalArticleId);
236            }
237    
238            public double getVersion() {
239                    return _version;
240            }
241    
242            public void setVersion(double version) {
243                    _columnBitmask |= VERSION_COLUMN_BITMASK;
244    
245                    if (!_setOriginalVersion) {
246                            _setOriginalVersion = true;
247    
248                            _originalVersion = _version;
249                    }
250    
251                    _version = version;
252            }
253    
254            public double getOriginalVersion() {
255                    return _originalVersion;
256            }
257    
258            public String getElInstanceId() {
259                    if (_elInstanceId == null) {
260                            return StringPool.BLANK;
261                    }
262                    else {
263                            return _elInstanceId;
264                    }
265            }
266    
267            public void setElInstanceId(String elInstanceId) {
268                    _columnBitmask |= ELINSTANCEID_COLUMN_BITMASK;
269    
270                    if (_originalElInstanceId == null) {
271                            _originalElInstanceId = _elInstanceId;
272                    }
273    
274                    _elInstanceId = elInstanceId;
275            }
276    
277            public String getOriginalElInstanceId() {
278                    return GetterUtil.getString(_originalElInstanceId);
279            }
280    
281            public String getElName() {
282                    if (_elName == null) {
283                            return StringPool.BLANK;
284                    }
285                    else {
286                            return _elName;
287                    }
288            }
289    
290            public void setElName(String elName) {
291                    _columnBitmask |= ELNAME_COLUMN_BITMASK;
292    
293                    if (_originalElName == null) {
294                            _originalElName = _elName;
295                    }
296    
297                    _elName = elName;
298            }
299    
300            public String getOriginalElName() {
301                    return GetterUtil.getString(_originalElName);
302            }
303    
304            public String getLanguageId() {
305                    if (_languageId == null) {
306                            return StringPool.BLANK;
307                    }
308                    else {
309                            return _languageId;
310                    }
311            }
312    
313            public void setLanguageId(String languageId) {
314                    _columnBitmask |= LANGUAGEID_COLUMN_BITMASK;
315    
316                    if (_originalLanguageId == null) {
317                            _originalLanguageId = _languageId;
318                    }
319    
320                    _languageId = languageId;
321            }
322    
323            public String getOriginalLanguageId() {
324                    return GetterUtil.getString(_originalLanguageId);
325            }
326    
327            public boolean getTempImage() {
328                    return _tempImage;
329            }
330    
331            public boolean isTempImage() {
332                    return _tempImage;
333            }
334    
335            public void setTempImage(boolean tempImage) {
336                    _columnBitmask |= TEMPIMAGE_COLUMN_BITMASK;
337    
338                    if (!_setOriginalTempImage) {
339                            _setOriginalTempImage = true;
340    
341                            _originalTempImage = _tempImage;
342                    }
343    
344                    _tempImage = tempImage;
345            }
346    
347            public boolean getOriginalTempImage() {
348                    return _originalTempImage;
349            }
350    
351            public long getColumnBitmask() {
352                    return _columnBitmask;
353            }
354    
355            @Override
356            public ExpandoBridge getExpandoBridge() {
357                    return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
358                            JournalArticleImage.class.getName(), getPrimaryKey());
359            }
360    
361            @Override
362            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
363                    ExpandoBridge expandoBridge = getExpandoBridge();
364    
365                    expandoBridge.setAttributes(serviceContext);
366            }
367    
368            @Override
369            public JournalArticleImage toEscapedModel() {
370                    if (_escapedModel == null) {
371                            _escapedModel = (JournalArticleImage)ProxyUtil.newProxyInstance(_classLoader,
372                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
373                    }
374    
375                    return _escapedModel;
376            }
377    
378            public JournalArticleImage toUnescapedModel() {
379                    return (JournalArticleImage)this;
380            }
381    
382            @Override
383            public Object clone() {
384                    JournalArticleImageImpl journalArticleImageImpl = new JournalArticleImageImpl();
385    
386                    journalArticleImageImpl.setArticleImageId(getArticleImageId());
387                    journalArticleImageImpl.setGroupId(getGroupId());
388                    journalArticleImageImpl.setArticleId(getArticleId());
389                    journalArticleImageImpl.setVersion(getVersion());
390                    journalArticleImageImpl.setElInstanceId(getElInstanceId());
391                    journalArticleImageImpl.setElName(getElName());
392                    journalArticleImageImpl.setLanguageId(getLanguageId());
393                    journalArticleImageImpl.setTempImage(getTempImage());
394    
395                    journalArticleImageImpl.resetOriginalValues();
396    
397                    return journalArticleImageImpl;
398            }
399    
400            public int compareTo(JournalArticleImage journalArticleImage) {
401                    long primaryKey = journalArticleImage.getPrimaryKey();
402    
403                    if (getPrimaryKey() < primaryKey) {
404                            return -1;
405                    }
406                    else if (getPrimaryKey() > primaryKey) {
407                            return 1;
408                    }
409                    else {
410                            return 0;
411                    }
412            }
413    
414            @Override
415            public boolean equals(Object obj) {
416                    if (this == obj) {
417                            return true;
418                    }
419    
420                    if (!(obj instanceof JournalArticleImage)) {
421                            return false;
422                    }
423    
424                    JournalArticleImage journalArticleImage = (JournalArticleImage)obj;
425    
426                    long primaryKey = journalArticleImage.getPrimaryKey();
427    
428                    if (getPrimaryKey() == primaryKey) {
429                            return true;
430                    }
431                    else {
432                            return false;
433                    }
434            }
435    
436            @Override
437            public int hashCode() {
438                    return (int)getPrimaryKey();
439            }
440    
441            @Override
442            public void resetOriginalValues() {
443                    JournalArticleImageModelImpl journalArticleImageModelImpl = this;
444    
445                    journalArticleImageModelImpl._originalGroupId = journalArticleImageModelImpl._groupId;
446    
447                    journalArticleImageModelImpl._setOriginalGroupId = false;
448    
449                    journalArticleImageModelImpl._originalArticleId = journalArticleImageModelImpl._articleId;
450    
451                    journalArticleImageModelImpl._originalVersion = journalArticleImageModelImpl._version;
452    
453                    journalArticleImageModelImpl._setOriginalVersion = false;
454    
455                    journalArticleImageModelImpl._originalElInstanceId = journalArticleImageModelImpl._elInstanceId;
456    
457                    journalArticleImageModelImpl._originalElName = journalArticleImageModelImpl._elName;
458    
459                    journalArticleImageModelImpl._originalLanguageId = journalArticleImageModelImpl._languageId;
460    
461                    journalArticleImageModelImpl._originalTempImage = journalArticleImageModelImpl._tempImage;
462    
463                    journalArticleImageModelImpl._setOriginalTempImage = false;
464    
465                    journalArticleImageModelImpl._columnBitmask = 0;
466            }
467    
468            @Override
469            public CacheModel<JournalArticleImage> toCacheModel() {
470                    JournalArticleImageCacheModel journalArticleImageCacheModel = new JournalArticleImageCacheModel();
471    
472                    journalArticleImageCacheModel.articleImageId = getArticleImageId();
473    
474                    journalArticleImageCacheModel.groupId = getGroupId();
475    
476                    journalArticleImageCacheModel.articleId = getArticleId();
477    
478                    String articleId = journalArticleImageCacheModel.articleId;
479    
480                    if ((articleId != null) && (articleId.length() == 0)) {
481                            journalArticleImageCacheModel.articleId = null;
482                    }
483    
484                    journalArticleImageCacheModel.version = getVersion();
485    
486                    journalArticleImageCacheModel.elInstanceId = getElInstanceId();
487    
488                    String elInstanceId = journalArticleImageCacheModel.elInstanceId;
489    
490                    if ((elInstanceId != null) && (elInstanceId.length() == 0)) {
491                            journalArticleImageCacheModel.elInstanceId = null;
492                    }
493    
494                    journalArticleImageCacheModel.elName = getElName();
495    
496                    String elName = journalArticleImageCacheModel.elName;
497    
498                    if ((elName != null) && (elName.length() == 0)) {
499                            journalArticleImageCacheModel.elName = null;
500                    }
501    
502                    journalArticleImageCacheModel.languageId = getLanguageId();
503    
504                    String languageId = journalArticleImageCacheModel.languageId;
505    
506                    if ((languageId != null) && (languageId.length() == 0)) {
507                            journalArticleImageCacheModel.languageId = null;
508                    }
509    
510                    journalArticleImageCacheModel.tempImage = getTempImage();
511    
512                    return journalArticleImageCacheModel;
513            }
514    
515            @Override
516            public String toString() {
517                    StringBundler sb = new StringBundler(17);
518    
519                    sb.append("{articleImageId=");
520                    sb.append(getArticleImageId());
521                    sb.append(", groupId=");
522                    sb.append(getGroupId());
523                    sb.append(", articleId=");
524                    sb.append(getArticleId());
525                    sb.append(", version=");
526                    sb.append(getVersion());
527                    sb.append(", elInstanceId=");
528                    sb.append(getElInstanceId());
529                    sb.append(", elName=");
530                    sb.append(getElName());
531                    sb.append(", languageId=");
532                    sb.append(getLanguageId());
533                    sb.append(", tempImage=");
534                    sb.append(getTempImage());
535                    sb.append("}");
536    
537                    return sb.toString();
538            }
539    
540            public String toXmlString() {
541                    StringBundler sb = new StringBundler(28);
542    
543                    sb.append("<model><model-name>");
544                    sb.append("com.liferay.portlet.journal.model.JournalArticleImage");
545                    sb.append("</model-name>");
546    
547                    sb.append(
548                            "<column><column-name>articleImageId</column-name><column-value><![CDATA[");
549                    sb.append(getArticleImageId());
550                    sb.append("]]></column-value></column>");
551                    sb.append(
552                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
553                    sb.append(getGroupId());
554                    sb.append("]]></column-value></column>");
555                    sb.append(
556                            "<column><column-name>articleId</column-name><column-value><![CDATA[");
557                    sb.append(getArticleId());
558                    sb.append("]]></column-value></column>");
559                    sb.append(
560                            "<column><column-name>version</column-name><column-value><![CDATA[");
561                    sb.append(getVersion());
562                    sb.append("]]></column-value></column>");
563                    sb.append(
564                            "<column><column-name>elInstanceId</column-name><column-value><![CDATA[");
565                    sb.append(getElInstanceId());
566                    sb.append("]]></column-value></column>");
567                    sb.append(
568                            "<column><column-name>elName</column-name><column-value><![CDATA[");
569                    sb.append(getElName());
570                    sb.append("]]></column-value></column>");
571                    sb.append(
572                            "<column><column-name>languageId</column-name><column-value><![CDATA[");
573                    sb.append(getLanguageId());
574                    sb.append("]]></column-value></column>");
575                    sb.append(
576                            "<column><column-name>tempImage</column-name><column-value><![CDATA[");
577                    sb.append(getTempImage());
578                    sb.append("]]></column-value></column>");
579    
580                    sb.append("</model>");
581    
582                    return sb.toString();
583            }
584    
585            private static ClassLoader _classLoader = JournalArticleImage.class.getClassLoader();
586            private static Class<?>[] _escapedModelInterfaces = new Class[] {
587                            JournalArticleImage.class
588                    };
589            private long _articleImageId;
590            private long _groupId;
591            private long _originalGroupId;
592            private boolean _setOriginalGroupId;
593            private String _articleId;
594            private String _originalArticleId;
595            private double _version;
596            private double _originalVersion;
597            private boolean _setOriginalVersion;
598            private String _elInstanceId;
599            private String _originalElInstanceId;
600            private String _elName;
601            private String _originalElName;
602            private String _languageId;
603            private String _originalLanguageId;
604            private boolean _tempImage;
605            private boolean _originalTempImage;
606            private boolean _setOriginalTempImage;
607            private long _columnBitmask;
608            private JournalArticleImage _escapedModel;
609    }