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