001    /**
002     * Copyright (c) 2000-2010 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                    _productEntryId = productEntryId;
124    
125                    if (!_setOriginalProductEntryId) {
126                            _setOriginalProductEntryId = true;
127    
128                            _originalProductEntryId = productEntryId;
129                    }
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                    _thumbnailId = thumbnailId;
142    
143                    if (!_setOriginalThumbnailId) {
144                            _setOriginalThumbnailId = true;
145    
146                            _originalThumbnailId = thumbnailId;
147                    }
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                    _fullImageId = fullImageId;
160    
161                    if (!_setOriginalFullImageId) {
162                            _setOriginalFullImageId = true;
163    
164                            _originalFullImageId = fullImageId;
165                    }
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                    _priority = priority;
178    
179                    if (!_setOriginalPriority) {
180                            _setOriginalPriority = true;
181    
182                            _originalPriority = priority;
183                    }
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 clone = new SCProductScreenshotImpl();
216    
217                    clone.setProductScreenshotId(getProductScreenshotId());
218                    clone.setCompanyId(getCompanyId());
219                    clone.setGroupId(getGroupId());
220                    clone.setProductEntryId(getProductEntryId());
221                    clone.setThumbnailId(getThumbnailId());
222                    clone.setFullImageId(getFullImageId());
223                    clone.setPriority(getPriority());
224    
225                    return clone;
226            }
227    
228            public int compareTo(SCProductScreenshot scProductScreenshot) {
229                    int value = 0;
230    
231                    if (getProductEntryId() < scProductScreenshot.getProductEntryId()) {
232                            value = -1;
233                    }
234                    else if (getProductEntryId() > scProductScreenshot.getProductEntryId()) {
235                            value = 1;
236                    }
237                    else {
238                            value = 0;
239                    }
240    
241                    if (value != 0) {
242                            return value;
243                    }
244    
245                    if (getPriority() < scProductScreenshot.getPriority()) {
246                            value = -1;
247                    }
248                    else if (getPriority() > scProductScreenshot.getPriority()) {
249                            value = 1;
250                    }
251                    else {
252                            value = 0;
253                    }
254    
255                    if (value != 0) {
256                            return value;
257                    }
258    
259                    return 0;
260            }
261    
262            public boolean equals(Object obj) {
263                    if (obj == null) {
264                            return false;
265                    }
266    
267                    SCProductScreenshot scProductScreenshot = null;
268    
269                    try {
270                            scProductScreenshot = (SCProductScreenshot)obj;
271                    }
272                    catch (ClassCastException cce) {
273                            return false;
274                    }
275    
276                    long pk = scProductScreenshot.getPrimaryKey();
277    
278                    if (getPrimaryKey() == pk) {
279                            return true;
280                    }
281                    else {
282                            return false;
283                    }
284            }
285    
286            public int hashCode() {
287                    return (int)getPrimaryKey();
288            }
289    
290            public String toString() {
291                    StringBundler sb = new StringBundler(15);
292    
293                    sb.append("{productScreenshotId=");
294                    sb.append(getProductScreenshotId());
295                    sb.append(", companyId=");
296                    sb.append(getCompanyId());
297                    sb.append(", groupId=");
298                    sb.append(getGroupId());
299                    sb.append(", productEntryId=");
300                    sb.append(getProductEntryId());
301                    sb.append(", thumbnailId=");
302                    sb.append(getThumbnailId());
303                    sb.append(", fullImageId=");
304                    sb.append(getFullImageId());
305                    sb.append(", priority=");
306                    sb.append(getPriority());
307                    sb.append("}");
308    
309                    return sb.toString();
310            }
311    
312            public String toXmlString() {
313                    StringBundler sb = new StringBundler(25);
314    
315                    sb.append("<model><model-name>");
316                    sb.append(
317                            "com.liferay.portlet.softwarecatalog.model.SCProductScreenshot");
318                    sb.append("</model-name>");
319    
320                    sb.append(
321                            "<column><column-name>productScreenshotId</column-name><column-value><![CDATA[");
322                    sb.append(getProductScreenshotId());
323                    sb.append("]]></column-value></column>");
324                    sb.append(
325                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
326                    sb.append(getCompanyId());
327                    sb.append("]]></column-value></column>");
328                    sb.append(
329                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
330                    sb.append(getGroupId());
331                    sb.append("]]></column-value></column>");
332                    sb.append(
333                            "<column><column-name>productEntryId</column-name><column-value><![CDATA[");
334                    sb.append(getProductEntryId());
335                    sb.append("]]></column-value></column>");
336                    sb.append(
337                            "<column><column-name>thumbnailId</column-name><column-value><![CDATA[");
338                    sb.append(getThumbnailId());
339                    sb.append("]]></column-value></column>");
340                    sb.append(
341                            "<column><column-name>fullImageId</column-name><column-value><![CDATA[");
342                    sb.append(getFullImageId());
343                    sb.append("]]></column-value></column>");
344                    sb.append(
345                            "<column><column-name>priority</column-name><column-value><![CDATA[");
346                    sb.append(getPriority());
347                    sb.append("]]></column-value></column>");
348    
349                    sb.append("</model>");
350    
351                    return sb.toString();
352            }
353    
354            private long _productScreenshotId;
355            private long _companyId;
356            private long _groupId;
357            private long _productEntryId;
358            private long _originalProductEntryId;
359            private boolean _setOriginalProductEntryId;
360            private long _thumbnailId;
361            private long _originalThumbnailId;
362            private boolean _setOriginalThumbnailId;
363            private long _fullImageId;
364            private long _originalFullImageId;
365            private boolean _setOriginalFullImageId;
366            private int _priority;
367            private int _originalPriority;
368            private boolean _setOriginalPriority;
369            private transient ExpandoBridge _expandoBridge;
370    }