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