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