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