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 _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            @Override
309            public Object clone() {
310                    SCProductScreenshotImpl scProductScreenshotImpl = new SCProductScreenshotImpl();
311    
312                    scProductScreenshotImpl.setProductScreenshotId(getProductScreenshotId());
313                    scProductScreenshotImpl.setCompanyId(getCompanyId());
314                    scProductScreenshotImpl.setGroupId(getGroupId());
315                    scProductScreenshotImpl.setProductEntryId(getProductEntryId());
316                    scProductScreenshotImpl.setThumbnailId(getThumbnailId());
317                    scProductScreenshotImpl.setFullImageId(getFullImageId());
318                    scProductScreenshotImpl.setPriority(getPriority());
319    
320                    scProductScreenshotImpl.resetOriginalValues();
321    
322                    return scProductScreenshotImpl;
323            }
324    
325            public int compareTo(SCProductScreenshot scProductScreenshot) {
326                    int value = 0;
327    
328                    if (getProductEntryId() < scProductScreenshot.getProductEntryId()) {
329                            value = -1;
330                    }
331                    else if (getProductEntryId() > scProductScreenshot.getProductEntryId()) {
332                            value = 1;
333                    }
334                    else {
335                            value = 0;
336                    }
337    
338                    if (value != 0) {
339                            return value;
340                    }
341    
342                    if (getPriority() < scProductScreenshot.getPriority()) {
343                            value = -1;
344                    }
345                    else if (getPriority() > scProductScreenshot.getPriority()) {
346                            value = 1;
347                    }
348                    else {
349                            value = 0;
350                    }
351    
352                    if (value != 0) {
353                            return value;
354                    }
355    
356                    return 0;
357            }
358    
359            @Override
360            public boolean equals(Object obj) {
361                    if (obj == null) {
362                            return false;
363                    }
364    
365                    SCProductScreenshot scProductScreenshot = null;
366    
367                    try {
368                            scProductScreenshot = (SCProductScreenshot)obj;
369                    }
370                    catch (ClassCastException cce) {
371                            return false;
372                    }
373    
374                    long primaryKey = scProductScreenshot.getPrimaryKey();
375    
376                    if (getPrimaryKey() == primaryKey) {
377                            return true;
378                    }
379                    else {
380                            return false;
381                    }
382            }
383    
384            @Override
385            public int hashCode() {
386                    return (int)getPrimaryKey();
387            }
388    
389            @Override
390            public void resetOriginalValues() {
391                    SCProductScreenshotModelImpl scProductScreenshotModelImpl = this;
392    
393                    scProductScreenshotModelImpl._originalProductEntryId = scProductScreenshotModelImpl._productEntryId;
394    
395                    scProductScreenshotModelImpl._setOriginalProductEntryId = false;
396    
397                    scProductScreenshotModelImpl._originalThumbnailId = scProductScreenshotModelImpl._thumbnailId;
398    
399                    scProductScreenshotModelImpl._setOriginalThumbnailId = false;
400    
401                    scProductScreenshotModelImpl._originalFullImageId = scProductScreenshotModelImpl._fullImageId;
402    
403                    scProductScreenshotModelImpl._setOriginalFullImageId = false;
404    
405                    scProductScreenshotModelImpl._originalPriority = scProductScreenshotModelImpl._priority;
406    
407                    scProductScreenshotModelImpl._setOriginalPriority = false;
408    
409                    scProductScreenshotModelImpl._columnBitmask = 0;
410            }
411    
412            @Override
413            public CacheModel<SCProductScreenshot> toCacheModel() {
414                    SCProductScreenshotCacheModel scProductScreenshotCacheModel = new SCProductScreenshotCacheModel();
415    
416                    scProductScreenshotCacheModel.productScreenshotId = getProductScreenshotId();
417    
418                    scProductScreenshotCacheModel.companyId = getCompanyId();
419    
420                    scProductScreenshotCacheModel.groupId = getGroupId();
421    
422                    scProductScreenshotCacheModel.productEntryId = getProductEntryId();
423    
424                    scProductScreenshotCacheModel.thumbnailId = getThumbnailId();
425    
426                    scProductScreenshotCacheModel.fullImageId = getFullImageId();
427    
428                    scProductScreenshotCacheModel.priority = getPriority();
429    
430                    return scProductScreenshotCacheModel;
431            }
432    
433            @Override
434            public String toString() {
435                    StringBundler sb = new StringBundler(15);
436    
437                    sb.append("{productScreenshotId=");
438                    sb.append(getProductScreenshotId());
439                    sb.append(", companyId=");
440                    sb.append(getCompanyId());
441                    sb.append(", groupId=");
442                    sb.append(getGroupId());
443                    sb.append(", productEntryId=");
444                    sb.append(getProductEntryId());
445                    sb.append(", thumbnailId=");
446                    sb.append(getThumbnailId());
447                    sb.append(", fullImageId=");
448                    sb.append(getFullImageId());
449                    sb.append(", priority=");
450                    sb.append(getPriority());
451                    sb.append("}");
452    
453                    return sb.toString();
454            }
455    
456            public String toXmlString() {
457                    StringBundler sb = new StringBundler(25);
458    
459                    sb.append("<model><model-name>");
460                    sb.append(
461                            "com.liferay.portlet.softwarecatalog.model.SCProductScreenshot");
462                    sb.append("</model-name>");
463    
464                    sb.append(
465                            "<column><column-name>productScreenshotId</column-name><column-value><![CDATA[");
466                    sb.append(getProductScreenshotId());
467                    sb.append("]]></column-value></column>");
468                    sb.append(
469                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
470                    sb.append(getCompanyId());
471                    sb.append("]]></column-value></column>");
472                    sb.append(
473                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
474                    sb.append(getGroupId());
475                    sb.append("]]></column-value></column>");
476                    sb.append(
477                            "<column><column-name>productEntryId</column-name><column-value><![CDATA[");
478                    sb.append(getProductEntryId());
479                    sb.append("]]></column-value></column>");
480                    sb.append(
481                            "<column><column-name>thumbnailId</column-name><column-value><![CDATA[");
482                    sb.append(getThumbnailId());
483                    sb.append("]]></column-value></column>");
484                    sb.append(
485                            "<column><column-name>fullImageId</column-name><column-value><![CDATA[");
486                    sb.append(getFullImageId());
487                    sb.append("]]></column-value></column>");
488                    sb.append(
489                            "<column><column-name>priority</column-name><column-value><![CDATA[");
490                    sb.append(getPriority());
491                    sb.append("]]></column-value></column>");
492    
493                    sb.append("</model>");
494    
495                    return sb.toString();
496            }
497    
498            private static ClassLoader _classLoader = SCProductScreenshot.class.getClassLoader();
499            private static Class<?>[] _escapedModelInterfaces = new Class[] {
500                            SCProductScreenshot.class
501                    };
502            private long _productScreenshotId;
503            private long _companyId;
504            private long _groupId;
505            private long _productEntryId;
506            private long _originalProductEntryId;
507            private boolean _setOriginalProductEntryId;
508            private long _thumbnailId;
509            private long _originalThumbnailId;
510            private boolean _setOriginalThumbnailId;
511            private long _fullImageId;
512            private long _originalFullImageId;
513            private boolean _setOriginalFullImageId;
514            private int _priority;
515            private int _originalPriority;
516            private boolean _setOriginalPriority;
517            private long _columnBitmask;
518            private SCProductScreenshot _escapedModel;
519    }