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 {
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 CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
92                  "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"),
93              true);
94  
95      public static SCProductScreenshot toModel(SCProductScreenshotSoap soapModel) {
96          SCProductScreenshot model = new SCProductScreenshotImpl();
97  
98          model.setProductScreenshotId(soapModel.getProductScreenshotId());
99          model.setCompanyId(soapModel.getCompanyId());
100         model.setGroupId(soapModel.getGroupId());
101         model.setProductEntryId(soapModel.getProductEntryId());
102         model.setThumbnailId(soapModel.getThumbnailId());
103         model.setFullImageId(soapModel.getFullImageId());
104         model.setPriority(soapModel.getPriority());
105 
106         return model;
107     }
108 
109     public static List<SCProductScreenshot> toModels(
110         SCProductScreenshotSoap[] soapModels) {
111         List<SCProductScreenshot> models = new ArrayList<SCProductScreenshot>(soapModels.length);
112 
113         for (SCProductScreenshotSoap soapModel : soapModels) {
114             models.add(toModel(soapModel));
115         }
116 
117         return models;
118     }
119 
120     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
121                 "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"));
122 
123     public SCProductScreenshotModelImpl() {
124     }
125 
126     public long getPrimaryKey() {
127         return _productScreenshotId;
128     }
129 
130     public void setPrimaryKey(long pk) {
131         setProductScreenshotId(pk);
132     }
133 
134     public Serializable getPrimaryKeyObj() {
135         return new Long(_productScreenshotId);
136     }
137 
138     public long getProductScreenshotId() {
139         return _productScreenshotId;
140     }
141 
142     public void setProductScreenshotId(long productScreenshotId) {
143         if (productScreenshotId != _productScreenshotId) {
144             _productScreenshotId = productScreenshotId;
145         }
146     }
147 
148     public long getCompanyId() {
149         return _companyId;
150     }
151 
152     public void setCompanyId(long companyId) {
153         if (companyId != _companyId) {
154             _companyId = companyId;
155         }
156     }
157 
158     public long getGroupId() {
159         return _groupId;
160     }
161 
162     public void setGroupId(long groupId) {
163         if (groupId != _groupId) {
164             _groupId = groupId;
165         }
166     }
167 
168     public long getProductEntryId() {
169         return _productEntryId;
170     }
171 
172     public void setProductEntryId(long productEntryId) {
173         if (productEntryId != _productEntryId) {
174             _productEntryId = productEntryId;
175         }
176     }
177 
178     public long getThumbnailId() {
179         return _thumbnailId;
180     }
181 
182     public void setThumbnailId(long thumbnailId) {
183         if (thumbnailId != _thumbnailId) {
184             _thumbnailId = thumbnailId;
185         }
186     }
187 
188     public long getFullImageId() {
189         return _fullImageId;
190     }
191 
192     public void setFullImageId(long fullImageId) {
193         if (fullImageId != _fullImageId) {
194             _fullImageId = fullImageId;
195         }
196     }
197 
198     public int getPriority() {
199         return _priority;
200     }
201 
202     public void setPriority(int priority) {
203         if (priority != _priority) {
204             _priority = priority;
205         }
206     }
207 
208     public SCProductScreenshot toEscapedModel() {
209         if (isEscapedModel()) {
210             return (SCProductScreenshot)this;
211         }
212         else {
213             SCProductScreenshot model = new SCProductScreenshotImpl();
214 
215             model.setNew(isNew());
216             model.setEscapedModel(true);
217 
218             model.setProductScreenshotId(getProductScreenshotId());
219             model.setCompanyId(getCompanyId());
220             model.setGroupId(getGroupId());
221             model.setProductEntryId(getProductEntryId());
222             model.setThumbnailId(getThumbnailId());
223             model.setFullImageId(getFullImageId());
224             model.setPriority(getPriority());
225 
226             model = (SCProductScreenshot)Proxy.newProxyInstance(SCProductScreenshot.class.getClassLoader(),
227                     new Class[] { SCProductScreenshot.class },
228                     new ReadOnlyBeanHandler(model));
229 
230             return model;
231         }
232     }
233 
234     public ExpandoBridge getExpandoBridge() {
235         if (_expandoBridge == null) {
236             _expandoBridge = new ExpandoBridgeImpl(SCProductScreenshot.class.getName(),
237                     getPrimaryKey());
238         }
239 
240         return _expandoBridge;
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(Object obj) {
258         if (obj == null) {
259             return -1;
260         }
261 
262         SCProductScreenshotImpl scProductScreenshot = (SCProductScreenshotImpl)obj;
263 
264         int value = 0;
265 
266         if (getProductEntryId() < scProductScreenshot.getProductEntryId()) {
267             value = -1;
268         }
269         else if (getProductEntryId() > scProductScreenshot.getProductEntryId()) {
270             value = 1;
271         }
272         else {
273             value = 0;
274         }
275 
276         if (value != 0) {
277             return value;
278         }
279 
280         if (getPriority() < scProductScreenshot.getPriority()) {
281             value = -1;
282         }
283         else if (getPriority() > scProductScreenshot.getPriority()) {
284             value = 1;
285         }
286         else {
287             value = 0;
288         }
289 
290         if (value != 0) {
291             return value;
292         }
293 
294         return 0;
295     }
296 
297     public boolean equals(Object obj) {
298         if (obj == null) {
299             return false;
300         }
301 
302         SCProductScreenshotImpl scProductScreenshot = null;
303 
304         try {
305             scProductScreenshot = (SCProductScreenshotImpl)obj;
306         }
307         catch (ClassCastException cce) {
308             return false;
309         }
310 
311         long pk = scProductScreenshot.getPrimaryKey();
312 
313         if (getPrimaryKey() == pk) {
314             return true;
315         }
316         else {
317             return false;
318         }
319     }
320 
321     public int hashCode() {
322         return (int)getPrimaryKey();
323     }
324 
325     private long _productScreenshotId;
326     private long _companyId;
327     private long _groupId;
328     private long _productEntryId;
329     private long _thumbnailId;
330     private long _fullImageId;
331     private int _priority;
332     private transient ExpandoBridge _expandoBridge;
333 }