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.expando.model.ExpandoBridge;
27  import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
28  import com.liferay.portlet.softwarecatalog.model.SCProductScreenshot;
29  import com.liferay.portlet.softwarecatalog.model.SCProductScreenshotSoap;
30  
31  import java.io.Serializable;
32  
33  import java.lang.reflect.Proxy;
34  
35  import java.sql.Types;
36  
37  import java.util.ArrayList;
38  import java.util.List;
39  
40  /**
41   * <a href="SCProductScreenshotModelImpl.java.html"><b><i>View Source</i></b></a>
42   *
43   * <p>
44   * ServiceBuilder generated this class. Modifications in this class will be
45   * overwritten the next time is generated.
46   * </p>
47   *
48   * <p>
49   * This class is a model that represents the <code>SCProductScreenshot</code> table
50   * in the database.
51   * </p>
52   *
53   * @author Brian Wing Shun Chan
54   *
55   * @see com.liferay.portlet.softwarecatalog.model.SCProductScreenshot
56   * @see com.liferay.portlet.softwarecatalog.model.SCProductScreenshotModel
57   * @see com.liferay.portlet.softwarecatalog.model.impl.SCProductScreenshotImpl
58   *
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              
65  
66              { "companyId", new Integer(Types.BIGINT) },
67              
68  
69              { "groupId", new Integer(Types.BIGINT) },
70              
71  
72              { "productEntryId", new Integer(Types.BIGINT) },
73              
74  
75              { "thumbnailId", new Integer(Types.BIGINT) },
76              
77  
78              { "fullImageId", new Integer(Types.BIGINT) },
79              
80  
81              { "priority", new Integer(Types.INTEGER) }
82          };
83      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)";
84      public static final String TABLE_SQL_DROP = "drop table SCProductScreenshot";
85      public static final String DATA_SOURCE = "liferayDataSource";
86      public static final String SESSION_FACTORY = "liferaySessionFactory";
87      public static final String TX_MANAGER = "liferayTransactionManager";
88      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
89                  "value.object.entity.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"),
90              true);
91      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
92                  "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"),
93              true);
94  
95      public static SCProductScreenshot toModel(SCProductScreenshotSoap soapModel) {
96          SCProductScreenshot model = new SCProductScreenshotImpl();
97  
98          model.setProductScreenshotId(soapModel.getProductScreenshotId());
99          model.setCompanyId(soapModel.getCompanyId());
100         model.setGroupId(soapModel.getGroupId());
101         model.setProductEntryId(soapModel.getProductEntryId());
102         model.setThumbnailId(soapModel.getThumbnailId());
103         model.setFullImageId(soapModel.getFullImageId());
104         model.setPriority(soapModel.getPriority());
105 
106         return model;
107     }
108 
109     public static List<SCProductScreenshot> toModels(
110         SCProductScreenshotSoap[] soapModels) {
111         List<SCProductScreenshot> models = new ArrayList<SCProductScreenshot>(soapModels.length);
112 
113         for (SCProductScreenshotSoap soapModel : soapModels) {
114             models.add(toModel(soapModel));
115         }
116 
117         return models;
118     }
119 
120     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
121                 "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot"));
122 
123     public SCProductScreenshotModelImpl() {
124     }
125 
126     public long getPrimaryKey() {
127         return _productScreenshotId;
128     }
129 
130     public void setPrimaryKey(long pk) {
131         setProductScreenshotId(pk);
132     }
133 
134     public Serializable getPrimaryKeyObj() {
135         return new Long(_productScreenshotId);
136     }
137 
138     public long getProductScreenshotId() {
139         return _productScreenshotId;
140     }
141 
142     public void setProductScreenshotId(long productScreenshotId) {
143         _productScreenshotId = productScreenshotId;
144     }
145 
146     public long getCompanyId() {
147         return _companyId;
148     }
149 
150     public void setCompanyId(long companyId) {
151         _companyId = companyId;
152     }
153 
154     public long getGroupId() {
155         return _groupId;
156     }
157 
158     public void setGroupId(long groupId) {
159         _groupId = groupId;
160     }
161 
162     public long getProductEntryId() {
163         return _productEntryId;
164     }
165 
166     public void setProductEntryId(long productEntryId) {
167         _productEntryId = productEntryId;
168 
169         if (!_setOriginalProductEntryId) {
170             _setOriginalProductEntryId = true;
171 
172             _originalProductEntryId = productEntryId;
173         }
174     }
175 
176     public long getOriginalProductEntryId() {
177         return _originalProductEntryId;
178     }
179 
180     public long getThumbnailId() {
181         return _thumbnailId;
182     }
183 
184     public void setThumbnailId(long thumbnailId) {
185         _thumbnailId = thumbnailId;
186 
187         if (!_setOriginalThumbnailId) {
188             _setOriginalThumbnailId = true;
189 
190             _originalThumbnailId = thumbnailId;
191         }
192     }
193 
194     public long getOriginalThumbnailId() {
195         return _originalThumbnailId;
196     }
197 
198     public long getFullImageId() {
199         return _fullImageId;
200     }
201 
202     public void setFullImageId(long fullImageId) {
203         _fullImageId = fullImageId;
204 
205         if (!_setOriginalFullImageId) {
206             _setOriginalFullImageId = true;
207 
208             _originalFullImageId = fullImageId;
209         }
210     }
211 
212     public long getOriginalFullImageId() {
213         return _originalFullImageId;
214     }
215 
216     public int getPriority() {
217         return _priority;
218     }
219 
220     public void setPriority(int priority) {
221         _priority = priority;
222 
223         if (!_setOriginalPriority) {
224             _setOriginalPriority = true;
225 
226             _originalPriority = priority;
227         }
228     }
229 
230     public int getOriginalPriority() {
231         return _originalPriority;
232     }
233 
234     public SCProductScreenshot toEscapedModel() {
235         if (isEscapedModel()) {
236             return (SCProductScreenshot)this;
237         }
238         else {
239             SCProductScreenshot model = new SCProductScreenshotImpl();
240 
241             model.setNew(isNew());
242             model.setEscapedModel(true);
243 
244             model.setProductScreenshotId(getProductScreenshotId());
245             model.setCompanyId(getCompanyId());
246             model.setGroupId(getGroupId());
247             model.setProductEntryId(getProductEntryId());
248             model.setThumbnailId(getThumbnailId());
249             model.setFullImageId(getFullImageId());
250             model.setPriority(getPriority());
251 
252             model = (SCProductScreenshot)Proxy.newProxyInstance(SCProductScreenshot.class.getClassLoader(),
253                     new Class[] { SCProductScreenshot.class },
254                     new ReadOnlyBeanHandler(model));
255 
256             return model;
257         }
258     }
259 
260     public ExpandoBridge getExpandoBridge() {
261         if (_expandoBridge == null) {
262             _expandoBridge = new ExpandoBridgeImpl(SCProductScreenshot.class.getName(),
263                     getPrimaryKey());
264         }
265 
266         return _expandoBridge;
267     }
268 
269     public Object clone() {
270         SCProductScreenshotImpl clone = new SCProductScreenshotImpl();
271 
272         clone.setProductScreenshotId(getProductScreenshotId());
273         clone.setCompanyId(getCompanyId());
274         clone.setGroupId(getGroupId());
275         clone.setProductEntryId(getProductEntryId());
276         clone.setThumbnailId(getThumbnailId());
277         clone.setFullImageId(getFullImageId());
278         clone.setPriority(getPriority());
279 
280         return clone;
281     }
282 
283     public int compareTo(SCProductScreenshot scProductScreenshot) {
284         int value = 0;
285 
286         if (getProductEntryId() < scProductScreenshot.getProductEntryId()) {
287             value = -1;
288         }
289         else if (getProductEntryId() > scProductScreenshot.getProductEntryId()) {
290             value = 1;
291         }
292         else {
293             value = 0;
294         }
295 
296         if (value != 0) {
297             return value;
298         }
299 
300         if (getPriority() < scProductScreenshot.getPriority()) {
301             value = -1;
302         }
303         else if (getPriority() > scProductScreenshot.getPriority()) {
304             value = 1;
305         }
306         else {
307             value = 0;
308         }
309 
310         if (value != 0) {
311             return value;
312         }
313 
314         return 0;
315     }
316 
317     public boolean equals(Object obj) {
318         if (obj == null) {
319             return false;
320         }
321 
322         SCProductScreenshot scProductScreenshot = null;
323 
324         try {
325             scProductScreenshot = (SCProductScreenshot)obj;
326         }
327         catch (ClassCastException cce) {
328             return false;
329         }
330 
331         long pk = scProductScreenshot.getPrimaryKey();
332 
333         if (getPrimaryKey() == pk) {
334             return true;
335         }
336         else {
337             return false;
338         }
339     }
340 
341     public int hashCode() {
342         return (int)getPrimaryKey();
343     }
344 
345     public String toString() {
346         StringBuilder sb = new StringBuilder();
347 
348         sb.append("{productScreenshotId=");
349         sb.append(getProductScreenshotId());
350         sb.append(", companyId=");
351         sb.append(getCompanyId());
352         sb.append(", groupId=");
353         sb.append(getGroupId());
354         sb.append(", productEntryId=");
355         sb.append(getProductEntryId());
356         sb.append(", thumbnailId=");
357         sb.append(getThumbnailId());
358         sb.append(", fullImageId=");
359         sb.append(getFullImageId());
360         sb.append(", priority=");
361         sb.append(getPriority());
362         sb.append("}");
363 
364         return sb.toString();
365     }
366 
367     public String toXmlString() {
368         StringBuilder sb = new StringBuilder();
369 
370         sb.append("<model><model-name>");
371         sb.append(
372             "com.liferay.portlet.softwarecatalog.model.SCProductScreenshot");
373         sb.append("</model-name>");
374 
375         sb.append(
376             "<column><column-name>productScreenshotId</column-name><column-value><![CDATA[");
377         sb.append(getProductScreenshotId());
378         sb.append("]]></column-value></column>");
379         sb.append(
380             "<column><column-name>companyId</column-name><column-value><![CDATA[");
381         sb.append(getCompanyId());
382         sb.append("]]></column-value></column>");
383         sb.append(
384             "<column><column-name>groupId</column-name><column-value><![CDATA[");
385         sb.append(getGroupId());
386         sb.append("]]></column-value></column>");
387         sb.append(
388             "<column><column-name>productEntryId</column-name><column-value><![CDATA[");
389         sb.append(getProductEntryId());
390         sb.append("]]></column-value></column>");
391         sb.append(
392             "<column><column-name>thumbnailId</column-name><column-value><![CDATA[");
393         sb.append(getThumbnailId());
394         sb.append("]]></column-value></column>");
395         sb.append(
396             "<column><column-name>fullImageId</column-name><column-value><![CDATA[");
397         sb.append(getFullImageId());
398         sb.append("]]></column-value></column>");
399         sb.append(
400             "<column><column-name>priority</column-name><column-value><![CDATA[");
401         sb.append(getPriority());
402         sb.append("]]></column-value></column>");
403 
404         sb.append("</model>");
405 
406         return sb.toString();
407     }
408 
409     private long _productScreenshotId;
410     private long _companyId;
411     private long _groupId;
412     private long _productEntryId;
413     private long _originalProductEntryId;
414     private boolean _setOriginalProductEntryId;
415     private long _thumbnailId;
416     private long _originalThumbnailId;
417     private boolean _setOriginalThumbnailId;
418     private long _fullImageId;
419     private long _originalFullImageId;
420     private boolean _setOriginalFullImageId;
421     private int _priority;
422     private int _originalPriority;
423     private boolean _setOriginalPriority;
424     private transient ExpandoBridge _expandoBridge;
425 }