1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portlet.softwarecatalog.model.impl;
16  
17  import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
18  import com.liferay.portal.kernel.util.GetterUtil;
19  import com.liferay.portal.kernel.util.StringBundler;
20  import com.liferay.portal.model.impl.BaseModelImpl;
21  import com.liferay.portal.service.ServiceContext;
22  
23  import com.liferay.portlet.expando.model.ExpandoBridge;
24  import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
25  import com.liferay.portlet.softwarecatalog.model.SCProductScreenshot;
26  import com.liferay.portlet.softwarecatalog.model.SCProductScreenshotSoap;
27  
28  import java.io.Serializable;
29  
30  import java.lang.reflect.Proxy;
31  
32  import java.sql.Types;
33  
34  import java.util.ArrayList;
35  import java.util.List;
36  
37  /**
38   * <a href="SCProductScreenshotModelImpl.java.html"><b><i>View Source</i></b></a>
39   *
40   * <p>
41   * ServiceBuilder generated this class. Modifications in this class will be
42   * overwritten the next time is generated.
43   * </p>
44   *
45   * <p>
46   * This interface is a model that represents the SCProductScreenshot table in the
47   * database.
48   * </p>
49   *
50   * @author    Brian Wing Shun Chan
51   * @see       SCProductScreenshotImpl
52   * @see       com.liferay.portlet.softwarecatalog.model.SCProductScreenshot
53   * @see       com.liferay.portlet.softwarecatalog.model.SCProductScreenshotModel
54   * @generated
55   */
56  public class SCProductScreenshotModelImpl extends BaseModelImpl<SCProductScreenshot> {
57      public static final String TABLE_NAME = "SCProductScreenshot";
58      public static final Object[][] TABLE_COLUMNS = {
59              { "productScreenshotId", new Integer(Types.BIGINT) },
60              { "companyId", new Integer(Types.BIGINT) },
61              { "groupId", new Integer(Types.BIGINT) },
62              { "productEntryId", new Integer(Types.BIGINT) },
63              { "thumbnailId", new Integer(Types.BIGINT) },
64              { "fullImageId", new Integer(Types.BIGINT) },
65              { "priority", new Integer(Types.INTEGER) }
66          };
67      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)";
68      public static final String TABLE_SQL_DROP = "drop table SCProductScreenshot";
69      public static final String ORDER_BY_JPQL = " ORDER BY scProductScreenshot.productEntryId ASC, scProductScreenshot.priority ASC";
70      public static final String ORDER_BY_SQL = " ORDER BY SCProductScreenshot.productEntryId ASC, SCProductScreenshot.priority ASC";
71      public static final String DATA_SOURCE = "liferayDataSource";
72      public static final String SESSION_FACTORY = "liferaySessionFactory";
73      public static final String TX_MANAGER = "liferayTransactionManager";
74      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
75                  "value.object.entity.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"),
76              true);
77      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
78                  "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"),
79              true);
80  
81      public static SCProductScreenshot toModel(SCProductScreenshotSoap soapModel) {
82          SCProductScreenshot model = new SCProductScreenshotImpl();
83  
84          model.setProductScreenshotId(soapModel.getProductScreenshotId());
85          model.setCompanyId(soapModel.getCompanyId());
86          model.setGroupId(soapModel.getGroupId());
87          model.setProductEntryId(soapModel.getProductEntryId());
88          model.setThumbnailId(soapModel.getThumbnailId());
89          model.setFullImageId(soapModel.getFullImageId());
90          model.setPriority(soapModel.getPriority());
91  
92          return model;
93      }
94  
95      public static List<SCProductScreenshot> toModels(
96          SCProductScreenshotSoap[] soapModels) {
97          List<SCProductScreenshot> models = new ArrayList<SCProductScreenshot>(soapModels.length);
98  
99          for (SCProductScreenshotSoap soapModel : soapModels) {
100             models.add(toModel(soapModel));
101         }
102 
103         return models;
104     }
105 
106     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
107                 "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"));
108 
109     public SCProductScreenshotModelImpl() {
110     }
111 
112     public long getPrimaryKey() {
113         return _productScreenshotId;
114     }
115 
116     public void setPrimaryKey(long pk) {
117         setProductScreenshotId(pk);
118     }
119 
120     public Serializable getPrimaryKeyObj() {
121         return new Long(_productScreenshotId);
122     }
123 
124     public long getProductScreenshotId() {
125         return _productScreenshotId;
126     }
127 
128     public void setProductScreenshotId(long productScreenshotId) {
129         _productScreenshotId = productScreenshotId;
130     }
131 
132     public long getCompanyId() {
133         return _companyId;
134     }
135 
136     public void setCompanyId(long companyId) {
137         _companyId = companyId;
138     }
139 
140     public long getGroupId() {
141         return _groupId;
142     }
143 
144     public void setGroupId(long groupId) {
145         _groupId = groupId;
146     }
147 
148     public long getProductEntryId() {
149         return _productEntryId;
150     }
151 
152     public void setProductEntryId(long productEntryId) {
153         _productEntryId = productEntryId;
154 
155         if (!_setOriginalProductEntryId) {
156             _setOriginalProductEntryId = true;
157 
158             _originalProductEntryId = productEntryId;
159         }
160     }
161 
162     public long getOriginalProductEntryId() {
163         return _originalProductEntryId;
164     }
165 
166     public long getThumbnailId() {
167         return _thumbnailId;
168     }
169 
170     public void setThumbnailId(long thumbnailId) {
171         _thumbnailId = thumbnailId;
172 
173         if (!_setOriginalThumbnailId) {
174             _setOriginalThumbnailId = true;
175 
176             _originalThumbnailId = thumbnailId;
177         }
178     }
179 
180     public long getOriginalThumbnailId() {
181         return _originalThumbnailId;
182     }
183 
184     public long getFullImageId() {
185         return _fullImageId;
186     }
187 
188     public void setFullImageId(long fullImageId) {
189         _fullImageId = fullImageId;
190 
191         if (!_setOriginalFullImageId) {
192             _setOriginalFullImageId = true;
193 
194             _originalFullImageId = fullImageId;
195         }
196     }
197 
198     public long getOriginalFullImageId() {
199         return _originalFullImageId;
200     }
201 
202     public int getPriority() {
203         return _priority;
204     }
205 
206     public void setPriority(int priority) {
207         _priority = priority;
208 
209         if (!_setOriginalPriority) {
210             _setOriginalPriority = true;
211 
212             _originalPriority = priority;
213         }
214     }
215 
216     public int getOriginalPriority() {
217         return _originalPriority;
218     }
219 
220     public SCProductScreenshot toEscapedModel() {
221         if (isEscapedModel()) {
222             return (SCProductScreenshot)this;
223         }
224         else {
225             return (SCProductScreenshot)Proxy.newProxyInstance(SCProductScreenshot.class.getClassLoader(),
226                 new Class[] { SCProductScreenshot.class },
227                 new AutoEscapeBeanHandler(this));
228         }
229     }
230 
231     public ExpandoBridge getExpandoBridge() {
232         if (_expandoBridge == null) {
233             _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(SCProductScreenshot.class.getName(),
234                     getPrimaryKey());
235         }
236 
237         return _expandoBridge;
238     }
239 
240     public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
241         getExpandoBridge().setAttributes(serviceContext);
242     }
243 
244     public Object clone() {
245         SCProductScreenshotImpl clone = new SCProductScreenshotImpl();
246 
247         clone.setProductScreenshotId(getProductScreenshotId());
248         clone.setCompanyId(getCompanyId());
249         clone.setGroupId(getGroupId());
250         clone.setProductEntryId(getProductEntryId());
251         clone.setThumbnailId(getThumbnailId());
252         clone.setFullImageId(getFullImageId());
253         clone.setPriority(getPriority());
254 
255         return clone;
256     }
257 
258     public int compareTo(SCProductScreenshot scProductScreenshot) {
259         int value = 0;
260 
261         if (getProductEntryId() < scProductScreenshot.getProductEntryId()) {
262             value = -1;
263         }
264         else if (getProductEntryId() > scProductScreenshot.getProductEntryId()) {
265             value = 1;
266         }
267         else {
268             value = 0;
269         }
270 
271         if (value != 0) {
272             return value;
273         }
274 
275         if (getPriority() < scProductScreenshot.getPriority()) {
276             value = -1;
277         }
278         else if (getPriority() > scProductScreenshot.getPriority()) {
279             value = 1;
280         }
281         else {
282             value = 0;
283         }
284 
285         if (value != 0) {
286             return value;
287         }
288 
289         return 0;
290     }
291 
292     public boolean equals(Object obj) {
293         if (obj == null) {
294             return false;
295         }
296 
297         SCProductScreenshot scProductScreenshot = null;
298 
299         try {
300             scProductScreenshot = (SCProductScreenshot)obj;
301         }
302         catch (ClassCastException cce) {
303             return false;
304         }
305 
306         long pk = scProductScreenshot.getPrimaryKey();
307 
308         if (getPrimaryKey() == pk) {
309             return true;
310         }
311         else {
312             return false;
313         }
314     }
315 
316     public int hashCode() {
317         return (int)getPrimaryKey();
318     }
319 
320     public String toString() {
321         StringBundler sb = new StringBundler(15);
322 
323         sb.append("{productScreenshotId=");
324         sb.append(getProductScreenshotId());
325         sb.append(", companyId=");
326         sb.append(getCompanyId());
327         sb.append(", groupId=");
328         sb.append(getGroupId());
329         sb.append(", productEntryId=");
330         sb.append(getProductEntryId());
331         sb.append(", thumbnailId=");
332         sb.append(getThumbnailId());
333         sb.append(", fullImageId=");
334         sb.append(getFullImageId());
335         sb.append(", priority=");
336         sb.append(getPriority());
337         sb.append("}");
338 
339         return sb.toString();
340     }
341 
342     public String toXmlString() {
343         StringBundler sb = new StringBundler(25);
344 
345         sb.append("<model><model-name>");
346         sb.append(
347             "com.liferay.portlet.softwarecatalog.model.SCProductScreenshot");
348         sb.append("</model-name>");
349 
350         sb.append(
351             "<column><column-name>productScreenshotId</column-name><column-value><![CDATA[");
352         sb.append(getProductScreenshotId());
353         sb.append("]]></column-value></column>");
354         sb.append(
355             "<column><column-name>companyId</column-name><column-value><![CDATA[");
356         sb.append(getCompanyId());
357         sb.append("]]></column-value></column>");
358         sb.append(
359             "<column><column-name>groupId</column-name><column-value><![CDATA[");
360         sb.append(getGroupId());
361         sb.append("]]></column-value></column>");
362         sb.append(
363             "<column><column-name>productEntryId</column-name><column-value><![CDATA[");
364         sb.append(getProductEntryId());
365         sb.append("]]></column-value></column>");
366         sb.append(
367             "<column><column-name>thumbnailId</column-name><column-value><![CDATA[");
368         sb.append(getThumbnailId());
369         sb.append("]]></column-value></column>");
370         sb.append(
371             "<column><column-name>fullImageId</column-name><column-value><![CDATA[");
372         sb.append(getFullImageId());
373         sb.append("]]></column-value></column>");
374         sb.append(
375             "<column><column-name>priority</column-name><column-value><![CDATA[");
376         sb.append(getPriority());
377         sb.append("]]></column-value></column>");
378 
379         sb.append("</model>");
380 
381         return sb.toString();
382     }
383 
384     private long _productScreenshotId;
385     private long _companyId;
386     private long _groupId;
387     private long _productEntryId;
388     private long _originalProductEntryId;
389     private boolean _setOriginalProductEntryId;
390     private long _thumbnailId;
391     private long _originalThumbnailId;
392     private boolean _setOriginalThumbnailId;
393     private long _fullImageId;
394     private long _originalFullImageId;
395     private boolean _setOriginalFullImageId;
396     private int _priority;
397     private int _originalPriority;
398     private boolean _setOriginalPriority;
399     private transient ExpandoBridge _expandoBridge;
400 }