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