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