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