001    /**
002     * Copyright (c) 2000-present 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.softwarecatalog.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
020    import com.liferay.portal.kernel.util.GetterUtil;
021    import com.liferay.portal.kernel.util.ProxyUtil;
022    import com.liferay.portal.kernel.util.StringBundler;
023    import com.liferay.portal.model.CacheModel;
024    import com.liferay.portal.model.impl.BaseModelImpl;
025    import com.liferay.portal.service.ServiceContext;
026    
027    import com.liferay.portlet.expando.model.ExpandoBridge;
028    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
029    import com.liferay.portlet.softwarecatalog.model.SCProductScreenshot;
030    import com.liferay.portlet.softwarecatalog.model.SCProductScreenshotModel;
031    
032    import java.io.Serializable;
033    
034    import java.sql.Types;
035    
036    import java.util.HashMap;
037    import java.util.Map;
038    
039    /**
040     * The base model implementation for the SCProductScreenshot service. Represents a row in the "SCProductScreenshot" database table, with each column mapped to a property of this class.
041     *
042     * <p>
043     * This implementation and its corresponding interface {@link SCProductScreenshotModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link SCProductScreenshotImpl}.
044     * </p>
045     *
046     * @author Brian Wing Shun Chan
047     * @see SCProductScreenshotImpl
048     * @see SCProductScreenshot
049     * @see SCProductScreenshotModel
050     * @generated
051     */
052    @ProviderType
053    public class SCProductScreenshotModelImpl extends BaseModelImpl<SCProductScreenshot>
054            implements SCProductScreenshotModel {
055            /*
056             * NOTE FOR DEVELOPERS:
057             *
058             * Never modify or reference this class directly. All methods that expect a s c product screenshot model instance should use the {@link SCProductScreenshot} interface instead.
059             */
060            public static final String TABLE_NAME = "SCProductScreenshot";
061            public static final Object[][] TABLE_COLUMNS = {
062                            { "productScreenshotId", Types.BIGINT },
063                            { "companyId", Types.BIGINT },
064                            { "groupId", Types.BIGINT },
065                            { "productEntryId", Types.BIGINT },
066                            { "thumbnailId", Types.BIGINT },
067                            { "fullImageId", Types.BIGINT },
068                            { "priority", Types.INTEGER }
069                    };
070            public static final Map<String, Integer> TABLE_COLUMNS_MAP = new HashMap<String, Integer>();
071    
072            static {
073                    TABLE_COLUMNS_MAP.put("productScreenshotId", Types.BIGINT);
074                    TABLE_COLUMNS_MAP.put("companyId", Types.BIGINT);
075                    TABLE_COLUMNS_MAP.put("groupId", Types.BIGINT);
076                    TABLE_COLUMNS_MAP.put("productEntryId", Types.BIGINT);
077                    TABLE_COLUMNS_MAP.put("thumbnailId", Types.BIGINT);
078                    TABLE_COLUMNS_MAP.put("fullImageId", Types.BIGINT);
079                    TABLE_COLUMNS_MAP.put("priority", Types.INTEGER);
080            }
081    
082            public static final String TABLE_SQL_CREATE = "create table SCProductScreenshot (productScreenshotId LONG not null primary key,companyId LONG,groupId LONG,productEntryId LONG,thumbnailId LONG,fullImageId LONG,priority INTEGER)";
083            public static final String TABLE_SQL_DROP = "drop table SCProductScreenshot";
084            public static final String ORDER_BY_JPQL = " ORDER BY scProductScreenshot.productEntryId ASC, scProductScreenshot.priority ASC";
085            public static final String ORDER_BY_SQL = " ORDER BY SCProductScreenshot.productEntryId ASC, SCProductScreenshot.priority ASC";
086            public static final String DATA_SOURCE = "liferayDataSource";
087            public static final String SESSION_FACTORY = "liferaySessionFactory";
088            public static final String TX_MANAGER = "liferayTransactionManager";
089            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
090                                    "value.object.entity.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"),
091                            true);
092            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
093                                    "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"),
094                            true);
095            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
096                                    "value.object.column.bitmask.enabled.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"),
097                            true);
098            public static final long FULLIMAGEID_COLUMN_BITMASK = 1L;
099            public static final long PRIORITY_COLUMN_BITMASK = 2L;
100            public static final long PRODUCTENTRYID_COLUMN_BITMASK = 4L;
101            public static final long THUMBNAILID_COLUMN_BITMASK = 8L;
102            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
103                                    "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"));
104    
105            public SCProductScreenshotModelImpl() {
106            }
107    
108            @Override
109            public long getPrimaryKey() {
110                    return _productScreenshotId;
111            }
112    
113            @Override
114            public void setPrimaryKey(long primaryKey) {
115                    setProductScreenshotId(primaryKey);
116            }
117    
118            @Override
119            public Serializable getPrimaryKeyObj() {
120                    return _productScreenshotId;
121            }
122    
123            @Override
124            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
125                    setPrimaryKey(((Long)primaryKeyObj).longValue());
126            }
127    
128            @Override
129            public Class<?> getModelClass() {
130                    return SCProductScreenshot.class;
131            }
132    
133            @Override
134            public String getModelClassName() {
135                    return SCProductScreenshot.class.getName();
136            }
137    
138            @Override
139            public Map<String, Object> getModelAttributes() {
140                    Map<String, Object> attributes = new HashMap<String, Object>();
141    
142                    attributes.put("productScreenshotId", getProductScreenshotId());
143                    attributes.put("companyId", getCompanyId());
144                    attributes.put("groupId", getGroupId());
145                    attributes.put("productEntryId", getProductEntryId());
146                    attributes.put("thumbnailId", getThumbnailId());
147                    attributes.put("fullImageId", getFullImageId());
148                    attributes.put("priority", getPriority());
149    
150                    attributes.put("entityCacheEnabled", isEntityCacheEnabled());
151                    attributes.put("finderCacheEnabled", isFinderCacheEnabled());
152    
153                    return attributes;
154            }
155    
156            @Override
157            public void setModelAttributes(Map<String, Object> attributes) {
158                    Long productScreenshotId = (Long)attributes.get("productScreenshotId");
159    
160                    if (productScreenshotId != null) {
161                            setProductScreenshotId(productScreenshotId);
162                    }
163    
164                    Long companyId = (Long)attributes.get("companyId");
165    
166                    if (companyId != null) {
167                            setCompanyId(companyId);
168                    }
169    
170                    Long groupId = (Long)attributes.get("groupId");
171    
172                    if (groupId != null) {
173                            setGroupId(groupId);
174                    }
175    
176                    Long productEntryId = (Long)attributes.get("productEntryId");
177    
178                    if (productEntryId != null) {
179                            setProductEntryId(productEntryId);
180                    }
181    
182                    Long thumbnailId = (Long)attributes.get("thumbnailId");
183    
184                    if (thumbnailId != null) {
185                            setThumbnailId(thumbnailId);
186                    }
187    
188                    Long fullImageId = (Long)attributes.get("fullImageId");
189    
190                    if (fullImageId != null) {
191                            setFullImageId(fullImageId);
192                    }
193    
194                    Integer priority = (Integer)attributes.get("priority");
195    
196                    if (priority != null) {
197                            setPriority(priority);
198                    }
199            }
200    
201            @Override
202            public long getProductScreenshotId() {
203                    return _productScreenshotId;
204            }
205    
206            @Override
207            public void setProductScreenshotId(long productScreenshotId) {
208                    _productScreenshotId = productScreenshotId;
209            }
210    
211            @Override
212            public long getCompanyId() {
213                    return _companyId;
214            }
215    
216            @Override
217            public void setCompanyId(long companyId) {
218                    _companyId = companyId;
219            }
220    
221            @Override
222            public long getGroupId() {
223                    return _groupId;
224            }
225    
226            @Override
227            public void setGroupId(long groupId) {
228                    _groupId = groupId;
229            }
230    
231            @Override
232            public long getProductEntryId() {
233                    return _productEntryId;
234            }
235    
236            @Override
237            public void setProductEntryId(long productEntryId) {
238                    _columnBitmask = -1L;
239    
240                    if (!_setOriginalProductEntryId) {
241                            _setOriginalProductEntryId = true;
242    
243                            _originalProductEntryId = _productEntryId;
244                    }
245    
246                    _productEntryId = productEntryId;
247            }
248    
249            public long getOriginalProductEntryId() {
250                    return _originalProductEntryId;
251            }
252    
253            @Override
254            public long getThumbnailId() {
255                    return _thumbnailId;
256            }
257    
258            @Override
259            public void setThumbnailId(long thumbnailId) {
260                    _columnBitmask |= THUMBNAILID_COLUMN_BITMASK;
261    
262                    if (!_setOriginalThumbnailId) {
263                            _setOriginalThumbnailId = true;
264    
265                            _originalThumbnailId = _thumbnailId;
266                    }
267    
268                    _thumbnailId = thumbnailId;
269            }
270    
271            public long getOriginalThumbnailId() {
272                    return _originalThumbnailId;
273            }
274    
275            @Override
276            public long getFullImageId() {
277                    return _fullImageId;
278            }
279    
280            @Override
281            public void setFullImageId(long fullImageId) {
282                    _columnBitmask |= FULLIMAGEID_COLUMN_BITMASK;
283    
284                    if (!_setOriginalFullImageId) {
285                            _setOriginalFullImageId = true;
286    
287                            _originalFullImageId = _fullImageId;
288                    }
289    
290                    _fullImageId = fullImageId;
291            }
292    
293            public long getOriginalFullImageId() {
294                    return _originalFullImageId;
295            }
296    
297            @Override
298            public int getPriority() {
299                    return _priority;
300            }
301    
302            @Override
303            public void setPriority(int priority) {
304                    _columnBitmask = -1L;
305    
306                    if (!_setOriginalPriority) {
307                            _setOriginalPriority = true;
308    
309                            _originalPriority = _priority;
310                    }
311    
312                    _priority = priority;
313            }
314    
315            public int getOriginalPriority() {
316                    return _originalPriority;
317            }
318    
319            public long getColumnBitmask() {
320                    return _columnBitmask;
321            }
322    
323            @Override
324            public ExpandoBridge getExpandoBridge() {
325                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
326                            SCProductScreenshot.class.getName(), getPrimaryKey());
327            }
328    
329            @Override
330            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
331                    ExpandoBridge expandoBridge = getExpandoBridge();
332    
333                    expandoBridge.setAttributes(serviceContext);
334            }
335    
336            @Override
337            public SCProductScreenshot toEscapedModel() {
338                    if (_escapedModel == null) {
339                            _escapedModel = (SCProductScreenshot)ProxyUtil.newProxyInstance(_classLoader,
340                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
341                    }
342    
343                    return _escapedModel;
344            }
345    
346            @Override
347            public Object clone() {
348                    SCProductScreenshotImpl scProductScreenshotImpl = new SCProductScreenshotImpl();
349    
350                    scProductScreenshotImpl.setProductScreenshotId(getProductScreenshotId());
351                    scProductScreenshotImpl.setCompanyId(getCompanyId());
352                    scProductScreenshotImpl.setGroupId(getGroupId());
353                    scProductScreenshotImpl.setProductEntryId(getProductEntryId());
354                    scProductScreenshotImpl.setThumbnailId(getThumbnailId());
355                    scProductScreenshotImpl.setFullImageId(getFullImageId());
356                    scProductScreenshotImpl.setPriority(getPriority());
357    
358                    scProductScreenshotImpl.resetOriginalValues();
359    
360                    return scProductScreenshotImpl;
361            }
362    
363            @Override
364            public int compareTo(SCProductScreenshot scProductScreenshot) {
365                    int value = 0;
366    
367                    if (getProductEntryId() < scProductScreenshot.getProductEntryId()) {
368                            value = -1;
369                    }
370                    else if (getProductEntryId() > scProductScreenshot.getProductEntryId()) {
371                            value = 1;
372                    }
373                    else {
374                            value = 0;
375                    }
376    
377                    if (value != 0) {
378                            return value;
379                    }
380    
381                    if (getPriority() < scProductScreenshot.getPriority()) {
382                            value = -1;
383                    }
384                    else if (getPriority() > scProductScreenshot.getPriority()) {
385                            value = 1;
386                    }
387                    else {
388                            value = 0;
389                    }
390    
391                    if (value != 0) {
392                            return value;
393                    }
394    
395                    return 0;
396            }
397    
398            @Override
399            public boolean equals(Object obj) {
400                    if (this == obj) {
401                            return true;
402                    }
403    
404                    if (!(obj instanceof SCProductScreenshot)) {
405                            return false;
406                    }
407    
408                    SCProductScreenshot scProductScreenshot = (SCProductScreenshot)obj;
409    
410                    long primaryKey = scProductScreenshot.getPrimaryKey();
411    
412                    if (getPrimaryKey() == primaryKey) {
413                            return true;
414                    }
415                    else {
416                            return false;
417                    }
418            }
419    
420            @Override
421            public int hashCode() {
422                    return (int)getPrimaryKey();
423            }
424    
425            @Override
426            public boolean isEntityCacheEnabled() {
427                    return ENTITY_CACHE_ENABLED;
428            }
429    
430            @Override
431            public boolean isFinderCacheEnabled() {
432                    return FINDER_CACHE_ENABLED;
433            }
434    
435            @Override
436            public void resetOriginalValues() {
437                    SCProductScreenshotModelImpl scProductScreenshotModelImpl = this;
438    
439                    scProductScreenshotModelImpl._originalProductEntryId = scProductScreenshotModelImpl._productEntryId;
440    
441                    scProductScreenshotModelImpl._setOriginalProductEntryId = false;
442    
443                    scProductScreenshotModelImpl._originalThumbnailId = scProductScreenshotModelImpl._thumbnailId;
444    
445                    scProductScreenshotModelImpl._setOriginalThumbnailId = false;
446    
447                    scProductScreenshotModelImpl._originalFullImageId = scProductScreenshotModelImpl._fullImageId;
448    
449                    scProductScreenshotModelImpl._setOriginalFullImageId = false;
450    
451                    scProductScreenshotModelImpl._originalPriority = scProductScreenshotModelImpl._priority;
452    
453                    scProductScreenshotModelImpl._setOriginalPriority = false;
454    
455                    scProductScreenshotModelImpl._columnBitmask = 0;
456            }
457    
458            @Override
459            public CacheModel<SCProductScreenshot> toCacheModel() {
460                    SCProductScreenshotCacheModel scProductScreenshotCacheModel = new SCProductScreenshotCacheModel();
461    
462                    scProductScreenshotCacheModel.productScreenshotId = getProductScreenshotId();
463    
464                    scProductScreenshotCacheModel.companyId = getCompanyId();
465    
466                    scProductScreenshotCacheModel.groupId = getGroupId();
467    
468                    scProductScreenshotCacheModel.productEntryId = getProductEntryId();
469    
470                    scProductScreenshotCacheModel.thumbnailId = getThumbnailId();
471    
472                    scProductScreenshotCacheModel.fullImageId = getFullImageId();
473    
474                    scProductScreenshotCacheModel.priority = getPriority();
475    
476                    return scProductScreenshotCacheModel;
477            }
478    
479            @Override
480            public String toString() {
481                    StringBundler sb = new StringBundler(15);
482    
483                    sb.append("{productScreenshotId=");
484                    sb.append(getProductScreenshotId());
485                    sb.append(", companyId=");
486                    sb.append(getCompanyId());
487                    sb.append(", groupId=");
488                    sb.append(getGroupId());
489                    sb.append(", productEntryId=");
490                    sb.append(getProductEntryId());
491                    sb.append(", thumbnailId=");
492                    sb.append(getThumbnailId());
493                    sb.append(", fullImageId=");
494                    sb.append(getFullImageId());
495                    sb.append(", priority=");
496                    sb.append(getPriority());
497                    sb.append("}");
498    
499                    return sb.toString();
500            }
501    
502            @Override
503            public String toXmlString() {
504                    StringBundler sb = new StringBundler(25);
505    
506                    sb.append("<model><model-name>");
507                    sb.append(
508                            "com.liferay.portlet.softwarecatalog.model.SCProductScreenshot");
509                    sb.append("</model-name>");
510    
511                    sb.append(
512                            "<column><column-name>productScreenshotId</column-name><column-value><![CDATA[");
513                    sb.append(getProductScreenshotId());
514                    sb.append("]]></column-value></column>");
515                    sb.append(
516                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
517                    sb.append(getCompanyId());
518                    sb.append("]]></column-value></column>");
519                    sb.append(
520                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
521                    sb.append(getGroupId());
522                    sb.append("]]></column-value></column>");
523                    sb.append(
524                            "<column><column-name>productEntryId</column-name><column-value><![CDATA[");
525                    sb.append(getProductEntryId());
526                    sb.append("]]></column-value></column>");
527                    sb.append(
528                            "<column><column-name>thumbnailId</column-name><column-value><![CDATA[");
529                    sb.append(getThumbnailId());
530                    sb.append("]]></column-value></column>");
531                    sb.append(
532                            "<column><column-name>fullImageId</column-name><column-value><![CDATA[");
533                    sb.append(getFullImageId());
534                    sb.append("]]></column-value></column>");
535                    sb.append(
536                            "<column><column-name>priority</column-name><column-value><![CDATA[");
537                    sb.append(getPriority());
538                    sb.append("]]></column-value></column>");
539    
540                    sb.append("</model>");
541    
542                    return sb.toString();
543            }
544    
545            private static final ClassLoader _classLoader = SCProductScreenshot.class.getClassLoader();
546            private static final Class<?>[] _escapedModelInterfaces = new Class[] {
547                            SCProductScreenshot.class
548                    };
549            private long _productScreenshotId;
550            private long _companyId;
551            private long _groupId;
552            private long _productEntryId;
553            private long _originalProductEntryId;
554            private boolean _setOriginalProductEntryId;
555            private long _thumbnailId;
556            private long _originalThumbnailId;
557            private boolean _setOriginalThumbnailId;
558            private long _fullImageId;
559            private long _originalFullImageId;
560            private boolean _setOriginalFullImageId;
561            private int _priority;
562            private int _originalPriority;
563            private boolean _setOriginalPriority;
564            private long _columnBitmask;
565            private SCProductScreenshot _escapedModel;
566    }