1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.softwarecatalog.model.impl;
21  
22  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23  import com.liferay.portal.kernel.util.GetterUtil;
24  import com.liferay.portal.model.impl.BaseModelImpl;
25  
26  import com.liferay.portlet.softwarecatalog.model.SCProductScreenshot;
27  import com.liferay.portlet.softwarecatalog.model.SCProductScreenshotSoap;
28  
29  import java.io.Serializable;
30  
31  import java.lang.reflect.Proxy;
32  
33  import java.sql.Types;
34  
35  import java.util.ArrayList;
36  import java.util.List;
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.model.SCProductScreenshot
54   * @see com.liferay.portlet.softwarecatalog.model.SCProductScreenshotModel
55   * @see com.liferay.portlet.softwarecatalog.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 String DATA_SOURCE = "liferayDataSource";
84      public static final String SESSION_FACTORY = "liferaySessionFactory";
85      public static final String TX_MANAGER = "liferayTransactionManager";
86      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
87                  "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"),
88              true);
89  
90      public static SCProductScreenshot toModel(SCProductScreenshotSoap soapModel) {
91          SCProductScreenshot model = new SCProductScreenshotImpl();
92  
93          model.setProductScreenshotId(soapModel.getProductScreenshotId());
94          model.setCompanyId(soapModel.getCompanyId());
95          model.setGroupId(soapModel.getGroupId());
96          model.setProductEntryId(soapModel.getProductEntryId());
97          model.setThumbnailId(soapModel.getThumbnailId());
98          model.setFullImageId(soapModel.getFullImageId());
99          model.setPriority(soapModel.getPriority());
100 
101         return model;
102     }
103 
104     public static List<SCProductScreenshot> toModels(
105         SCProductScreenshotSoap[] soapModels) {
106         List<SCProductScreenshot> models = new ArrayList<SCProductScreenshot>(soapModels.length);
107 
108         for (SCProductScreenshotSoap soapModel : soapModels) {
109             models.add(toModel(soapModel));
110         }
111 
112         return models;
113     }
114 
115     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
116                 "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"));
117 
118     public SCProductScreenshotModelImpl() {
119     }
120 
121     public long getPrimaryKey() {
122         return _productScreenshotId;
123     }
124 
125     public void setPrimaryKey(long pk) {
126         setProductScreenshotId(pk);
127     }
128 
129     public Serializable getPrimaryKeyObj() {
130         return new Long(_productScreenshotId);
131     }
132 
133     public long getProductScreenshotId() {
134         return _productScreenshotId;
135     }
136 
137     public void setProductScreenshotId(long productScreenshotId) {
138         if (productScreenshotId != _productScreenshotId) {
139             _productScreenshotId = productScreenshotId;
140         }
141     }
142 
143     public long getCompanyId() {
144         return _companyId;
145     }
146 
147     public void setCompanyId(long companyId) {
148         if (companyId != _companyId) {
149             _companyId = companyId;
150         }
151     }
152 
153     public long getGroupId() {
154         return _groupId;
155     }
156 
157     public void setGroupId(long groupId) {
158         if (groupId != _groupId) {
159             _groupId = groupId;
160         }
161     }
162 
163     public long getProductEntryId() {
164         return _productEntryId;
165     }
166 
167     public void setProductEntryId(long productEntryId) {
168         if (productEntryId != _productEntryId) {
169             _productEntryId = productEntryId;
170         }
171     }
172 
173     public long getThumbnailId() {
174         return _thumbnailId;
175     }
176 
177     public void setThumbnailId(long thumbnailId) {
178         if (thumbnailId != _thumbnailId) {
179             _thumbnailId = thumbnailId;
180         }
181     }
182 
183     public long getFullImageId() {
184         return _fullImageId;
185     }
186 
187     public void setFullImageId(long fullImageId) {
188         if (fullImageId != _fullImageId) {
189             _fullImageId = fullImageId;
190         }
191     }
192 
193     public int getPriority() {
194         return _priority;
195     }
196 
197     public void setPriority(int priority) {
198         if (priority != _priority) {
199             _priority = priority;
200         }
201     }
202 
203     public SCProductScreenshot toEscapedModel() {
204         if (isEscapedModel()) {
205             return (SCProductScreenshot)this;
206         }
207         else {
208             SCProductScreenshot model = new SCProductScreenshotImpl();
209 
210             model.setNew(isNew());
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 }