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