1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.softwarecatalog.model.impl;
16  
17  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
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             SCProductScreenshot model = new SCProductScreenshotImpl();
226 
227             model.setNew(isNew());
228             model.setEscapedModel(true);
229 
230             model.setProductScreenshotId(getProductScreenshotId());
231             model.setCompanyId(getCompanyId());
232             model.setGroupId(getGroupId());
233             model.setProductEntryId(getProductEntryId());
234             model.setThumbnailId(getThumbnailId());
235             model.setFullImageId(getFullImageId());
236             model.setPriority(getPriority());
237 
238             model = (SCProductScreenshot)Proxy.newProxyInstance(SCProductScreenshot.class.getClassLoader(),
239                     new Class[] { SCProductScreenshot.class },
240                     new ReadOnlyBeanHandler(model));
241 
242             return model;
243         }
244     }
245 
246     public ExpandoBridge getExpandoBridge() {
247         if (_expandoBridge == null) {
248             _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
249                     SCProductScreenshot.class.getName(), getPrimaryKey());
250         }
251 
252         return _expandoBridge;
253     }
254 
255     public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
256         getExpandoBridge().setAttributes(serviceContext);
257     }
258 
259     public Object clone() {
260         SCProductScreenshotImpl clone = new SCProductScreenshotImpl();
261 
262         clone.setProductScreenshotId(getProductScreenshotId());
263         clone.setCompanyId(getCompanyId());
264         clone.setGroupId(getGroupId());
265         clone.setProductEntryId(getProductEntryId());
266         clone.setThumbnailId(getThumbnailId());
267         clone.setFullImageId(getFullImageId());
268         clone.setPriority(getPriority());
269 
270         return clone;
271     }
272 
273     public int compareTo(SCProductScreenshot scProductScreenshot) {
274         int value = 0;
275 
276         if (getProductEntryId() < scProductScreenshot.getProductEntryId()) {
277             value = -1;
278         }
279         else if (getProductEntryId() > scProductScreenshot.getProductEntryId()) {
280             value = 1;
281         }
282         else {
283             value = 0;
284         }
285 
286         if (value != 0) {
287             return value;
288         }
289 
290         if (getPriority() < scProductScreenshot.getPriority()) {
291             value = -1;
292         }
293         else if (getPriority() > scProductScreenshot.getPriority()) {
294             value = 1;
295         }
296         else {
297             value = 0;
298         }
299 
300         if (value != 0) {
301             return value;
302         }
303 
304         return 0;
305     }
306 
307     public boolean equals(Object obj) {
308         if (obj == null) {
309             return false;
310         }
311 
312         SCProductScreenshot scProductScreenshot = null;
313 
314         try {
315             scProductScreenshot = (SCProductScreenshot)obj;
316         }
317         catch (ClassCastException cce) {
318             return false;
319         }
320 
321         long pk = scProductScreenshot.getPrimaryKey();
322 
323         if (getPrimaryKey() == pk) {
324             return true;
325         }
326         else {
327             return false;
328         }
329     }
330 
331     public int hashCode() {
332         return (int)getPrimaryKey();
333     }
334 
335     public String toString() {
336         StringBundler sb = new StringBundler(15);
337 
338         sb.append("{productScreenshotId=");
339         sb.append(getProductScreenshotId());
340         sb.append(", companyId=");
341         sb.append(getCompanyId());
342         sb.append(", groupId=");
343         sb.append(getGroupId());
344         sb.append(", productEntryId=");
345         sb.append(getProductEntryId());
346         sb.append(", thumbnailId=");
347         sb.append(getThumbnailId());
348         sb.append(", fullImageId=");
349         sb.append(getFullImageId());
350         sb.append(", priority=");
351         sb.append(getPriority());
352         sb.append("}");
353 
354         return sb.toString();
355     }
356 
357     public String toXmlString() {
358         StringBundler sb = new StringBundler(25);
359 
360         sb.append("<model><model-name>");
361         sb.append(
362             "com.liferay.portlet.softwarecatalog.model.SCProductScreenshot");
363         sb.append("</model-name>");
364 
365         sb.append(
366             "<column><column-name>productScreenshotId</column-name><column-value><![CDATA[");
367         sb.append(getProductScreenshotId());
368         sb.append("]]></column-value></column>");
369         sb.append(
370             "<column><column-name>companyId</column-name><column-value><![CDATA[");
371         sb.append(getCompanyId());
372         sb.append("]]></column-value></column>");
373         sb.append(
374             "<column><column-name>groupId</column-name><column-value><![CDATA[");
375         sb.append(getGroupId());
376         sb.append("]]></column-value></column>");
377         sb.append(
378             "<column><column-name>productEntryId</column-name><column-value><![CDATA[");
379         sb.append(getProductEntryId());
380         sb.append("]]></column-value></column>");
381         sb.append(
382             "<column><column-name>thumbnailId</column-name><column-value><![CDATA[");
383         sb.append(getThumbnailId());
384         sb.append("]]></column-value></column>");
385         sb.append(
386             "<column><column-name>fullImageId</column-name><column-value><![CDATA[");
387         sb.append(getFullImageId());
388         sb.append("]]></column-value></column>");
389         sb.append(
390             "<column><column-name>priority</column-name><column-value><![CDATA[");
391         sb.append(getPriority());
392         sb.append("]]></column-value></column>");
393 
394         sb.append("</model>");
395 
396         return sb.toString();
397     }
398 
399     private long _productScreenshotId;
400     private long _companyId;
401     private long _groupId;
402     private long _productEntryId;
403     private long _originalProductEntryId;
404     private boolean _setOriginalProductEntryId;
405     private long _thumbnailId;
406     private long _originalThumbnailId;
407     private boolean _setOriginalThumbnailId;
408     private long _fullImageId;
409     private long _originalFullImageId;
410     private boolean _setOriginalFullImageId;
411     private int _priority;
412     private int _originalPriority;
413     private boolean _setOriginalPriority;
414     private transient ExpandoBridge _expandoBridge;
415 }