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.imagegallery.model.impl;
21  
22  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23  import com.liferay.portal.kernel.util.GetterUtil;
24  import com.liferay.portal.kernel.util.HtmlUtil;
25  import com.liferay.portal.model.impl.BaseModelImpl;
26  
27  import com.liferay.portlet.expando.model.ExpandoBridge;
28  import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
29  import com.liferay.portlet.imagegallery.model.IGImage;
30  import com.liferay.portlet.imagegallery.model.IGImageSoap;
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.Date;
40  import java.util.List;
41  
42  /**
43   * <a href="IGImageModelImpl.java.html"><b><i>View Source</i></b></a>
44   *
45   * <p>
46   * ServiceBuilder generated this class. Modifications in this class will be
47   * overwritten the next time is generated.
48   * </p>
49   *
50   * <p>
51   * This class is a model that represents the <code>IGImage</code> table
52   * in the database.
53   * </p>
54   *
55   * @author Brian Wing Shun Chan
56   *
57   * @see com.liferay.portlet.imagegallery.model.IGImage
58   * @see com.liferay.portlet.imagegallery.model.IGImageModel
59   * @see com.liferay.portlet.imagegallery.model.impl.IGImageImpl
60   *
61   */
62  public class IGImageModelImpl extends BaseModelImpl<IGImage> {
63      public static final String TABLE_NAME = "IGImage";
64      public static final Object[][] TABLE_COLUMNS = {
65              { "uuid_", new Integer(Types.VARCHAR) },
66              
67  
68              { "imageId", new Integer(Types.BIGINT) },
69              
70  
71              { "groupId", new Integer(Types.BIGINT) },
72              
73  
74              { "companyId", new Integer(Types.BIGINT) },
75              
76  
77              { "userId", new Integer(Types.BIGINT) },
78              
79  
80              { "createDate", new Integer(Types.TIMESTAMP) },
81              
82  
83              { "modifiedDate", new Integer(Types.TIMESTAMP) },
84              
85  
86              { "folderId", new Integer(Types.BIGINT) },
87              
88  
89              { "name", new Integer(Types.VARCHAR) },
90              
91  
92              { "description", new Integer(Types.VARCHAR) },
93              
94  
95              { "smallImageId", new Integer(Types.BIGINT) },
96              
97  
98              { "largeImageId", new Integer(Types.BIGINT) },
99              
100 
101             { "custom1ImageId", new Integer(Types.BIGINT) },
102             
103 
104             { "custom2ImageId", new Integer(Types.BIGINT) }
105         };
106     public static final String TABLE_SQL_CREATE = "create table IGImage (uuid_ VARCHAR(75) null,imageId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,createDate DATE null,modifiedDate DATE null,folderId LONG,name VARCHAR(75) null,description STRING null,smallImageId LONG,largeImageId LONG,custom1ImageId LONG,custom2ImageId LONG)";
107     public static final String TABLE_SQL_DROP = "drop table IGImage";
108     public static final String DATA_SOURCE = "liferayDataSource";
109     public static final String SESSION_FACTORY = "liferaySessionFactory";
110     public static final String TX_MANAGER = "liferayTransactionManager";
111     public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
112                 "value.object.entity.cache.enabled.com.liferay.portlet.imagegallery.model.IGImage"),
113             true);
114     public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
115                 "value.object.finder.cache.enabled.com.liferay.portlet.imagegallery.model.IGImage"),
116             true);
117 
118     public static IGImage toModel(IGImageSoap soapModel) {
119         IGImage model = new IGImageImpl();
120 
121         model.setUuid(soapModel.getUuid());
122         model.setImageId(soapModel.getImageId());
123         model.setGroupId(soapModel.getGroupId());
124         model.setCompanyId(soapModel.getCompanyId());
125         model.setUserId(soapModel.getUserId());
126         model.setCreateDate(soapModel.getCreateDate());
127         model.setModifiedDate(soapModel.getModifiedDate());
128         model.setFolderId(soapModel.getFolderId());
129         model.setName(soapModel.getName());
130         model.setDescription(soapModel.getDescription());
131         model.setSmallImageId(soapModel.getSmallImageId());
132         model.setLargeImageId(soapModel.getLargeImageId());
133         model.setCustom1ImageId(soapModel.getCustom1ImageId());
134         model.setCustom2ImageId(soapModel.getCustom2ImageId());
135 
136         return model;
137     }
138 
139     public static List<IGImage> toModels(IGImageSoap[] soapModels) {
140         List<IGImage> models = new ArrayList<IGImage>(soapModels.length);
141 
142         for (IGImageSoap soapModel : soapModels) {
143             models.add(toModel(soapModel));
144         }
145 
146         return models;
147     }
148 
149     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
150                 "lock.expiration.time.com.liferay.portlet.imagegallery.model.IGImage"));
151 
152     public IGImageModelImpl() {
153     }
154 
155     public long getPrimaryKey() {
156         return _imageId;
157     }
158 
159     public void setPrimaryKey(long pk) {
160         setImageId(pk);
161     }
162 
163     public Serializable getPrimaryKeyObj() {
164         return new Long(_imageId);
165     }
166 
167     public String getUuid() {
168         return GetterUtil.getString(_uuid);
169     }
170 
171     public void setUuid(String uuid) {
172         _uuid = uuid;
173 
174         if (_originalUuid == null) {
175             _originalUuid = uuid;
176         }
177     }
178 
179     public String getOriginalUuid() {
180         return GetterUtil.getString(_originalUuid);
181     }
182 
183     public long getImageId() {
184         return _imageId;
185     }
186 
187     public void setImageId(long imageId) {
188         _imageId = imageId;
189     }
190 
191     public long getGroupId() {
192         return _groupId;
193     }
194 
195     public void setGroupId(long groupId) {
196         _groupId = groupId;
197 
198         if (!_setOriginalGroupId) {
199             _setOriginalGroupId = true;
200 
201             _originalGroupId = groupId;
202         }
203     }
204 
205     public long getOriginalGroupId() {
206         return _originalGroupId;
207     }
208 
209     public long getCompanyId() {
210         return _companyId;
211     }
212 
213     public void setCompanyId(long companyId) {
214         _companyId = companyId;
215     }
216 
217     public long getUserId() {
218         return _userId;
219     }
220 
221     public void setUserId(long userId) {
222         _userId = userId;
223     }
224 
225     public Date getCreateDate() {
226         return _createDate;
227     }
228 
229     public void setCreateDate(Date createDate) {
230         _createDate = createDate;
231     }
232 
233     public Date getModifiedDate() {
234         return _modifiedDate;
235     }
236 
237     public void setModifiedDate(Date modifiedDate) {
238         _modifiedDate = modifiedDate;
239     }
240 
241     public long getFolderId() {
242         return _folderId;
243     }
244 
245     public void setFolderId(long folderId) {
246         _folderId = folderId;
247     }
248 
249     public String getName() {
250         return GetterUtil.getString(_name);
251     }
252 
253     public void setName(String name) {
254         _name = name;
255     }
256 
257     public String getDescription() {
258         return GetterUtil.getString(_description);
259     }
260 
261     public void setDescription(String description) {
262         _description = description;
263     }
264 
265     public long getSmallImageId() {
266         return _smallImageId;
267     }
268 
269     public void setSmallImageId(long smallImageId) {
270         _smallImageId = smallImageId;
271 
272         if (!_setOriginalSmallImageId) {
273             _setOriginalSmallImageId = true;
274 
275             _originalSmallImageId = smallImageId;
276         }
277     }
278 
279     public long getOriginalSmallImageId() {
280         return _originalSmallImageId;
281     }
282 
283     public long getLargeImageId() {
284         return _largeImageId;
285     }
286 
287     public void setLargeImageId(long largeImageId) {
288         _largeImageId = largeImageId;
289 
290         if (!_setOriginalLargeImageId) {
291             _setOriginalLargeImageId = true;
292 
293             _originalLargeImageId = largeImageId;
294         }
295     }
296 
297     public long getOriginalLargeImageId() {
298         return _originalLargeImageId;
299     }
300 
301     public long getCustom1ImageId() {
302         return _custom1ImageId;
303     }
304 
305     public void setCustom1ImageId(long custom1ImageId) {
306         _custom1ImageId = custom1ImageId;
307 
308         if (!_setOriginalCustom1ImageId) {
309             _setOriginalCustom1ImageId = true;
310 
311             _originalCustom1ImageId = custom1ImageId;
312         }
313     }
314 
315     public long getOriginalCustom1ImageId() {
316         return _originalCustom1ImageId;
317     }
318 
319     public long getCustom2ImageId() {
320         return _custom2ImageId;
321     }
322 
323     public void setCustom2ImageId(long custom2ImageId) {
324         _custom2ImageId = custom2ImageId;
325 
326         if (!_setOriginalCustom2ImageId) {
327             _setOriginalCustom2ImageId = true;
328 
329             _originalCustom2ImageId = custom2ImageId;
330         }
331     }
332 
333     public long getOriginalCustom2ImageId() {
334         return _originalCustom2ImageId;
335     }
336 
337     public IGImage toEscapedModel() {
338         if (isEscapedModel()) {
339             return (IGImage)this;
340         }
341         else {
342             IGImage model = new IGImageImpl();
343 
344             model.setNew(isNew());
345             model.setEscapedModel(true);
346 
347             model.setUuid(HtmlUtil.escape(getUuid()));
348             model.setImageId(getImageId());
349             model.setGroupId(getGroupId());
350             model.setCompanyId(getCompanyId());
351             model.setUserId(getUserId());
352             model.setCreateDate(getCreateDate());
353             model.setModifiedDate(getModifiedDate());
354             model.setFolderId(getFolderId());
355             model.setName(HtmlUtil.escape(getName()));
356             model.setDescription(HtmlUtil.escape(getDescription()));
357             model.setSmallImageId(getSmallImageId());
358             model.setLargeImageId(getLargeImageId());
359             model.setCustom1ImageId(getCustom1ImageId());
360             model.setCustom2ImageId(getCustom2ImageId());
361 
362             model = (IGImage)Proxy.newProxyInstance(IGImage.class.getClassLoader(),
363                     new Class[] { IGImage.class },
364                     new ReadOnlyBeanHandler(model));
365 
366             return model;
367         }
368     }
369 
370     public ExpandoBridge getExpandoBridge() {
371         if (_expandoBridge == null) {
372             _expandoBridge = new ExpandoBridgeImpl(IGImage.class.getName(),
373                     getPrimaryKey());
374         }
375 
376         return _expandoBridge;
377     }
378 
379     public Object clone() {
380         IGImageImpl clone = new IGImageImpl();
381 
382         clone.setUuid(getUuid());
383         clone.setImageId(getImageId());
384         clone.setGroupId(getGroupId());
385         clone.setCompanyId(getCompanyId());
386         clone.setUserId(getUserId());
387         clone.setCreateDate(getCreateDate());
388         clone.setModifiedDate(getModifiedDate());
389         clone.setFolderId(getFolderId());
390         clone.setName(getName());
391         clone.setDescription(getDescription());
392         clone.setSmallImageId(getSmallImageId());
393         clone.setLargeImageId(getLargeImageId());
394         clone.setCustom1ImageId(getCustom1ImageId());
395         clone.setCustom2ImageId(getCustom2ImageId());
396 
397         return clone;
398     }
399 
400     public int compareTo(IGImage igImage) {
401         int value = 0;
402 
403         if (getImageId() < igImage.getImageId()) {
404             value = -1;
405         }
406         else if (getImageId() > igImage.getImageId()) {
407             value = 1;
408         }
409         else {
410             value = 0;
411         }
412 
413         if (value != 0) {
414             return value;
415         }
416 
417         return 0;
418     }
419 
420     public boolean equals(Object obj) {
421         if (obj == null) {
422             return false;
423         }
424 
425         IGImage igImage = null;
426 
427         try {
428             igImage = (IGImage)obj;
429         }
430         catch (ClassCastException cce) {
431             return false;
432         }
433 
434         long pk = igImage.getPrimaryKey();
435 
436         if (getPrimaryKey() == pk) {
437             return true;
438         }
439         else {
440             return false;
441         }
442     }
443 
444     public int hashCode() {
445         return (int)getPrimaryKey();
446     }
447 
448     public String toString() {
449         StringBuilder sb = new StringBuilder();
450 
451         sb.append("{uuid=");
452         sb.append(getUuid());
453         sb.append(", imageId=");
454         sb.append(getImageId());
455         sb.append(", groupId=");
456         sb.append(getGroupId());
457         sb.append(", companyId=");
458         sb.append(getCompanyId());
459         sb.append(", userId=");
460         sb.append(getUserId());
461         sb.append(", createDate=");
462         sb.append(getCreateDate());
463         sb.append(", modifiedDate=");
464         sb.append(getModifiedDate());
465         sb.append(", folderId=");
466         sb.append(getFolderId());
467         sb.append(", name=");
468         sb.append(getName());
469         sb.append(", description=");
470         sb.append(getDescription());
471         sb.append(", smallImageId=");
472         sb.append(getSmallImageId());
473         sb.append(", largeImageId=");
474         sb.append(getLargeImageId());
475         sb.append(", custom1ImageId=");
476         sb.append(getCustom1ImageId());
477         sb.append(", custom2ImageId=");
478         sb.append(getCustom2ImageId());
479         sb.append("}");
480 
481         return sb.toString();
482     }
483 
484     public String toXmlString() {
485         StringBuilder sb = new StringBuilder();
486 
487         sb.append("<model><model-name>");
488         sb.append("com.liferay.portlet.imagegallery.model.IGImage");
489         sb.append("</model-name>");
490 
491         sb.append(
492             "<column><column-name>uuid</column-name><column-value><![CDATA[");
493         sb.append(getUuid());
494         sb.append("]]></column-value></column>");
495         sb.append(
496             "<column><column-name>imageId</column-name><column-value><![CDATA[");
497         sb.append(getImageId());
498         sb.append("]]></column-value></column>");
499         sb.append(
500             "<column><column-name>groupId</column-name><column-value><![CDATA[");
501         sb.append(getGroupId());
502         sb.append("]]></column-value></column>");
503         sb.append(
504             "<column><column-name>companyId</column-name><column-value><![CDATA[");
505         sb.append(getCompanyId());
506         sb.append("]]></column-value></column>");
507         sb.append(
508             "<column><column-name>userId</column-name><column-value><![CDATA[");
509         sb.append(getUserId());
510         sb.append("]]></column-value></column>");
511         sb.append(
512             "<column><column-name>createDate</column-name><column-value><![CDATA[");
513         sb.append(getCreateDate());
514         sb.append("]]></column-value></column>");
515         sb.append(
516             "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
517         sb.append(getModifiedDate());
518         sb.append("]]></column-value></column>");
519         sb.append(
520             "<column><column-name>folderId</column-name><column-value><![CDATA[");
521         sb.append(getFolderId());
522         sb.append("]]></column-value></column>");
523         sb.append(
524             "<column><column-name>name</column-name><column-value><![CDATA[");
525         sb.append(getName());
526         sb.append("]]></column-value></column>");
527         sb.append(
528             "<column><column-name>description</column-name><column-value><![CDATA[");
529         sb.append(getDescription());
530         sb.append("]]></column-value></column>");
531         sb.append(
532             "<column><column-name>smallImageId</column-name><column-value><![CDATA[");
533         sb.append(getSmallImageId());
534         sb.append("]]></column-value></column>");
535         sb.append(
536             "<column><column-name>largeImageId</column-name><column-value><![CDATA[");
537         sb.append(getLargeImageId());
538         sb.append("]]></column-value></column>");
539         sb.append(
540             "<column><column-name>custom1ImageId</column-name><column-value><![CDATA[");
541         sb.append(getCustom1ImageId());
542         sb.append("]]></column-value></column>");
543         sb.append(
544             "<column><column-name>custom2ImageId</column-name><column-value><![CDATA[");
545         sb.append(getCustom2ImageId());
546         sb.append("]]></column-value></column>");
547 
548         sb.append("</model>");
549 
550         return sb.toString();
551     }
552 
553     private String _uuid;
554     private String _originalUuid;
555     private long _imageId;
556     private long _groupId;
557     private long _originalGroupId;
558     private boolean _setOriginalGroupId;
559     private long _companyId;
560     private long _userId;
561     private Date _createDate;
562     private Date _modifiedDate;
563     private long _folderId;
564     private String _name;
565     private String _description;
566     private long _smallImageId;
567     private long _originalSmallImageId;
568     private boolean _setOriginalSmallImageId;
569     private long _largeImageId;
570     private long _originalLargeImageId;
571     private boolean _setOriginalLargeImageId;
572     private long _custom1ImageId;
573     private long _originalCustom1ImageId;
574     private boolean _setOriginalCustom1ImageId;
575     private long _custom2ImageId;
576     private long _originalCustom2ImageId;
577     private boolean _setOriginalCustom2ImageId;
578     private transient ExpandoBridge _expandoBridge;
579 }