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