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