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.journal.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.journal.model.JournalFeed;
28  import com.liferay.portlet.journal.model.JournalFeedSoap;
29  
30  import java.io.Serializable;
31  
32  import java.lang.reflect.Proxy;
33  
34  import java.sql.Types;
35  
36  import java.util.ArrayList;
37  import java.util.Date;
38  import java.util.List;
39  
40  /**
41   * <a href="JournalFeedModelImpl.java.html"><b><i>View Source</i></b></a>
42   *
43   * <p>
44   * ServiceBuilder generated this class. Modifications in this class will be
45   * overwritten the next time is generated.
46   * </p>
47   *
48   * <p>
49   * This class is a model that represents the <code>JournalFeed</code> table
50   * in the database.
51   * </p>
52   *
53   * @author Brian Wing Shun Chan
54   *
55   * @see com.liferay.portlet.journal.model.JournalFeed
56   * @see com.liferay.portlet.journal.model.JournalFeedModel
57   * @see com.liferay.portlet.journal.model.impl.JournalFeedImpl
58   *
59   */
60  public class JournalFeedModelImpl extends BaseModelImpl {
61      public static final String TABLE_NAME = "JournalFeed";
62      public static final Object[][] TABLE_COLUMNS = {
63              { "uuid_", new Integer(Types.VARCHAR) },
64              
65  
66              { "id_", new Integer(Types.BIGINT) },
67              
68  
69              { "groupId", new Integer(Types.BIGINT) },
70              
71  
72              { "companyId", new Integer(Types.BIGINT) },
73              
74  
75              { "userId", new Integer(Types.BIGINT) },
76              
77  
78              { "userName", new Integer(Types.VARCHAR) },
79              
80  
81              { "createDate", new Integer(Types.TIMESTAMP) },
82              
83  
84              { "modifiedDate", new Integer(Types.TIMESTAMP) },
85              
86  
87              { "feedId", new Integer(Types.VARCHAR) },
88              
89  
90              { "name", new Integer(Types.VARCHAR) },
91              
92  
93              { "description", new Integer(Types.VARCHAR) },
94              
95  
96              { "type_", new Integer(Types.VARCHAR) },
97              
98  
99              { "structureId", new Integer(Types.VARCHAR) },
100             
101 
102             { "templateId", new Integer(Types.VARCHAR) },
103             
104 
105             { "rendererTemplateId", new Integer(Types.VARCHAR) },
106             
107 
108             { "delta", new Integer(Types.INTEGER) },
109             
110 
111             { "orderByCol", new Integer(Types.VARCHAR) },
112             
113 
114             { "orderByType", new Integer(Types.VARCHAR) },
115             
116 
117             { "targetLayoutFriendlyUrl", new Integer(Types.VARCHAR) },
118             
119 
120             { "targetPortletId", new Integer(Types.VARCHAR) },
121             
122 
123             { "contentField", new Integer(Types.VARCHAR) },
124             
125 
126             { "feedType", new Integer(Types.VARCHAR) },
127             
128 
129             { "feedVersion", new Integer(Types.DOUBLE) }
130         };
131     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)";
132     public static final String TABLE_SQL_DROP = "drop table JournalFeed";
133     public static final String DATA_SOURCE = "liferayDataSource";
134     public static final String SESSION_FACTORY = "liferaySessionFactory";
135     public static final String TX_MANAGER = "liferayTransactionManager";
136     public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
137                 "value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalFeed"),
138             true);
139 
140     public static JournalFeed toModel(JournalFeedSoap soapModel) {
141         JournalFeed model = new JournalFeedImpl();
142 
143         model.setUuid(soapModel.getUuid());
144         model.setId(soapModel.getId());
145         model.setGroupId(soapModel.getGroupId());
146         model.setCompanyId(soapModel.getCompanyId());
147         model.setUserId(soapModel.getUserId());
148         model.setUserName(soapModel.getUserName());
149         model.setCreateDate(soapModel.getCreateDate());
150         model.setModifiedDate(soapModel.getModifiedDate());
151         model.setFeedId(soapModel.getFeedId());
152         model.setName(soapModel.getName());
153         model.setDescription(soapModel.getDescription());
154         model.setType(soapModel.getType());
155         model.setStructureId(soapModel.getStructureId());
156         model.setTemplateId(soapModel.getTemplateId());
157         model.setRendererTemplateId(soapModel.getRendererTemplateId());
158         model.setDelta(soapModel.getDelta());
159         model.setOrderByCol(soapModel.getOrderByCol());
160         model.setOrderByType(soapModel.getOrderByType());
161         model.setTargetLayoutFriendlyUrl(soapModel.getTargetLayoutFriendlyUrl());
162         model.setTargetPortletId(soapModel.getTargetPortletId());
163         model.setContentField(soapModel.getContentField());
164         model.setFeedType(soapModel.getFeedType());
165         model.setFeedVersion(soapModel.getFeedVersion());
166 
167         return model;
168     }
169 
170     public static List<JournalFeed> toModels(JournalFeedSoap[] soapModels) {
171         List<JournalFeed> models = new ArrayList<JournalFeed>(soapModels.length);
172 
173         for (JournalFeedSoap soapModel : soapModels) {
174             models.add(toModel(soapModel));
175         }
176 
177         return models;
178     }
179 
180     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
181                 "lock.expiration.time.com.liferay.portlet.journal.model.JournalFeed"));
182 
183     public JournalFeedModelImpl() {
184     }
185 
186     public long getPrimaryKey() {
187         return _id;
188     }
189 
190     public void setPrimaryKey(long pk) {
191         setId(pk);
192     }
193 
194     public Serializable getPrimaryKeyObj() {
195         return new Long(_id);
196     }
197 
198     public String getUuid() {
199         return GetterUtil.getString(_uuid);
200     }
201 
202     public void setUuid(String uuid) {
203         if ((uuid != null) && (uuid != _uuid)) {
204             _uuid = uuid;
205         }
206     }
207 
208     public long getId() {
209         return _id;
210     }
211 
212     public void setId(long id) {
213         if (id != _id) {
214             _id = id;
215         }
216     }
217 
218     public long getGroupId() {
219         return _groupId;
220     }
221 
222     public void setGroupId(long groupId) {
223         if (groupId != _groupId) {
224             _groupId = groupId;
225         }
226     }
227 
228     public long getCompanyId() {
229         return _companyId;
230     }
231 
232     public void setCompanyId(long companyId) {
233         if (companyId != _companyId) {
234             _companyId = companyId;
235         }
236     }
237 
238     public long getUserId() {
239         return _userId;
240     }
241 
242     public void setUserId(long userId) {
243         if (userId != _userId) {
244             _userId = userId;
245         }
246     }
247 
248     public String getUserName() {
249         return GetterUtil.getString(_userName);
250     }
251 
252     public void setUserName(String userName) {
253         if (((userName == null) && (_userName != null)) ||
254                 ((userName != null) && (_userName == null)) ||
255                 ((userName != null) && (_userName != null) &&
256                 !userName.equals(_userName))) {
257             _userName = userName;
258         }
259     }
260 
261     public Date getCreateDate() {
262         return _createDate;
263     }
264 
265     public void setCreateDate(Date createDate) {
266         if (((createDate == null) && (_createDate != null)) ||
267                 ((createDate != null) && (_createDate == null)) ||
268                 ((createDate != null) && (_createDate != null) &&
269                 !createDate.equals(_createDate))) {
270             _createDate = createDate;
271         }
272     }
273 
274     public Date getModifiedDate() {
275         return _modifiedDate;
276     }
277 
278     public void setModifiedDate(Date modifiedDate) {
279         if (((modifiedDate == null) && (_modifiedDate != null)) ||
280                 ((modifiedDate != null) && (_modifiedDate == null)) ||
281                 ((modifiedDate != null) && (_modifiedDate != null) &&
282                 !modifiedDate.equals(_modifiedDate))) {
283             _modifiedDate = modifiedDate;
284         }
285     }
286 
287     public String getFeedId() {
288         return GetterUtil.getString(_feedId);
289     }
290 
291     public void setFeedId(String feedId) {
292         if (((feedId == null) && (_feedId != null)) ||
293                 ((feedId != null) && (_feedId == null)) ||
294                 ((feedId != null) && (_feedId != null) &&
295                 !feedId.equals(_feedId))) {
296             _feedId = feedId;
297         }
298     }
299 
300     public String getName() {
301         return GetterUtil.getString(_name);
302     }
303 
304     public void setName(String name) {
305         if (((name == null) && (_name != null)) ||
306                 ((name != null) && (_name == null)) ||
307                 ((name != null) && (_name != null) && !name.equals(_name))) {
308             _name = name;
309         }
310     }
311 
312     public String getDescription() {
313         return GetterUtil.getString(_description);
314     }
315 
316     public void setDescription(String description) {
317         if (((description == null) && (_description != null)) ||
318                 ((description != null) && (_description == null)) ||
319                 ((description != null) && (_description != null) &&
320                 !description.equals(_description))) {
321             _description = description;
322         }
323     }
324 
325     public String getType() {
326         return GetterUtil.getString(_type);
327     }
328 
329     public void setType(String type) {
330         if (((type == null) && (_type != null)) ||
331                 ((type != null) && (_type == null)) ||
332                 ((type != null) && (_type != null) && !type.equals(_type))) {
333             _type = type;
334         }
335     }
336 
337     public String getStructureId() {
338         return GetterUtil.getString(_structureId);
339     }
340 
341     public void setStructureId(String structureId) {
342         if (((structureId == null) && (_structureId != null)) ||
343                 ((structureId != null) && (_structureId == null)) ||
344                 ((structureId != null) && (_structureId != null) &&
345                 !structureId.equals(_structureId))) {
346             _structureId = structureId;
347         }
348     }
349 
350     public String getTemplateId() {
351         return GetterUtil.getString(_templateId);
352     }
353 
354     public void setTemplateId(String templateId) {
355         if (((templateId == null) && (_templateId != null)) ||
356                 ((templateId != null) && (_templateId == null)) ||
357                 ((templateId != null) && (_templateId != null) &&
358                 !templateId.equals(_templateId))) {
359             _templateId = templateId;
360         }
361     }
362 
363     public String getRendererTemplateId() {
364         return GetterUtil.getString(_rendererTemplateId);
365     }
366 
367     public void setRendererTemplateId(String rendererTemplateId) {
368         if (((rendererTemplateId == null) && (_rendererTemplateId != null)) ||
369                 ((rendererTemplateId != null) && (_rendererTemplateId == null)) ||
370                 ((rendererTemplateId != null) && (_rendererTemplateId != null) &&
371                 !rendererTemplateId.equals(_rendererTemplateId))) {
372             _rendererTemplateId = rendererTemplateId;
373         }
374     }
375 
376     public int getDelta() {
377         return _delta;
378     }
379 
380     public void setDelta(int delta) {
381         if (delta != _delta) {
382             _delta = delta;
383         }
384     }
385 
386     public String getOrderByCol() {
387         return GetterUtil.getString(_orderByCol);
388     }
389 
390     public void setOrderByCol(String orderByCol) {
391         if (((orderByCol == null) && (_orderByCol != null)) ||
392                 ((orderByCol != null) && (_orderByCol == null)) ||
393                 ((orderByCol != null) && (_orderByCol != null) &&
394                 !orderByCol.equals(_orderByCol))) {
395             _orderByCol = orderByCol;
396         }
397     }
398 
399     public String getOrderByType() {
400         return GetterUtil.getString(_orderByType);
401     }
402 
403     public void setOrderByType(String orderByType) {
404         if (((orderByType == null) && (_orderByType != null)) ||
405                 ((orderByType != null) && (_orderByType == null)) ||
406                 ((orderByType != null) && (_orderByType != null) &&
407                 !orderByType.equals(_orderByType))) {
408             _orderByType = orderByType;
409         }
410     }
411 
412     public String getTargetLayoutFriendlyUrl() {
413         return GetterUtil.getString(_targetLayoutFriendlyUrl);
414     }
415 
416     public void setTargetLayoutFriendlyUrl(String targetLayoutFriendlyUrl) {
417         if (((targetLayoutFriendlyUrl == null) &&
418                 (_targetLayoutFriendlyUrl != null)) ||
419                 ((targetLayoutFriendlyUrl != null) &&
420                 (_targetLayoutFriendlyUrl == null)) ||
421                 ((targetLayoutFriendlyUrl != null) &&
422                 (_targetLayoutFriendlyUrl != null) &&
423                 !targetLayoutFriendlyUrl.equals(_targetLayoutFriendlyUrl))) {
424             _targetLayoutFriendlyUrl = targetLayoutFriendlyUrl;
425         }
426     }
427 
428     public String getTargetPortletId() {
429         return GetterUtil.getString(_targetPortletId);
430     }
431 
432     public void setTargetPortletId(String targetPortletId) {
433         if (((targetPortletId == null) && (_targetPortletId != null)) ||
434                 ((targetPortletId != null) && (_targetPortletId == null)) ||
435                 ((targetPortletId != null) && (_targetPortletId != null) &&
436                 !targetPortletId.equals(_targetPortletId))) {
437             _targetPortletId = targetPortletId;
438         }
439     }
440 
441     public String getContentField() {
442         return GetterUtil.getString(_contentField);
443     }
444 
445     public void setContentField(String contentField) {
446         if (((contentField == null) && (_contentField != null)) ||
447                 ((contentField != null) && (_contentField == null)) ||
448                 ((contentField != null) && (_contentField != null) &&
449                 !contentField.equals(_contentField))) {
450             _contentField = contentField;
451         }
452     }
453 
454     public String getFeedType() {
455         return GetterUtil.getString(_feedType);
456     }
457 
458     public void setFeedType(String feedType) {
459         if (((feedType == null) && (_feedType != null)) ||
460                 ((feedType != null) && (_feedType == null)) ||
461                 ((feedType != null) && (_feedType != null) &&
462                 !feedType.equals(_feedType))) {
463             _feedType = feedType;
464         }
465     }
466 
467     public double getFeedVersion() {
468         return _feedVersion;
469     }
470 
471     public void setFeedVersion(double feedVersion) {
472         if (feedVersion != _feedVersion) {
473             _feedVersion = feedVersion;
474         }
475     }
476 
477     public JournalFeed toEscapedModel() {
478         if (isEscapedModel()) {
479             return (JournalFeed)this;
480         }
481         else {
482             JournalFeed model = new JournalFeedImpl();
483 
484             model.setNew(isNew());
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 }