1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.softwarecatalog.model.impl;
24  
25  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26  import com.liferay.portal.kernel.util.GetterUtil;
27  import com.liferay.portal.model.impl.BaseModelImpl;
28  
29  import com.liferay.portlet.softwarecatalog.model.SCProductScreenshot;
30  import com.liferay.portlet.softwarecatalog.model.SCProductScreenshotSoap;
31  
32  import java.io.Serializable;
33  
34  import java.lang.reflect.Proxy;
35  
36  import java.sql.Types;
37  
38  import java.util.ArrayList;
39  import java.util.List;
40  
41  /**
42   * <a href="SCProductScreenshotModelImpl.java.html"><b><i>View Source</i></b></a>
43   *
44   * <p>
45   * ServiceBuilder generated this class. Modifications in this class will be
46   * overwritten the next time is generated.
47   * </p>
48   *
49   * <p>
50   * This class is a model that represents the <code>SCProductScreenshot</code> table
51   * in the database.
52   * </p>
53   *
54   * @author Brian Wing Shun Chan
55   *
56   * @see com.liferay.portlet.softwarecatalog.model.SCProductScreenshot
57   * @see com.liferay.portlet.softwarecatalog.model.SCProductScreenshotModel
58   * @see com.liferay.portlet.softwarecatalog.model.impl.SCProductScreenshotImpl
59   *
60   */
61  public class SCProductScreenshotModelImpl extends BaseModelImpl<SCProductScreenshot> {
62      public static final String TABLE_NAME = "SCProductScreenshot";
63      public static final Object[][] TABLE_COLUMNS = {
64              { "productScreenshotId", new Integer(Types.BIGINT) },
65              
66  
67              { "companyId", new Integer(Types.BIGINT) },
68              
69  
70              { "groupId", new Integer(Types.BIGINT) },
71              
72  
73              { "productEntryId", new Integer(Types.BIGINT) },
74              
75  
76              { "thumbnailId", new Integer(Types.BIGINT) },
77              
78  
79              { "fullImageId", new Integer(Types.BIGINT) },
80              
81  
82              { "priority", new Integer(Types.INTEGER) }
83          };
84      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)";
85      public static final String TABLE_SQL_DROP = "drop table SCProductScreenshot";
86      public static final String DATA_SOURCE = "liferayDataSource";
87      public static final String SESSION_FACTORY = "liferaySessionFactory";
88      public static final String TX_MANAGER = "liferayTransactionManager";
89      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
90                  "value.object.entity.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"),
91              true);
92      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
93                  "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"),
94              true);
95  
96      public static SCProductScreenshot toModel(SCProductScreenshotSoap soapModel) {
97          SCProductScreenshot model = new SCProductScreenshotImpl();
98  
99          model.setProductScreenshotId(soapModel.getProductScreenshotId());
100         model.setCompanyId(soapModel.getCompanyId());
101         model.setGroupId(soapModel.getGroupId());
102         model.setProductEntryId(soapModel.getProductEntryId());
103         model.setThumbnailId(soapModel.getThumbnailId());
104         model.setFullImageId(soapModel.getFullImageId());
105         model.setPriority(soapModel.getPriority());
106 
107         return model;
108     }
109 
110     public static List<SCProductScreenshot> toModels(
111         SCProductScreenshotSoap[] soapModels) {
112         List<SCProductScreenshot> models = new ArrayList<SCProductScreenshot>(soapModels.length);
113 
114         for (SCProductScreenshotSoap soapModel : soapModels) {
115             models.add(toModel(soapModel));
116         }
117 
118         return models;
119     }
120 
121     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
122                 "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"));
123 
124     public SCProductScreenshotModelImpl() {
125     }
126 
127     public long getPrimaryKey() {
128         return _productScreenshotId;
129     }
130 
131     public void setPrimaryKey(long pk) {
132         setProductScreenshotId(pk);
133     }
134 
135     public Serializable getPrimaryKeyObj() {
136         return new Long(_productScreenshotId);
137     }
138 
139     public long getProductScreenshotId() {
140         return _productScreenshotId;
141     }
142 
143     public void setProductScreenshotId(long productScreenshotId) {
144         _productScreenshotId = productScreenshotId;
145     }
146 
147     public long getCompanyId() {
148         return _companyId;
149     }
150 
151     public void setCompanyId(long companyId) {
152         _companyId = companyId;
153     }
154 
155     public long getGroupId() {
156         return _groupId;
157     }
158 
159     public void setGroupId(long groupId) {
160         _groupId = groupId;
161     }
162 
163     public long getProductEntryId() {
164         return _productEntryId;
165     }
166 
167     public void setProductEntryId(long productEntryId) {
168         _productEntryId = productEntryId;
169 
170         if (!_setOriginalProductEntryId) {
171             _setOriginalProductEntryId = true;
172 
173             _originalProductEntryId = productEntryId;
174         }
175     }
176 
177     public long getOriginalProductEntryId() {
178         return _originalProductEntryId;
179     }
180 
181     public long getThumbnailId() {
182         return _thumbnailId;
183     }
184 
185     public void setThumbnailId(long thumbnailId) {
186         _thumbnailId = thumbnailId;
187 
188         if (!_setOriginalThumbnailId) {
189             _setOriginalThumbnailId = true;
190 
191             _originalThumbnailId = thumbnailId;
192         }
193     }
194 
195     public long getOriginalThumbnailId() {
196         return _originalThumbnailId;
197     }
198 
199     public long getFullImageId() {
200         return _fullImageId;
201     }
202 
203     public void setFullImageId(long fullImageId) {
204         _fullImageId = fullImageId;
205 
206         if (!_setOriginalFullImageId) {
207             _setOriginalFullImageId = true;
208 
209             _originalFullImageId = fullImageId;
210         }
211     }
212 
213     public long getOriginalFullImageId() {
214         return _originalFullImageId;
215     }
216 
217     public int getPriority() {
218         return _priority;
219     }
220 
221     public void setPriority(int priority) {
222         _priority = priority;
223 
224         if (!_setOriginalPriority) {
225             _setOriginalPriority = true;
226 
227             _originalPriority = priority;
228         }
229     }
230 
231     public int getOriginalPriority() {
232         return _originalPriority;
233     }
234 
235     public SCProductScreenshot toEscapedModel() {
236         if (isEscapedModel()) {
237             return (SCProductScreenshot)this;
238         }
239         else {
240             SCProductScreenshot model = new SCProductScreenshotImpl();
241 
242             model.setNew(isNew());
243             model.setEscapedModel(true);
244 
245             model.setProductScreenshotId(getProductScreenshotId());
246             model.setCompanyId(getCompanyId());
247             model.setGroupId(getGroupId());
248             model.setProductEntryId(getProductEntryId());
249             model.setThumbnailId(getThumbnailId());
250             model.setFullImageId(getFullImageId());
251             model.setPriority(getPriority());
252 
253             model = (SCProductScreenshot)Proxy.newProxyInstance(SCProductScreenshot.class.getClassLoader(),
254                     new Class[] { SCProductScreenshot.class },
255                     new ReadOnlyBeanHandler(model));
256 
257             return model;
258         }
259     }
260 
261     public Object clone() {
262         SCProductScreenshotImpl clone = new SCProductScreenshotImpl();
263 
264         clone.setProductScreenshotId(getProductScreenshotId());
265         clone.setCompanyId(getCompanyId());
266         clone.setGroupId(getGroupId());
267         clone.setProductEntryId(getProductEntryId());
268         clone.setThumbnailId(getThumbnailId());
269         clone.setFullImageId(getFullImageId());
270         clone.setPriority(getPriority());
271 
272         return clone;
273     }
274 
275     public int compareTo(SCProductScreenshot scProductScreenshot) {
276         int value = 0;
277 
278         if (getProductEntryId() < scProductScreenshot.getProductEntryId()) {
279             value = -1;
280         }
281         else if (getProductEntryId() > scProductScreenshot.getProductEntryId()) {
282             value = 1;
283         }
284         else {
285             value = 0;
286         }
287 
288         if (value != 0) {
289             return value;
290         }
291 
292         if (getPriority() < scProductScreenshot.getPriority()) {
293             value = -1;
294         }
295         else if (getPriority() > scProductScreenshot.getPriority()) {
296             value = 1;
297         }
298         else {
299             value = 0;
300         }
301 
302         if (value != 0) {
303             return value;
304         }
305 
306         return 0;
307     }
308 
309     public boolean equals(Object obj) {
310         if (obj == null) {
311             return false;
312         }
313 
314         SCProductScreenshot scProductScreenshot = null;
315 
316         try {
317             scProductScreenshot = (SCProductScreenshot)obj;
318         }
319         catch (ClassCastException cce) {
320             return false;
321         }
322 
323         long pk = scProductScreenshot.getPrimaryKey();
324 
325         if (getPrimaryKey() == pk) {
326             return true;
327         }
328         else {
329             return false;
330         }
331     }
332 
333     public int hashCode() {
334         return (int)getPrimaryKey();
335     }
336 
337     public String toString() {
338         StringBuilder sb = new StringBuilder();
339 
340         sb.append("{productScreenshotId=");
341         sb.append(getProductScreenshotId());
342         sb.append(", companyId=");
343         sb.append(getCompanyId());
344         sb.append(", groupId=");
345         sb.append(getGroupId());
346         sb.append(", productEntryId=");
347         sb.append(getProductEntryId());
348         sb.append(", thumbnailId=");
349         sb.append(getThumbnailId());
350         sb.append(", fullImageId=");
351         sb.append(getFullImageId());
352         sb.append(", priority=");
353         sb.append(getPriority());
354         sb.append("}");
355 
356         return sb.toString();
357     }
358 
359     public String toXmlString() {
360         StringBuilder sb = new StringBuilder();
361 
362         sb.append("<model><model-name>");
363         sb.append(
364             "com.liferay.portlet.softwarecatalog.model.SCProductScreenshot");
365         sb.append("</model-name>");
366 
367         sb.append(
368             "<column><column-name>productScreenshotId</column-name><column-value><![CDATA[");
369         sb.append(getProductScreenshotId());
370         sb.append("]]></column-value></column>");
371         sb.append(
372             "<column><column-name>companyId</column-name><column-value><![CDATA[");
373         sb.append(getCompanyId());
374         sb.append("]]></column-value></column>");
375         sb.append(
376             "<column><column-name>groupId</column-name><column-value><![CDATA[");
377         sb.append(getGroupId());
378         sb.append("]]></column-value></column>");
379         sb.append(
380             "<column><column-name>productEntryId</column-name><column-value><![CDATA[");
381         sb.append(getProductEntryId());
382         sb.append("]]></column-value></column>");
383         sb.append(
384             "<column><column-name>thumbnailId</column-name><column-value><![CDATA[");
385         sb.append(getThumbnailId());
386         sb.append("]]></column-value></column>");
387         sb.append(
388             "<column><column-name>fullImageId</column-name><column-value><![CDATA[");
389         sb.append(getFullImageId());
390         sb.append("]]></column-value></column>");
391         sb.append(
392             "<column><column-name>priority</column-name><column-value><![CDATA[");
393         sb.append(getPriority());
394         sb.append("]]></column-value></column>");
395 
396         sb.append("</model>");
397 
398         return sb.toString();
399     }
400 
401     private long _productScreenshotId;
402     private long _companyId;
403     private long _groupId;
404     private long _productEntryId;
405     private long _originalProductEntryId;
406     private boolean _setOriginalProductEntryId;
407     private long _thumbnailId;
408     private long _originalThumbnailId;
409     private boolean _setOriginalThumbnailId;
410     private long _fullImageId;
411     private long _originalFullImageId;
412     private boolean _setOriginalFullImageId;
413     private int _priority;
414     private int _originalPriority;
415     private boolean _setOriginalPriority;
416 }