1
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.JournalArticle;
28 import com.liferay.portlet.journal.model.JournalArticleSoap;
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
60 public class JournalArticleModelImpl extends BaseModelImpl {
61 public static final String TABLE_NAME = "JournalArticle";
62 public static final Object[][] TABLE_COLUMNS = {
63 { "uuid_", new Integer(Types.VARCHAR) },
64
65
66 { "id_", new Integer(Types.BIGINT) },
67
68
69 { "resourcePrimKey", 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 { "articleId", new Integer(Types.VARCHAR) },
91
92
93 { "version", new Integer(Types.DOUBLE) },
94
95
96 { "title", new Integer(Types.VARCHAR) },
97
98
99 { "description", new Integer(Types.VARCHAR) },
100
101
102 { "content", new Integer(Types.CLOB) },
103
104
105 { "type_", new Integer(Types.VARCHAR) },
106
107
108 { "structureId", new Integer(Types.VARCHAR) },
109
110
111 { "templateId", new Integer(Types.VARCHAR) },
112
113
114 { "displayDate", new Integer(Types.TIMESTAMP) },
115
116
117 { "approved", new Integer(Types.BOOLEAN) },
118
119
120 { "approvedByUserId", new Integer(Types.BIGINT) },
121
122
123 { "approvedByUserName", new Integer(Types.VARCHAR) },
124
125
126 { "approvedDate", new Integer(Types.TIMESTAMP) },
127
128
129 { "expired", new Integer(Types.BOOLEAN) },
130
131
132 { "expirationDate", new Integer(Types.TIMESTAMP) },
133
134
135 { "reviewDate", new Integer(Types.TIMESTAMP) },
136
137
138 { "indexable", new Integer(Types.BOOLEAN) },
139
140
141 { "smallImage", new Integer(Types.BOOLEAN) },
142
143
144 { "smallImageId", new Integer(Types.BIGINT) },
145
146
147 { "smallImageURL", new Integer(Types.VARCHAR) }
148 };
149 public static final String TABLE_SQL_CREATE = "create table JournalArticle (uuid_ VARCHAR(75) null,id_ LONG not null primary key,resourcePrimKey LONG,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,articleId VARCHAR(75) null,version DOUBLE,title VARCHAR(100) null,description STRING null,content TEXT null,type_ VARCHAR(75) null,structureId VARCHAR(75) null,templateId VARCHAR(75) null,displayDate DATE null,approved BOOLEAN,approvedByUserId LONG,approvedByUserName VARCHAR(75) null,approvedDate DATE null,expired BOOLEAN,expirationDate DATE null,reviewDate DATE null,indexable BOOLEAN,smallImage BOOLEAN,smallImageId LONG,smallImageURL VARCHAR(75) null)";
150 public static final String TABLE_SQL_DROP = "drop table JournalArticle";
151 public static final String DATA_SOURCE = "liferayDataSource";
152 public static final String SESSION_FACTORY = "liferaySessionFactory";
153 public static final String TX_MANAGER = "liferayTransactionManager";
154 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
155 "value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalArticle"),
156 true);
157
158 public static JournalArticle toModel(JournalArticleSoap soapModel) {
159 JournalArticle model = new JournalArticleImpl();
160
161 model.setUuid(soapModel.getUuid());
162 model.setId(soapModel.getId());
163 model.setResourcePrimKey(soapModel.getResourcePrimKey());
164 model.setGroupId(soapModel.getGroupId());
165 model.setCompanyId(soapModel.getCompanyId());
166 model.setUserId(soapModel.getUserId());
167 model.setUserName(soapModel.getUserName());
168 model.setCreateDate(soapModel.getCreateDate());
169 model.setModifiedDate(soapModel.getModifiedDate());
170 model.setArticleId(soapModel.getArticleId());
171 model.setVersion(soapModel.getVersion());
172 model.setTitle(soapModel.getTitle());
173 model.setDescription(soapModel.getDescription());
174 model.setContent(soapModel.getContent());
175 model.setType(soapModel.getType());
176 model.setStructureId(soapModel.getStructureId());
177 model.setTemplateId(soapModel.getTemplateId());
178 model.setDisplayDate(soapModel.getDisplayDate());
179 model.setApproved(soapModel.getApproved());
180 model.setApprovedByUserId(soapModel.getApprovedByUserId());
181 model.setApprovedByUserName(soapModel.getApprovedByUserName());
182 model.setApprovedDate(soapModel.getApprovedDate());
183 model.setExpired(soapModel.getExpired());
184 model.setExpirationDate(soapModel.getExpirationDate());
185 model.setReviewDate(soapModel.getReviewDate());
186 model.setIndexable(soapModel.getIndexable());
187 model.setSmallImage(soapModel.getSmallImage());
188 model.setSmallImageId(soapModel.getSmallImageId());
189 model.setSmallImageURL(soapModel.getSmallImageURL());
190
191 return model;
192 }
193
194 public static List<JournalArticle> toModels(JournalArticleSoap[] soapModels) {
195 List<JournalArticle> models = new ArrayList<JournalArticle>(soapModels.length);
196
197 for (JournalArticleSoap soapModel : soapModels) {
198 models.add(toModel(soapModel));
199 }
200
201 return models;
202 }
203
204 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
205 "lock.expiration.time.com.liferay.portlet.journal.model.JournalArticle"));
206
207 public JournalArticleModelImpl() {
208 }
209
210 public long getPrimaryKey() {
211 return _id;
212 }
213
214 public void setPrimaryKey(long pk) {
215 setId(pk);
216 }
217
218 public Serializable getPrimaryKeyObj() {
219 return new Long(_id);
220 }
221
222 public String getUuid() {
223 return GetterUtil.getString(_uuid);
224 }
225
226 public void setUuid(String uuid) {
227 if ((uuid != null) && (uuid != _uuid)) {
228 _uuid = uuid;
229 }
230 }
231
232 public long getId() {
233 return _id;
234 }
235
236 public void setId(long id) {
237 if (id != _id) {
238 _id = id;
239 }
240 }
241
242 public long getResourcePrimKey() {
243 return _resourcePrimKey;
244 }
245
246 public void setResourcePrimKey(long resourcePrimKey) {
247 if (resourcePrimKey != _resourcePrimKey) {
248 _resourcePrimKey = resourcePrimKey;
249 }
250 }
251
252 public long getGroupId() {
253 return _groupId;
254 }
255
256 public void setGroupId(long groupId) {
257 if (groupId != _groupId) {
258 _groupId = groupId;
259 }
260 }
261
262 public long getCompanyId() {
263 return _companyId;
264 }
265
266 public void setCompanyId(long companyId) {
267 if (companyId != _companyId) {
268 _companyId = companyId;
269 }
270 }
271
272 public long getUserId() {
273 return _userId;
274 }
275
276 public void setUserId(long userId) {
277 if (userId != _userId) {
278 _userId = userId;
279 }
280 }
281
282 public String getUserName() {
283 return GetterUtil.getString(_userName);
284 }
285
286 public void setUserName(String userName) {
287 if (((userName == null) && (_userName != null)) ||
288 ((userName != null) && (_userName == null)) ||
289 ((userName != null) && (_userName != null) &&
290 !userName.equals(_userName))) {
291 _userName = userName;
292 }
293 }
294
295 public Date getCreateDate() {
296 return _createDate;
297 }
298
299 public void setCreateDate(Date createDate) {
300 if (((createDate == null) && (_createDate != null)) ||
301 ((createDate != null) && (_createDate == null)) ||
302 ((createDate != null) && (_createDate != null) &&
303 !createDate.equals(_createDate))) {
304 _createDate = createDate;
305 }
306 }
307
308 public Date getModifiedDate() {
309 return _modifiedDate;
310 }
311
312 public void setModifiedDate(Date modifiedDate) {
313 if (((modifiedDate == null) && (_modifiedDate != null)) ||
314 ((modifiedDate != null) && (_modifiedDate == null)) ||
315 ((modifiedDate != null) && (_modifiedDate != null) &&
316 !modifiedDate.equals(_modifiedDate))) {
317 _modifiedDate = modifiedDate;
318 }
319 }
320
321 public String getArticleId() {
322 return GetterUtil.getString(_articleId);
323 }
324
325 public void setArticleId(String articleId) {
326 if (((articleId == null) && (_articleId != null)) ||
327 ((articleId != null) && (_articleId == null)) ||
328 ((articleId != null) && (_articleId != null) &&
329 !articleId.equals(_articleId))) {
330 _articleId = articleId;
331 }
332 }
333
334 public double getVersion() {
335 return _version;
336 }
337
338 public void setVersion(double version) {
339 if (version != _version) {
340 _version = version;
341 }
342 }
343
344 public String getTitle() {
345 return GetterUtil.getString(_title);
346 }
347
348 public void setTitle(String title) {
349 if (((title == null) && (_title != null)) ||
350 ((title != null) && (_title == null)) ||
351 ((title != null) && (_title != null) && !title.equals(_title))) {
352 _title = title;
353 }
354 }
355
356 public String getDescription() {
357 return GetterUtil.getString(_description);
358 }
359
360 public void setDescription(String description) {
361 if (((description == null) && (_description != null)) ||
362 ((description != null) && (_description == null)) ||
363 ((description != null) && (_description != null) &&
364 !description.equals(_description))) {
365 _description = description;
366 }
367 }
368
369 public String getContent() {
370 return GetterUtil.getString(_content);
371 }
372
373 public void setContent(String content) {
374 if (((content == null) && (_content != null)) ||
375 ((content != null) && (_content == null)) ||
376 ((content != null) && (_content != null) &&
377 !content.equals(_content))) {
378 _content = content;
379 }
380 }
381
382 public String getType() {
383 return GetterUtil.getString(_type);
384 }
385
386 public void setType(String type) {
387 if (((type == null) && (_type != null)) ||
388 ((type != null) && (_type == null)) ||
389 ((type != null) && (_type != null) && !type.equals(_type))) {
390 _type = type;
391 }
392 }
393
394 public String getStructureId() {
395 return GetterUtil.getString(_structureId);
396 }
397
398 public void setStructureId(String structureId) {
399 if (((structureId == null) && (_structureId != null)) ||
400 ((structureId != null) && (_structureId == null)) ||
401 ((structureId != null) && (_structureId != null) &&
402 !structureId.equals(_structureId))) {
403 _structureId = structureId;
404 }
405 }
406
407 public String getTemplateId() {
408 return GetterUtil.getString(_templateId);
409 }
410
411 public void setTemplateId(String templateId) {
412 if (((templateId == null) && (_templateId != null)) ||
413 ((templateId != null) && (_templateId == null)) ||
414 ((templateId != null) && (_templateId != null) &&
415 !templateId.equals(_templateId))) {
416 _templateId = templateId;
417 }
418 }
419
420 public Date getDisplayDate() {
421 return _displayDate;
422 }
423
424 public void setDisplayDate(Date displayDate) {
425 if (((displayDate == null) && (_displayDate != null)) ||
426 ((displayDate != null) && (_displayDate == null)) ||
427 ((displayDate != null) && (_displayDate != null) &&
428 !displayDate.equals(_displayDate))) {
429 _displayDate = displayDate;
430 }
431 }
432
433 public boolean getApproved() {
434 return _approved;
435 }
436
437 public boolean isApproved() {
438 return _approved;
439 }
440
441 public void setApproved(boolean approved) {
442 if (approved != _approved) {
443 _approved = approved;
444 }
445 }
446
447 public long getApprovedByUserId() {
448 return _approvedByUserId;
449 }
450
451 public void setApprovedByUserId(long approvedByUserId) {
452 if (approvedByUserId != _approvedByUserId) {
453 _approvedByUserId = approvedByUserId;
454 }
455 }
456
457 public String getApprovedByUserName() {
458 return GetterUtil.getString(_approvedByUserName);
459 }
460
461 public void setApprovedByUserName(String approvedByUserName) {
462 if (((approvedByUserName == null) && (_approvedByUserName != null)) ||
463 ((approvedByUserName != null) && (_approvedByUserName == null)) ||
464 ((approvedByUserName != null) && (_approvedByUserName != null) &&
465 !approvedByUserName.equals(_approvedByUserName))) {
466 _approvedByUserName = approvedByUserName;
467 }
468 }
469
470 public Date getApprovedDate() {
471 return _approvedDate;
472 }
473
474 public void setApprovedDate(Date approvedDate) {
475 if (((approvedDate == null) && (_approvedDate != null)) ||
476 ((approvedDate != null) && (_approvedDate == null)) ||
477 ((approvedDate != null) && (_approvedDate != null) &&
478 !approvedDate.equals(_approvedDate))) {
479 _approvedDate = approvedDate;
480 }
481 }
482
483 public boolean getExpired() {
484 return _expired;
485 }
486
487 public boolean isExpired() {
488 return _expired;
489 }
490
491 public void setExpired(boolean expired) {
492 if (expired != _expired) {
493 _expired = expired;
494 }
495 }
496
497 public Date getExpirationDate() {
498 return _expirationDate;
499 }
500
501 public void setExpirationDate(Date expirationDate) {
502 if (((expirationDate == null) && (_expirationDate != null)) ||
503 ((expirationDate != null) && (_expirationDate == null)) ||
504 ((expirationDate != null) && (_expirationDate != null) &&
505 !expirationDate.equals(_expirationDate))) {
506 _expirationDate = expirationDate;
507 }
508 }
509
510 public Date getReviewDate() {
511 return _reviewDate;
512 }
513
514 public void setReviewDate(Date reviewDate) {
515 if (((reviewDate == null) && (_reviewDate != null)) ||
516 ((reviewDate != null) && (_reviewDate == null)) ||
517 ((reviewDate != null) && (_reviewDate != null) &&
518 !reviewDate.equals(_reviewDate))) {
519 _reviewDate = reviewDate;
520 }
521 }
522
523 public boolean getIndexable() {
524 return _indexable;
525 }
526
527 public boolean isIndexable() {
528 return _indexable;
529 }
530
531 public void setIndexable(boolean indexable) {
532 if (indexable != _indexable) {
533 _indexable = indexable;
534 }
535 }
536
537 public boolean getSmallImage() {
538 return _smallImage;
539 }
540
541 public boolean isSmallImage() {
542 return _smallImage;
543 }
544
545 public void setSmallImage(boolean smallImage) {
546 if (smallImage != _smallImage) {
547 _smallImage = smallImage;
548 }
549 }
550
551 public long getSmallImageId() {
552 return _smallImageId;
553 }
554
555 public void setSmallImageId(long smallImageId) {
556 if (smallImageId != _smallImageId) {
557 _smallImageId = smallImageId;
558 }
559 }
560
561 public String getSmallImageURL() {
562 return GetterUtil.getString(_smallImageURL);
563 }
564
565 public void setSmallImageURL(String smallImageURL) {
566 if (((smallImageURL == null) && (_smallImageURL != null)) ||
567 ((smallImageURL != null) && (_smallImageURL == null)) ||
568 ((smallImageURL != null) && (_smallImageURL != null) &&
569 !smallImageURL.equals(_smallImageURL))) {
570 _smallImageURL = smallImageURL;
571 }
572 }
573
574 public JournalArticle toEscapedModel() {
575 if (isEscapedModel()) {
576 return (JournalArticle)this;
577 }
578 else {
579 JournalArticle model = new JournalArticleImpl();
580
581 model.setNew(isNew());
582 model.setEscapedModel(true);
583
584 model.setUuid(HtmlUtil.escape(getUuid()));
585 model.setId(getId());
586 model.setResourcePrimKey(getResourcePrimKey());
587 model.setGroupId(getGroupId());
588 model.setCompanyId(getCompanyId());
589 model.setUserId(getUserId());
590 model.setUserName(HtmlUtil.escape(getUserName()));
591 model.setCreateDate(getCreateDate());
592 model.setModifiedDate(getModifiedDate());
593 model.setArticleId(getArticleId());
594 model.setVersion(getVersion());
595 model.setTitle(HtmlUtil.escape(getTitle()));
596 model.setDescription(HtmlUtil.escape(getDescription()));
597 model.setContent(HtmlUtil.escape(getContent()));
598 model.setType(HtmlUtil.escape(getType()));
599 model.setStructureId(getStructureId());
600 model.setTemplateId(getTemplateId());
601 model.setDisplayDate(getDisplayDate());
602 model.setApproved(getApproved());
603 model.setApprovedByUserId(getApprovedByUserId());
604 model.setApprovedByUserName(HtmlUtil.escape(getApprovedByUserName()));
605 model.setApprovedDate(getApprovedDate());
606 model.setExpired(getExpired());
607 model.setExpirationDate(getExpirationDate());
608 model.setReviewDate(getReviewDate());
609 model.setIndexable(getIndexable());
610 model.setSmallImage(getSmallImage());
611 model.setSmallImageId(getSmallImageId());
612 model.setSmallImageURL(HtmlUtil.escape(getSmallImageURL()));
613
614 model = (JournalArticle)Proxy.newProxyInstance(JournalArticle.class.getClassLoader(),
615 new Class[] { JournalArticle.class },
616 new ReadOnlyBeanHandler(model));
617
618 return model;
619 }
620 }
621
622 public Object clone() {
623 JournalArticleImpl clone = new JournalArticleImpl();
624
625 clone.setUuid(getUuid());
626 clone.setId(getId());
627 clone.setResourcePrimKey(getResourcePrimKey());
628 clone.setGroupId(getGroupId());
629 clone.setCompanyId(getCompanyId());
630 clone.setUserId(getUserId());
631 clone.setUserName(getUserName());
632 clone.setCreateDate(getCreateDate());
633 clone.setModifiedDate(getModifiedDate());
634 clone.setArticleId(getArticleId());
635 clone.setVersion(getVersion());
636 clone.setTitle(getTitle());
637 clone.setDescription(getDescription());
638 clone.setContent(getContent());
639 clone.setType(getType());
640 clone.setStructureId(getStructureId());
641 clone.setTemplateId(getTemplateId());
642 clone.setDisplayDate(getDisplayDate());
643 clone.setApproved(getApproved());
644 clone.setApprovedByUserId(getApprovedByUserId());
645 clone.setApprovedByUserName(getApprovedByUserName());
646 clone.setApprovedDate(getApprovedDate());
647 clone.setExpired(getExpired());
648 clone.setExpirationDate(getExpirationDate());
649 clone.setReviewDate(getReviewDate());
650 clone.setIndexable(getIndexable());
651 clone.setSmallImage(getSmallImage());
652 clone.setSmallImageId(getSmallImageId());
653 clone.setSmallImageURL(getSmallImageURL());
654
655 return clone;
656 }
657
658 public int compareTo(Object obj) {
659 if (obj == null) {
660 return -1;
661 }
662
663 JournalArticleImpl journalArticle = (JournalArticleImpl)obj;
664
665 int value = 0;
666
667 value = getArticleId().compareTo(journalArticle.getArticleId());
668
669 if (value != 0) {
670 return value;
671 }
672
673 if (getVersion() < journalArticle.getVersion()) {
674 value = -1;
675 }
676 else if (getVersion() > journalArticle.getVersion()) {
677 value = 1;
678 }
679 else {
680 value = 0;
681 }
682
683 value = value * -1;
684
685 if (value != 0) {
686 return value;
687 }
688
689 return 0;
690 }
691
692 public boolean equals(Object obj) {
693 if (obj == null) {
694 return false;
695 }
696
697 JournalArticleImpl journalArticle = null;
698
699 try {
700 journalArticle = (JournalArticleImpl)obj;
701 }
702 catch (ClassCastException cce) {
703 return false;
704 }
705
706 long pk = journalArticle.getPrimaryKey();
707
708 if (getPrimaryKey() == pk) {
709 return true;
710 }
711 else {
712 return false;
713 }
714 }
715
716 public int hashCode() {
717 return (int)getPrimaryKey();
718 }
719
720 private String _uuid;
721 private long _id;
722 private long _resourcePrimKey;
723 private long _groupId;
724 private long _companyId;
725 private long _userId;
726 private String _userName;
727 private Date _createDate;
728 private Date _modifiedDate;
729 private String _articleId;
730 private double _version;
731 private String _title;
732 private String _description;
733 private String _content;
734 private String _type;
735 private String _structureId;
736 private String _templateId;
737 private Date _displayDate;
738 private boolean _approved;
739 private long _approvedByUserId;
740 private String _approvedByUserName;
741 private Date _approvedDate;
742 private boolean _expired;
743 private Date _expirationDate;
744 private Date _reviewDate;
745 private boolean _indexable;
746 private boolean _smallImage;
747 private long _smallImageId;
748 private String _smallImageURL;
749 }