001    /**
002     * Copyright (c) 2000-2011 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.StringBundler;
020    import com.liferay.portal.model.impl.BaseModelImpl;
021    import com.liferay.portal.service.ServiceContext;
022    
023    import com.liferay.portlet.expando.model.ExpandoBridge;
024    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
025    import com.liferay.portlet.softwarecatalog.model.SCProductScreenshot;
026    import com.liferay.portlet.softwarecatalog.model.SCProductScreenshotModel;
027    
028    import java.io.Serializable;
029    
030    import java.lang.reflect.Proxy;
031    
032    import java.sql.Types;
033    
034    /**
035     * 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.
036     *
037     * <p>
038     * 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}.
039     * </p>
040     *
041     * <p>
042     * 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.
043     * </p>
044     *
045     * @author Brian Wing Shun Chan
046     * @see SCProductScreenshotImpl
047     * @see com.liferay.portlet.softwarecatalog.model.SCProductScreenshot
048     * @see com.liferay.portlet.softwarecatalog.model.SCProductScreenshotModel
049     * @generated
050     */
051    public class SCProductScreenshotModelImpl extends BaseModelImpl<SCProductScreenshot>
052            implements SCProductScreenshotModel {
053            public static final String TABLE_NAME = "SCProductScreenshot";
054            public static final Object[][] TABLE_COLUMNS = {
055                            { "productScreenshotId", new Integer(Types.BIGINT) },
056                            { "companyId", new Integer(Types.BIGINT) },
057                            { "groupId", new Integer(Types.BIGINT) },
058                            { "productEntryId", new Integer(Types.BIGINT) },
059                            { "thumbnailId", new Integer(Types.BIGINT) },
060                            { "fullImageId", new Integer(Types.BIGINT) },
061                            { "priority", new Integer(Types.INTEGER) }
062                    };
063            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)";
064            public static final String TABLE_SQL_DROP = "drop table SCProductScreenshot";
065            public static final String ORDER_BY_JPQL = " ORDER BY scProductScreenshot.productEntryId ASC, scProductScreenshot.priority ASC";
066            public static final String ORDER_BY_SQL = " ORDER BY SCProductScreenshot.productEntryId ASC, SCProductScreenshot.priority ASC";
067            public static final String DATA_SOURCE = "liferayDataSource";
068            public static final String SESSION_FACTORY = "liferaySessionFactory";
069            public static final String TX_MANAGER = "liferayTransactionManager";
070            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
071                                    "value.object.entity.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"),
072                            true);
073            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
074                                    "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"),
075                            true);
076            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
077                                    "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"));
078    
079            public SCProductScreenshotModelImpl() {
080            }
081    
082            public long getPrimaryKey() {
083                    return _productScreenshotId;
084            }
085    
086            public void setPrimaryKey(long pk) {
087                    setProductScreenshotId(pk);
088            }
089    
090            public Serializable getPrimaryKeyObj() {
091                    return new Long(_productScreenshotId);
092            }
093    
094            public long getProductScreenshotId() {
095                    return _productScreenshotId;
096            }
097    
098            public void setProductScreenshotId(long productScreenshotId) {
099                    _productScreenshotId = productScreenshotId;
100            }
101    
102            public long getCompanyId() {
103                    return _companyId;
104            }
105    
106            public void setCompanyId(long companyId) {
107                    _companyId = companyId;
108            }
109    
110            public long getGroupId() {
111                    return _groupId;
112            }
113    
114            public void setGroupId(long groupId) {
115                    _groupId = groupId;
116            }
117    
118            public long getProductEntryId() {
119                    return _productEntryId;
120            }
121    
122            public void setProductEntryId(long productEntryId) {
123                    if (!_setOriginalProductEntryId) {
124                            _setOriginalProductEntryId = true;
125    
126                            _originalProductEntryId = _productEntryId;
127                    }
128    
129                    _productEntryId = productEntryId;
130            }
131    
132            public long getOriginalProductEntryId() {
133                    return _originalProductEntryId;
134            }
135    
136            public long getThumbnailId() {
137                    return _thumbnailId;
138            }
139    
140            public void setThumbnailId(long thumbnailId) {
141                    if (!_setOriginalThumbnailId) {
142                            _setOriginalThumbnailId = true;
143    
144                            _originalThumbnailId = _thumbnailId;
145                    }
146    
147                    _thumbnailId = thumbnailId;
148            }
149    
150            public long getOriginalThumbnailId() {
151                    return _originalThumbnailId;
152            }
153    
154            public long getFullImageId() {
155                    return _fullImageId;
156            }
157    
158            public void setFullImageId(long fullImageId) {
159                    if (!_setOriginalFullImageId) {
160                            _setOriginalFullImageId = true;
161    
162                            _originalFullImageId = _fullImageId;
163                    }
164    
165                    _fullImageId = fullImageId;
166            }
167    
168            public long getOriginalFullImageId() {
169                    return _originalFullImageId;
170            }
171    
172            public int getPriority() {
173                    return _priority;
174            }
175    
176            public void setPriority(int priority) {
177                    if (!_setOriginalPriority) {
178                            _setOriginalPriority = true;
179    
180                            _originalPriority = _priority;
181                    }
182    
183                    _priority = priority;
184            }
185    
186            public int getOriginalPriority() {
187                    return _originalPriority;
188            }
189    
190            public SCProductScreenshot toEscapedModel() {
191                    if (isEscapedModel()) {
192                            return (SCProductScreenshot)this;
193                    }
194                    else {
195                            return (SCProductScreenshot)Proxy.newProxyInstance(SCProductScreenshot.class.getClassLoader(),
196                                    new Class[] { SCProductScreenshot.class },
197                                    new AutoEscapeBeanHandler(this));
198                    }
199            }
200    
201            public ExpandoBridge getExpandoBridge() {
202                    if (_expandoBridge == null) {
203                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
204                                            SCProductScreenshot.class.getName(), getPrimaryKey());
205                    }
206    
207                    return _expandoBridge;
208            }
209    
210            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
211                    getExpandoBridge().setAttributes(serviceContext);
212            }
213    
214            public Object clone() {
215                    SCProductScreenshotImpl scProductScreenshotImpl = new SCProductScreenshotImpl();
216    
217                    scProductScreenshotImpl.setProductScreenshotId(getProductScreenshotId());
218    
219                    scProductScreenshotImpl.setCompanyId(getCompanyId());
220    
221                    scProductScreenshotImpl.setGroupId(getGroupId());
222    
223                    scProductScreenshotImpl.setProductEntryId(getProductEntryId());
224    
225                    SCProductScreenshotModelImpl scProductScreenshotModelImpl = scProductScreenshotImpl;
226    
227                    scProductScreenshotModelImpl._originalProductEntryId = scProductScreenshotModelImpl._productEntryId;
228    
229                    scProductScreenshotModelImpl._setOriginalProductEntryId = false;
230                    scProductScreenshotImpl.setThumbnailId(getThumbnailId());
231    
232                    scProductScreenshotModelImpl._originalThumbnailId = scProductScreenshotModelImpl._thumbnailId;
233    
234                    scProductScreenshotModelImpl._setOriginalThumbnailId = false;
235                    scProductScreenshotImpl.setFullImageId(getFullImageId());
236    
237                    scProductScreenshotModelImpl._originalFullImageId = scProductScreenshotModelImpl._fullImageId;
238    
239                    scProductScreenshotModelImpl._setOriginalFullImageId = false;
240                    scProductScreenshotImpl.setPriority(getPriority());
241    
242                    scProductScreenshotModelImpl._originalPriority = scProductScreenshotModelImpl._priority;
243    
244                    scProductScreenshotModelImpl._setOriginalPriority = false;
245    
246                    return scProductScreenshotImpl;
247            }
248    
249            public int compareTo(SCProductScreenshot scProductScreenshot) {
250                    int value = 0;
251    
252                    if (getProductEntryId() < scProductScreenshot.getProductEntryId()) {
253                            value = -1;
254                    }
255                    else if (getProductEntryId() > scProductScreenshot.getProductEntryId()) {
256                            value = 1;
257                    }
258                    else {
259                            value = 0;
260                    }
261    
262                    if (value != 0) {
263                            return value;
264                    }
265    
266                    if (getPriority() < scProductScreenshot.getPriority()) {
267                            value = -1;
268                    }
269                    else if (getPriority() > scProductScreenshot.getPriority()) {
270                            value = 1;
271                    }
272                    else {
273                            value = 0;
274                    }
275    
276                    if (value != 0) {
277                            return value;
278                    }
279    
280                    return 0;
281            }
282    
283            public boolean equals(Object obj) {
284                    if (obj == null) {
285                            return false;
286                    }
287    
288                    SCProductScreenshot scProductScreenshot = null;
289    
290                    try {
291                            scProductScreenshot = (SCProductScreenshot)obj;
292                    }
293                    catch (ClassCastException cce) {
294                            return false;
295                    }
296    
297                    long pk = scProductScreenshot.getPrimaryKey();
298    
299                    if (getPrimaryKey() == pk) {
300                            return true;
301                    }
302                    else {
303                            return false;
304                    }
305            }
306    
307            public int hashCode() {
308                    return (int)getPrimaryKey();
309            }
310    
311            public String toString() {
312                    StringBundler sb = new StringBundler(15);
313    
314                    sb.append("{productScreenshotId=");
315                    sb.append(getProductScreenshotId());
316                    sb.append(", companyId=");
317                    sb.append(getCompanyId());
318                    sb.append(", groupId=");
319                    sb.append(getGroupId());
320                    sb.append(", productEntryId=");
321                    sb.append(getProductEntryId());
322                    sb.append(", thumbnailId=");
323                    sb.append(getThumbnailId());
324                    sb.append(", fullImageId=");
325                    sb.append(getFullImageId());
326                    sb.append(", priority=");
327                    sb.append(getPriority());
328                    sb.append("}");
329    
330                    return sb.toString();
331            }
332    
333            public String toXmlString() {
334                    StringBundler sb = new StringBundler(25);
335    
336                    sb.append("<model><model-name>");
337                    sb.append(
338                            "com.liferay.portlet.softwarecatalog.model.SCProductScreenshot");
339                    sb.append("</model-name>");
340    
341                    sb.append(
342                            "<column><column-name>productScreenshotId</column-name><column-value><![CDATA[");
343                    sb.append(getProductScreenshotId());
344                    sb.append("]]></column-value></column>");
345                    sb.append(
346                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
347                    sb.append(getCompanyId());
348                    sb.append("]]></column-value></column>");
349                    sb.append(
350                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
351                    sb.append(getGroupId());
352                    sb.append("]]></column-value></column>");
353                    sb.append(
354                            "<column><column-name>productEntryId</column-name><column-value><![CDATA[");
355                    sb.append(getProductEntryId());
356                    sb.append("]]></column-value></column>");
357                    sb.append(
358                            "<column><column-name>thumbnailId</column-name><column-value><![CDATA[");
359                    sb.append(getThumbnailId());
360                    sb.append("]]></column-value></column>");
361                    sb.append(
362                            "<column><column-name>fullImageId</column-name><column-value><![CDATA[");
363                    sb.append(getFullImageId());
364                    sb.append("]]></column-value></column>");
365                    sb.append(
366                            "<column><column-name>priority</column-name><column-value><![CDATA[");
367                    sb.append(getPriority());
368                    sb.append("]]></column-value></column>");
369    
370                    sb.append("</model>");
371    
372                    return sb.toString();
373            }
374    
375            private long _productScreenshotId;
376            private long _companyId;
377            private long _groupId;
378            private long _productEntryId;
379            private long _originalProductEntryId;
380            private boolean _setOriginalProductEntryId;
381            private long _thumbnailId;
382            private long _originalThumbnailId;
383            private boolean _setOriginalThumbnailId;
384            private long _fullImageId;
385            private long _originalFullImageId;
386            private boolean _setOriginalFullImageId;
387            private int _priority;
388            private int _originalPriority;
389            private boolean _setOriginalPriority;
390            private transient ExpandoBridge _expandoBridge;
391    }