1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions 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.journal.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.HtmlUtil;
28  import com.liferay.portal.model.impl.BaseModelImpl;
29  
30  import com.liferay.portlet.journal.model.JournalFeed;
31  import com.liferay.portlet.journal.model.JournalFeedSoap;
32  
33  import java.io.Serializable;
34  
35  import java.lang.reflect.Proxy;
36  
37  import java.sql.Types;
38  
39  import java.util.ArrayList;
40  import java.util.Date;
41  import java.util.List;
42  
43  /**
44   * <a href="JournalFeedModelImpl.java.html"><b><i>View Source</i></b></a>
45   *
46   * <p>
47   * ServiceBuilder generated this class. Modifications in this class will be
48   * overwritten the next time is generated.
49   * </p>
50   *
51   * <p>
52   * This class is a model that represents the <code>JournalFeed</code> table
53   * in the database.
54   * </p>
55   *
56   * @author Brian Wing Shun Chan
57   *
58   * @see com.liferay.portlet.journal.service.model.JournalFeed
59   * @see com.liferay.portlet.journal.service.model.JournalFeedModel
60   * @see com.liferay.portlet.journal.service.model.impl.JournalFeedImpl
61   *
62   */
63  public class JournalFeedModelImpl extends BaseModelImpl {
64      public static final String TABLE_NAME = "JournalFeed";
65      public static final Object[][] TABLE_COLUMNS = {
66              { "uuid_", new Integer(Types.VARCHAR) },
67              
68  
69              { "id_", new Integer(Types.BIGINT) },
70              
71  
72              { "groupId", new Integer(Types.BIGINT) },
73              
74  
75              { "companyId", new Integer(Types.BIGINT) },
76              
77  
78              { "userId", new Integer(Types.BIGINT) },
79              
80  
81              { "userName", new Integer(Types.VARCHAR) },
82              
83  
84              { "createDate", new Integer(Types.TIMESTAMP) },
85              
86  
87              { "modifiedDate", new Integer(Types.TIMESTAMP) },
88              
89  
90              { "feedId", new Integer(Types.VARCHAR) },
91              
92  
93              { "name", new Integer(Types.VARCHAR) },
94              
95  
96              { "description", new Integer(Types.VARCHAR) },
97              
98  
99              { "type_", new Integer(Types.VARCHAR) },
100             
101 
102             { "structureId", new Integer(Types.VARCHAR) },
103             
104 
105             { "templateId", new Integer(Types.VARCHAR) },
106             
107 
108             { "rendererTemplateId", new Integer(Types.VARCHAR) },
109             
110 
111             { "delta", new Integer(Types.INTEGER) },
112             
113 
114             { "orderByCol", new Integer(Types.VARCHAR) },
115             
116 
117             { "orderByType", new Integer(Types.VARCHAR) },
118             
119 
120             { "targetLayoutFriendlyUrl", new Integer(Types.VARCHAR) },
121             
122 
123             { "targetPortletId", new Integer(Types.VARCHAR) },
124             
125 
126             { "contentField", new Integer(Types.VARCHAR) },
127             
128 
129             { "feedType", new Integer(Types.VARCHAR) },
130             
131 
132             { "feedVersion", new Integer(Types.DOUBLE) }
133         };
134     public static final String TABLE_SQL_CREATE = "create table JournalFeed (uuid_ VARCHAR(75) null,id_ LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,feedId VARCHAR(75) null,name VARCHAR(75) null,description STRING null,type_ VARCHAR(75) null,structureId VARCHAR(75) null,templateId VARCHAR(75) null,rendererTemplateId VARCHAR(75) null,delta INTEGER,orderByCol VARCHAR(75) null,orderByType VARCHAR(75) null,targetLayoutFriendlyUrl VARCHAR(75) null,targetPortletId VARCHAR(75) null,contentField VARCHAR(75) null,feedType VARCHAR(75) null,feedVersion DOUBLE)";
135     public static final String TABLE_SQL_DROP = "drop table JournalFeed";
136     public static final String DATA_SOURCE = "liferayDataSource";
137     public static final String SESSION_FACTORY = "liferaySessionFactory";
138     public static final String TX_MANAGER = "liferayTransactionManager";
139     public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
140                 "value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalFeed"),
141             true);
142 
143     public static JournalFeed toModel(JournalFeedSoap soapModel) {
144         JournalFeed model = new JournalFeedImpl();
145 
146         model.setUuid(soapModel.getUuid());
147         model.setId(soapModel.getId());
148         model.setGroupId(soapModel.getGroupId());
149         model.setCompanyId(soapModel.getCompanyId());
150         model.setUserId(soapModel.getUserId());
151         model.setUserName(soapModel.getUserName());
152         model.setCreateDate(soapModel.getCreateDate());
153         model.setModifiedDate(soapModel.getModifiedDate());
154         model.setFeedId(soapModel.getFeedId());
155         model.setName(soapModel.getName());
156         model.setDescription(soapModel.getDescription());
157         model.setType(soapModel.getType());
158         model.setStructureId(soapModel.getStructureId());
159         model.setTemplateId(soapModel.getTemplateId());
160         model.setRendererTemplateId(soapModel.getRendererTemplateId());
161         model.setDelta(soapModel.getDelta());
162         model.setOrderByCol(soapModel.getOrderByCol());
163         model.setOrderByType(soapModel.getOrderByType());
164         model.setTargetLayoutFriendlyUrl(soapModel.getTargetLayoutFriendlyUrl());
165         model.setTargetPortletId(soapModel.getTargetPortletId());
166         model.setContentField(soapModel.getContentField());
167         model.setFeedType(soapModel.getFeedType());
168         model.setFeedVersion(soapModel.getFeedVersion());
169 
170         return model;
171     }
172 
173     public static List<JournalFeed> toModels(JournalFeedSoap[] soapModels) {
174         List<JournalFeed> models = new ArrayList<JournalFeed>(soapModels.length);
175 
176         for (JournalFeedSoap soapModel : soapModels) {
177             models.add(toModel(soapModel));
178         }
179 
180         return models;
181     }
182 
183     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
184                 "lock.expiration.time.com.liferay.portlet.journal.model.JournalFeed"));
185 
186     public JournalFeedModelImpl() {
187     }
188 
189     public long getPrimaryKey() {
190         return _id;
191     }
192 
193     public void setPrimaryKey(long pk) {
194         setId(pk);
195     }
196 
197     public Serializable getPrimaryKeyObj() {
198         return new Long(_id);
199     }
200 
201     public String getUuid() {
202         return GetterUtil.getString(_uuid);
203     }
204 
205     public void setUuid(String uuid) {
206         if ((uuid != null) && (uuid != _uuid)) {
207             _uuid = uuid;
208         }
209     }
210 
211     public long getId() {
212         return _id;
213     }
214 
215     public void setId(long id) {
216         if (id != _id) {
217             _id = id;
218         }
219     }
220 
221     public long getGroupId() {
222         return _groupId;
223     }
224 
225     public void setGroupId(long groupId) {
226         if (groupId != _groupId) {
227             _groupId = groupId;
228         }
229     }
230 
231     public long getCompanyId() {
232         return _companyId;
233     }
234 
235     public void setCompanyId(long companyId) {
236         if (companyId != _companyId) {
237             _companyId = companyId;
238         }
239     }
240 
241     public long getUserId() {
242         return _userId;
243     }
244 
245     public void setUserId(long userId) {
246         if (userId != _userId) {
247             _userId = userId;
248         }
249     }
250 
251     public String getUserName() {
252         return GetterUtil.getString(_userName);
253     }
254 
255     public void setUserName(String userName) {
256         if (((userName == null) && (_userName != null)) ||
257                 ((userName != null) && (_userName == null)) ||
258                 ((userName != null) && (_userName != null) &&
259                 !userName.equals(_userName))) {
260             _userName = userName;
261         }
262     }
263 
264     public Date getCreateDate() {
265         return _createDate;
266     }
267 
268     public void setCreateDate(Date createDate) {
269         if (((createDate == null) && (_createDate != null)) ||
270                 ((createDate != null) && (_createDate == null)) ||
271                 ((createDate != null) && (_createDate != null) &&
272                 !createDate.equals(_createDate))) {
273             _createDate = createDate;
274         }
275     }
276 
277     public Date getModifiedDate() {
278         return _modifiedDate;
279     }
280 
281     public void setModifiedDate(Date modifiedDate) {
282         if (((modifiedDate == null) && (_modifiedDate != null)) ||
283                 ((modifiedDate != null) && (_modifiedDate == null)) ||
284                 ((modifiedDate != null) && (_modifiedDate != null) &&
285                 !modifiedDate.equals(_modifiedDate))) {
286             _modifiedDate = modifiedDate;
287         }
288     }
289 
290     public String getFeedId() {
291         return GetterUtil.getString(_feedId);
292     }
293 
294     public void setFeedId(String feedId) {
295         if (((feedId == null) && (_feedId != null)) ||
296                 ((feedId != null) && (_feedId == null)) ||
297                 ((feedId != null) && (_feedId != null) &&
298                 !feedId.equals(_feedId))) {
299             _feedId = feedId;
300         }
301     }
302 
303     public String getName() {
304         return GetterUtil.getString(_name);
305     }
306 
307     public void setName(String name) {
308         if (((name == null) && (_name != null)) ||
309                 ((name != null) && (_name == null)) ||
310                 ((name != null) && (_name != null) && !name.equals(_name))) {
311             _name = name;
312         }
313     }
314 
315     public String getDescription() {
316         return GetterUtil.getString(_description);
317     }
318 
319     public void setDescription(String description) {
320         if (((description == null) && (_description != null)) ||
321                 ((description != null) && (_description == null)) ||
322                 ((description != null) && (_description != null) &&
323                 !description.equals(_description))) {
324             _description = description;
325         }
326     }
327 
328     public String getType() {
329         return GetterUtil.getString(_type);
330     }
331 
332     public void setType(String type) {
333         if (((type == null) && (_type != null)) ||
334                 ((type != null) && (_type == null)) ||
335                 ((type != null) && (_type != null) && !type.equals(_type))) {
336             _type = type;
337         }
338     }
339 
340     public String getStructureId() {
341         return GetterUtil.getString(_structureId);
342     }
343 
344     public void setStructureId(String structureId) {
345         if (((structureId == null) && (_structureId != null)) ||
346                 ((structureId != null) && (_structureId == null)) ||
347                 ((structureId != null) && (_structureId != null) &&
348                 !structureId.equals(_structureId))) {
349             _structureId = structureId;
350         }
351     }
352 
353     public String getTemplateId() {
354         return GetterUtil.getString(_templateId);
355     }
356 
357     public void setTemplateId(String templateId) {
358         if (((templateId == null) && (_templateId != null)) ||
359                 ((templateId != null) && (_templateId == null)) ||
360                 ((templateId != null) && (_templateId != null) &&
361                 !templateId.equals(_templateId))) {
362             _templateId = templateId;
363         }
364     }
365 
366     public String getRendererTemplateId() {
367         return GetterUtil.getString(_rendererTemplateId);
368     }
369 
370     public void setRendererTemplateId(String rendererTemplateId) {
371         if (((rendererTemplateId == null) && (_rendererTemplateId != null)) ||
372                 ((rendererTemplateId != null) && (_rendererTemplateId == null)) ||
373                 ((rendererTemplateId != null) && (_rendererTemplateId != null) &&
374                 !rendererTemplateId.equals(_rendererTemplateId))) {
375             _rendererTemplateId = rendererTemplateId;
376         }
377     }
378 
379     public int getDelta() {
380         return _delta;
381     }
382 
383     public void setDelta(int delta) {
384         if (delta != _delta) {
385             _delta = delta;
386         }
387     }
388 
389     public String getOrderByCol() {
390         return GetterUtil.getString(_orderByCol);
391     }
392 
393     public void setOrderByCol(String orderByCol) {
394         if (((orderByCol == null) && (_orderByCol != null)) ||
395                 ((orderByCol != null) && (_orderByCol == null)) ||
396                 ((orderByCol != null) && (_orderByCol != null) &&
397                 !orderByCol.equals(_orderByCol))) {
398             _orderByCol = orderByCol;
399         }
400     }
401 
402     public String getOrderByType() {
403         return GetterUtil.getString(_orderByType);
404     }
405 
406     public void setOrderByType(String orderByType) {
407         if (((orderByType == null) && (_orderByType != null)) ||
408                 ((orderByType != null) && (_orderByType == null)) ||
409                 ((orderByType != null) && (_orderByType != null) &&
410                 !orderByType.equals(_orderByType))) {
411             _orderByType = orderByType;
412         }
413     }
414 
415     public String getTargetLayoutFriendlyUrl() {
416         return GetterUtil.getString(_targetLayoutFriendlyUrl);
417     }
418 
419     public void setTargetLayoutFriendlyUrl(String targetLayoutFriendlyUrl) {
420         if (((targetLayoutFriendlyUrl == null) &&
421                 (_targetLayoutFriendlyUrl != null)) ||
422                 ((targetLayoutFriendlyUrl != null) &&
423                 (_targetLayoutFriendlyUrl == null)) ||
424                 ((targetLayoutFriendlyUrl != null) &&
425                 (_targetLayoutFriendlyUrl != null) &&
426                 !targetLayoutFriendlyUrl.equals(_targetLayoutFriendlyUrl))) {
427             _targetLayoutFriendlyUrl = targetLayoutFriendlyUrl;
428         }
429     }
430 
431     public String getTargetPortletId() {
432         return GetterUtil.getString(_targetPortletId);
433     }
434 
435     public void setTargetPortletId(String targetPortletId) {
436         if (((targetPortletId == null) && (_targetPortletId != null)) ||
437                 ((targetPortletId != null) && (_targetPortletId == null)) ||
438                 ((targetPortletId != null) && (_targetPortletId != null) &&
439                 !targetPortletId.equals(_targetPortletId))) {
440             _targetPortletId = targetPortletId;
441         }
442     }
443 
444     public String getContentField() {
445         return GetterUtil.getString(_contentField);
446     }
447 
448     public void setContentField(String contentField) {
449         if (((contentField == null) && (_contentField != null)) ||
450                 ((contentField != null) && (_contentField == null)) ||
451                 ((contentField != null) && (_contentField != null) &&
452                 !contentField.equals(_contentField))) {
453             _contentField = contentField;
454         }
455     }
456 
457     public String getFeedType() {
458         return GetterUtil.getString(_feedType);
459     }
460 
461     public void setFeedType(String feedType) {
462         if (((feedType == null) && (_feedType != null)) ||
463                 ((feedType != null) && (_feedType == null)) ||
464                 ((feedType != null) && (_feedType != null) &&
465                 !feedType.equals(_feedType))) {
466             _feedType = feedType;
467         }
468     }
469 
470     public double getFeedVersion() {
471         return _feedVersion;
472     }
473 
474     public void setFeedVersion(double feedVersion) {
475         if (feedVersion != _feedVersion) {
476             _feedVersion = feedVersion;
477         }
478     }
479 
480     public JournalFeed toEscapedModel() {
481         if (isEscapedModel()) {
482             return (JournalFeed)this;
483         }
484         else {
485             JournalFeed model = new JournalFeedImpl();
486 
487             model.setEscapedModel(true);
488 
489             model.setUuid(HtmlUtil.escape(getUuid()));
490             model.setId(getId());
491             model.setGroupId(getGroupId());
492             model.setCompanyId(getCompanyId());
493             model.setUserId(getUserId());
494             model.setUserName(HtmlUtil.escape(getUserName()));
495             model.setCreateDate(getCreateDate());
496             model.setModifiedDate(getModifiedDate());
497             model.setFeedId(getFeedId());
498             model.setName(HtmlUtil.escape(getName()));
499             model.setDescription(HtmlUtil.escape(getDescription()));
500             model.setType(HtmlUtil.escape(getType()));
501             model.setStructureId(getStructureId());
502             model.setTemplateId(getTemplateId());
503             model.setRendererTemplateId(HtmlUtil.escape(getRendererTemplateId()));
504             model.setDelta(getDelta());
505             model.setOrderByCol(HtmlUtil.escape(getOrderByCol()));
506             model.setOrderByType(HtmlUtil.escape(getOrderByType()));
507             model.setTargetLayoutFriendlyUrl(HtmlUtil.escape(
508                     getTargetLayoutFriendlyUrl()));
509             model.setTargetPortletId(HtmlUtil.escape(getTargetPortletId()));
510             model.setContentField(HtmlUtil.escape(getContentField()));
511             model.setFeedType(HtmlUtil.escape(getFeedType()));
512             model.setFeedVersion(getFeedVersion());
513 
514             model = (JournalFeed)Proxy.newProxyInstance(JournalFeed.class.getClassLoader(),
515                     new Class[] { JournalFeed.class },
516                     new ReadOnlyBeanHandler(model));
517 
518             return model;
519         }
520     }
521 
522     public Object clone() {
523         JournalFeedImpl clone = new JournalFeedImpl();
524 
525         clone.setUuid(getUuid());
526         clone.setId(getId());
527         clone.setGroupId(getGroupId());
528         clone.setCompanyId(getCompanyId());
529         clone.setUserId(getUserId());
530         clone.setUserName(getUserName());
531         clone.setCreateDate(getCreateDate());
532         clone.setModifiedDate(getModifiedDate());
533         clone.setFeedId(getFeedId());
534         clone.setName(getName());
535         clone.setDescription(getDescription());
536         clone.setType(getType());
537         clone.setStructureId(getStructureId());
538         clone.setTemplateId(getTemplateId());
539         clone.setRendererTemplateId(getRendererTemplateId());
540         clone.setDelta(getDelta());
541         clone.setOrderByCol(getOrderByCol());
542         clone.setOrderByType(getOrderByType());
543         clone.setTargetLayoutFriendlyUrl(getTargetLayoutFriendlyUrl());
544         clone.setTargetPortletId(getTargetPortletId());
545         clone.setContentField(getContentField());
546         clone.setFeedType(getFeedType());
547         clone.setFeedVersion(getFeedVersion());
548 
549         return clone;
550     }
551 
552     public int compareTo(Object obj) {
553         if (obj == null) {
554             return -1;
555         }
556 
557         JournalFeedImpl journalFeed = (JournalFeedImpl)obj;
558 
559         int value = 0;
560 
561         value = getFeedId().compareTo(journalFeed.getFeedId());
562 
563         if (value != 0) {
564             return value;
565         }
566 
567         return 0;
568     }
569 
570     public boolean equals(Object obj) {
571         if (obj == null) {
572             return false;
573         }
574 
575         JournalFeedImpl journalFeed = null;
576 
577         try {
578             journalFeed = (JournalFeedImpl)obj;
579         }
580         catch (ClassCastException cce) {
581             return false;
582         }
583 
584         long pk = journalFeed.getPrimaryKey();
585 
586         if (getPrimaryKey() == pk) {
587             return true;
588         }
589         else {
590             return false;
591         }
592     }
593 
594     public int hashCode() {
595         return (int)getPrimaryKey();
596     }
597 
598     private String _uuid;
599     private long _id;
600     private long _groupId;
601     private long _companyId;
602     private long _userId;
603     private String _userName;
604     private Date _createDate;
605     private Date _modifiedDate;
606     private String _feedId;
607     private String _name;
608     private String _description;
609     private String _type;
610     private String _structureId;
611     private String _templateId;
612     private String _rendererTemplateId;
613     private int _delta;
614     private String _orderByCol;
615     private String _orderByType;
616     private String _targetLayoutFriendlyUrl;
617     private String _targetPortletId;
618     private String _contentField;
619     private String _feedType;
620     private double _feedVersion;
621 }