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