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