1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights 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 interface is a model that represents the SCProductScreenshot table in the
51   * database.
52   * </p>
53   *
54   * @author    Brian Wing Shun Chan
55   * @see       SCProductScreenshotImpl
56   * @see       com.liferay.portlet.softwarecatalog.model.SCProductScreenshot
57   * @see       com.liferay.portlet.softwarecatalog.model.SCProductScreenshotModel
58   * @generated
59   */
60  public class SCProductScreenshotModelImpl extends BaseModelImpl<SCProductScreenshot> {
61      public static final String TABLE_NAME = "SCProductScreenshot";
62      public static final Object[][] TABLE_COLUMNS = {
63              { "productScreenshotId", new Integer(Types.BIGINT) },
64              { "companyId", new Integer(Types.BIGINT) },
65              { "groupId", new Integer(Types.BIGINT) },
66              { "productEntryId", new Integer(Types.BIGINT) },
67              { "thumbnailId", new Integer(Types.BIGINT) },
68              { "fullImageId", new Integer(Types.BIGINT) },
69              { "priority", new Integer(Types.INTEGER) }
70          };
71      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)";
72      public static final String TABLE_SQL_DROP = "drop table SCProductScreenshot";
73      public static final String DATA_SOURCE = "liferayDataSource";
74      public static final String SESSION_FACTORY = "liferaySessionFactory";
75      public static final String TX_MANAGER = "liferayTransactionManager";
76      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
77                  "value.object.entity.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"),
78              true);
79      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
80                  "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"),
81              true);
82  
83      public static SCProductScreenshot toModel(SCProductScreenshotSoap soapModel) {
84          SCProductScreenshot model = new SCProductScreenshotImpl();
85  
86          model.setProductScreenshotId(soapModel.getProductScreenshotId());
87          model.setCompanyId(soapModel.getCompanyId());
88          model.setGroupId(soapModel.getGroupId());
89          model.setProductEntryId(soapModel.getProductEntryId());
90          model.setThumbnailId(soapModel.getThumbnailId());
91          model.setFullImageId(soapModel.getFullImageId());
92          model.setPriority(soapModel.getPriority());
93  
94          return model;
95      }
96  
97      public static List<SCProductScreenshot> toModels(
98          SCProductScreenshotSoap[] soapModels) {
99          List<SCProductScreenshot> models = new ArrayList<SCProductScreenshot>(soapModels.length);
100 
101         for (SCProductScreenshotSoap soapModel : soapModels) {
102             models.add(toModel(soapModel));
103         }
104 
105         return models;
106     }
107 
108     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
109                 "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"));
110 
111     public SCProductScreenshotModelImpl() {
112     }
113 
114     public long getPrimaryKey() {
115         return _productScreenshotId;
116     }
117 
118     public void setPrimaryKey(long pk) {
119         setProductScreenshotId(pk);
120     }
121 
122     public Serializable getPrimaryKeyObj() {
123         return new Long(_productScreenshotId);
124     }
125 
126     public long getProductScreenshotId() {
127         return _productScreenshotId;
128     }
129 
130     public void setProductScreenshotId(long productScreenshotId) {
131         _productScreenshotId = productScreenshotId;
132     }
133 
134     public long getCompanyId() {
135         return _companyId;
136     }
137 
138     public void setCompanyId(long companyId) {
139         _companyId = companyId;
140     }
141 
142     public long getGroupId() {
143         return _groupId;
144     }
145 
146     public void setGroupId(long groupId) {
147         _groupId = groupId;
148     }
149 
150     public long getProductEntryId() {
151         return _productEntryId;
152     }
153 
154     public void setProductEntryId(long productEntryId) {
155         _productEntryId = productEntryId;
156 
157         if (!_setOriginalProductEntryId) {
158             _setOriginalProductEntryId = true;
159 
160             _originalProductEntryId = productEntryId;
161         }
162     }
163 
164     public long getOriginalProductEntryId() {
165         return _originalProductEntryId;
166     }
167 
168     public long getThumbnailId() {
169         return _thumbnailId;
170     }
171 
172     public void setThumbnailId(long thumbnailId) {
173         _thumbnailId = thumbnailId;
174 
175         if (!_setOriginalThumbnailId) {
176             _setOriginalThumbnailId = true;
177 
178             _originalThumbnailId = thumbnailId;
179         }
180     }
181 
182     public long getOriginalThumbnailId() {
183         return _originalThumbnailId;
184     }
185 
186     public long getFullImageId() {
187         return _fullImageId;
188     }
189 
190     public void setFullImageId(long fullImageId) {
191         _fullImageId = fullImageId;
192 
193         if (!_setOriginalFullImageId) {
194             _setOriginalFullImageId = true;
195 
196             _originalFullImageId = fullImageId;
197         }
198     }
199 
200     public long getOriginalFullImageId() {
201         return _originalFullImageId;
202     }
203 
204     public int getPriority() {
205         return _priority;
206     }
207 
208     public void setPriority(int priority) {
209         _priority = priority;
210 
211         if (!_setOriginalPriority) {
212             _setOriginalPriority = true;
213 
214             _originalPriority = priority;
215         }
216     }
217 
218     public int getOriginalPriority() {
219         return _originalPriority;
220     }
221 
222     public SCProductScreenshot toEscapedModel() {
223         if (isEscapedModel()) {
224             return (SCProductScreenshot)this;
225         }
226         else {
227             SCProductScreenshot model = new SCProductScreenshotImpl();
228 
229             model.setNew(isNew());
230             model.setEscapedModel(true);
231 
232             model.setProductScreenshotId(getProductScreenshotId());
233             model.setCompanyId(getCompanyId());
234             model.setGroupId(getGroupId());
235             model.setProductEntryId(getProductEntryId());
236             model.setThumbnailId(getThumbnailId());
237             model.setFullImageId(getFullImageId());
238             model.setPriority(getPriority());
239 
240             model = (SCProductScreenshot)Proxy.newProxyInstance(SCProductScreenshot.class.getClassLoader(),
241                     new Class[] { SCProductScreenshot.class },
242                     new ReadOnlyBeanHandler(model));
243 
244             return model;
245         }
246     }
247 
248     public Object clone() {
249         SCProductScreenshotImpl clone = new SCProductScreenshotImpl();
250 
251         clone.setProductScreenshotId(getProductScreenshotId());
252         clone.setCompanyId(getCompanyId());
253         clone.setGroupId(getGroupId());
254         clone.setProductEntryId(getProductEntryId());
255         clone.setThumbnailId(getThumbnailId());
256         clone.setFullImageId(getFullImageId());
257         clone.setPriority(getPriority());
258 
259         return clone;
260     }
261 
262     public int compareTo(SCProductScreenshot scProductScreenshot) {
263         int value = 0;
264 
265         if (getProductEntryId() < scProductScreenshot.getProductEntryId()) {
266             value = -1;
267         }
268         else if (getProductEntryId() > scProductScreenshot.getProductEntryId()) {
269             value = 1;
270         }
271         else {
272             value = 0;
273         }
274 
275         if (value != 0) {
276             return value;
277         }
278 
279         if (getPriority() < scProductScreenshot.getPriority()) {
280             value = -1;
281         }
282         else if (getPriority() > scProductScreenshot.getPriority()) {
283             value = 1;
284         }
285         else {
286             value = 0;
287         }
288 
289         if (value != 0) {
290             return value;
291         }
292 
293         return 0;
294     }
295 
296     public boolean equals(Object obj) {
297         if (obj == null) {
298             return false;
299         }
300 
301         SCProductScreenshot scProductScreenshot = null;
302 
303         try {
304             scProductScreenshot = (SCProductScreenshot)obj;
305         }
306         catch (ClassCastException cce) {
307             return false;
308         }
309 
310         long pk = scProductScreenshot.getPrimaryKey();
311 
312         if (getPrimaryKey() == pk) {
313             return true;
314         }
315         else {
316             return false;
317         }
318     }
319 
320     public int hashCode() {
321         return (int)getPrimaryKey();
322     }
323 
324     public String toString() {
325         StringBuilder sb = new StringBuilder();
326 
327         sb.append("{productScreenshotId=");
328         sb.append(getProductScreenshotId());
329         sb.append(", companyId=");
330         sb.append(getCompanyId());
331         sb.append(", groupId=");
332         sb.append(getGroupId());
333         sb.append(", productEntryId=");
334         sb.append(getProductEntryId());
335         sb.append(", thumbnailId=");
336         sb.append(getThumbnailId());
337         sb.append(", fullImageId=");
338         sb.append(getFullImageId());
339         sb.append(", priority=");
340         sb.append(getPriority());
341         sb.append("}");
342 
343         return sb.toString();
344     }
345 
346     public String toXmlString() {
347         StringBuilder sb = new StringBuilder();
348 
349         sb.append("<model><model-name>");
350         sb.append(
351             "com.liferay.portlet.softwarecatalog.model.SCProductScreenshot");
352         sb.append("</model-name>");
353 
354         sb.append(
355             "<column><column-name>productScreenshotId</column-name><column-value><![CDATA[");
356         sb.append(getProductScreenshotId());
357         sb.append("]]></column-value></column>");
358         sb.append(
359             "<column><column-name>companyId</column-name><column-value><![CDATA[");
360         sb.append(getCompanyId());
361         sb.append("]]></column-value></column>");
362         sb.append(
363             "<column><column-name>groupId</column-name><column-value><![CDATA[");
364         sb.append(getGroupId());
365         sb.append("]]></column-value></column>");
366         sb.append(
367             "<column><column-name>productEntryId</column-name><column-value><![CDATA[");
368         sb.append(getProductEntryId());
369         sb.append("]]></column-value></column>");
370         sb.append(
371             "<column><column-name>thumbnailId</column-name><column-value><![CDATA[");
372         sb.append(getThumbnailId());
373         sb.append("]]></column-value></column>");
374         sb.append(
375             "<column><column-name>fullImageId</column-name><column-value><![CDATA[");
376         sb.append(getFullImageId());
377         sb.append("]]></column-value></column>");
378         sb.append(
379             "<column><column-name>priority</column-name><column-value><![CDATA[");
380         sb.append(getPriority());
381         sb.append("]]></column-value></column>");
382 
383         sb.append("</model>");
384 
385         return sb.toString();
386     }
387 
388     private long _productScreenshotId;
389     private long _companyId;
390     private long _groupId;
391     private long _productEntryId;
392     private long _originalProductEntryId;
393     private boolean _setOriginalProductEntryId;
394     private long _thumbnailId;
395     private long _originalThumbnailId;
396     private boolean _setOriginalThumbnailId;
397     private long _fullImageId;
398     private long _originalFullImageId;
399     private boolean _setOriginalFullImageId;
400     private int _priority;
401     private int _originalPriority;
402     private boolean _setOriginalPriority;
403 }