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