1   /**
2    * Copyright (c) 2000-2008 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  import com.liferay.portal.util.PropsUtil;
29  
30  import com.liferay.portlet.softwarecatalog.model.SCProductScreenshot;
31  import com.liferay.portlet.softwarecatalog.model.SCProductScreenshotSoap;
32  
33  import java.io.Serializable;
34  
35  import java.lang.reflect.Proxy;
36  
37  import java.sql.Types;
38  
39  import java.util.ArrayList;
40  import java.util.List;
41  
42  /**
43   * <a href="SCProductScreenshotModelImpl.java.html"><b><i>View Source</i></b></a>
44   *
45   * <p>
46   * ServiceBuilder generated this class. Modifications in this class will be
47   * overwritten the next time is generated.
48   * </p>
49   *
50   * <p>
51   * This class is a model that represents the <code>SCProductScreenshot</code> table
52   * in the database.
53   * </p>
54   *
55   * @author Brian Wing Shun Chan
56   *
57   * @see com.liferay.portlet.softwarecatalog.service.model.SCProductScreenshot
58   * @see com.liferay.portlet.softwarecatalog.service.model.SCProductScreenshotModel
59   * @see com.liferay.portlet.softwarecatalog.service.model.impl.SCProductScreenshotImpl
60   *
61   */
62  public class SCProductScreenshotModelImpl extends BaseModelImpl {
63      public static final String TABLE_NAME = "SCProductScreenshot";
64      public static final Object[][] TABLE_COLUMNS = {
65              { "productScreenshotId", new Integer(Types.BIGINT) },
66              
67  
68              { "companyId", new Integer(Types.BIGINT) },
69              
70  
71              { "groupId", new Integer(Types.BIGINT) },
72              
73  
74              { "productEntryId", new Integer(Types.BIGINT) },
75              
76  
77              { "thumbnailId", new Integer(Types.BIGINT) },
78              
79  
80              { "fullImageId", new Integer(Types.BIGINT) },
81              
82  
83              { "priority", new Integer(Types.INTEGER) }
84          };
85      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)";
86      public static final String TABLE_SQL_DROP = "drop table SCProductScreenshot";
87      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
88                  "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"),
89              true);
90  
91      public static SCProductScreenshot toModel(SCProductScreenshotSoap soapModel) {
92          SCProductScreenshot model = new SCProductScreenshotImpl();
93  
94          model.setProductScreenshotId(soapModel.getProductScreenshotId());
95          model.setCompanyId(soapModel.getCompanyId());
96          model.setGroupId(soapModel.getGroupId());
97          model.setProductEntryId(soapModel.getProductEntryId());
98          model.setThumbnailId(soapModel.getThumbnailId());
99          model.setFullImageId(soapModel.getFullImageId());
100         model.setPriority(soapModel.getPriority());
101 
102         return model;
103     }
104 
105     public static List<SCProductScreenshot> toModels(
106         SCProductScreenshotSoap[] soapModels) {
107         List<SCProductScreenshot> models = new ArrayList<SCProductScreenshot>(soapModels.length);
108 
109         for (SCProductScreenshotSoap soapModel : soapModels) {
110             models.add(toModel(soapModel));
111         }
112 
113         return models;
114     }
115 
116     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
117                 "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"));
118 
119     public SCProductScreenshotModelImpl() {
120     }
121 
122     public long getPrimaryKey() {
123         return _productScreenshotId;
124     }
125 
126     public void setPrimaryKey(long pk) {
127         setProductScreenshotId(pk);
128     }
129 
130     public Serializable getPrimaryKeyObj() {
131         return new Long(_productScreenshotId);
132     }
133 
134     public long getProductScreenshotId() {
135         return _productScreenshotId;
136     }
137 
138     public void setProductScreenshotId(long productScreenshotId) {
139         if (productScreenshotId != _productScreenshotId) {
140             _productScreenshotId = productScreenshotId;
141         }
142     }
143 
144     public long getCompanyId() {
145         return _companyId;
146     }
147 
148     public void setCompanyId(long companyId) {
149         if (companyId != _companyId) {
150             _companyId = companyId;
151         }
152     }
153 
154     public long getGroupId() {
155         return _groupId;
156     }
157 
158     public void setGroupId(long groupId) {
159         if (groupId != _groupId) {
160             _groupId = groupId;
161         }
162     }
163 
164     public long getProductEntryId() {
165         return _productEntryId;
166     }
167 
168     public void setProductEntryId(long productEntryId) {
169         if (productEntryId != _productEntryId) {
170             _productEntryId = productEntryId;
171         }
172     }
173 
174     public long getThumbnailId() {
175         return _thumbnailId;
176     }
177 
178     public void setThumbnailId(long thumbnailId) {
179         if (thumbnailId != _thumbnailId) {
180             _thumbnailId = thumbnailId;
181         }
182     }
183 
184     public long getFullImageId() {
185         return _fullImageId;
186     }
187 
188     public void setFullImageId(long fullImageId) {
189         if (fullImageId != _fullImageId) {
190             _fullImageId = fullImageId;
191         }
192     }
193 
194     public int getPriority() {
195         return _priority;
196     }
197 
198     public void setPriority(int priority) {
199         if (priority != _priority) {
200             _priority = priority;
201         }
202     }
203 
204     public SCProductScreenshot toEscapedModel() {
205         if (isEscapedModel()) {
206             return (SCProductScreenshot)this;
207         }
208         else {
209             SCProductScreenshot model = new SCProductScreenshotImpl();
210 
211             model.setEscapedModel(true);
212 
213             model.setProductScreenshotId(getProductScreenshotId());
214             model.setCompanyId(getCompanyId());
215             model.setGroupId(getGroupId());
216             model.setProductEntryId(getProductEntryId());
217             model.setThumbnailId(getThumbnailId());
218             model.setFullImageId(getFullImageId());
219             model.setPriority(getPriority());
220 
221             model = (SCProductScreenshot)Proxy.newProxyInstance(SCProductScreenshot.class.getClassLoader(),
222                     new Class[] { SCProductScreenshot.class },
223                     new ReadOnlyBeanHandler(model));
224 
225             return model;
226         }
227     }
228 
229     public Object clone() {
230         SCProductScreenshotImpl clone = new SCProductScreenshotImpl();
231 
232         clone.setProductScreenshotId(getProductScreenshotId());
233         clone.setCompanyId(getCompanyId());
234         clone.setGroupId(getGroupId());
235         clone.setProductEntryId(getProductEntryId());
236         clone.setThumbnailId(getThumbnailId());
237         clone.setFullImageId(getFullImageId());
238         clone.setPriority(getPriority());
239 
240         return clone;
241     }
242 
243     public int compareTo(Object obj) {
244         if (obj == null) {
245             return -1;
246         }
247 
248         SCProductScreenshotImpl scProductScreenshot = (SCProductScreenshotImpl)obj;
249 
250         int value = 0;
251 
252         if (getProductEntryId() < scProductScreenshot.getProductEntryId()) {
253             value = -1;
254         }
255         else if (getProductEntryId() > scProductScreenshot.getProductEntryId()) {
256             value = 1;
257         }
258         else {
259             value = 0;
260         }
261 
262         if (value != 0) {
263             return value;
264         }
265 
266         if (getPriority() < scProductScreenshot.getPriority()) {
267             value = -1;
268         }
269         else if (getPriority() > scProductScreenshot.getPriority()) {
270             value = 1;
271         }
272         else {
273             value = 0;
274         }
275 
276         if (value != 0) {
277             return value;
278         }
279 
280         return 0;
281     }
282 
283     public boolean equals(Object obj) {
284         if (obj == null) {
285             return false;
286         }
287 
288         SCProductScreenshotImpl scProductScreenshot = null;
289 
290         try {
291             scProductScreenshot = (SCProductScreenshotImpl)obj;
292         }
293         catch (ClassCastException cce) {
294             return false;
295         }
296 
297         long pk = scProductScreenshot.getPrimaryKey();
298 
299         if (getPrimaryKey() == pk) {
300             return true;
301         }
302         else {
303             return false;
304         }
305     }
306 
307     public int hashCode() {
308         return (int)getPrimaryKey();
309     }
310 
311     private long _productScreenshotId;
312     private long _companyId;
313     private long _groupId;
314     private long _productEntryId;
315     private long _thumbnailId;
316     private long _fullImageId;
317     private int _priority;
318 }