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