001
014
015 package com.liferay.portlet.messageboards.model.impl;
016
017 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.json.JSON;
020 import com.liferay.portal.kernel.util.DateUtil;
021 import com.liferay.portal.kernel.util.GetterUtil;
022 import com.liferay.portal.kernel.util.ProxyUtil;
023 import com.liferay.portal.kernel.util.StringBundler;
024 import com.liferay.portal.kernel.util.StringPool;
025 import com.liferay.portal.kernel.util.Validator;
026 import com.liferay.portal.kernel.workflow.WorkflowConstants;
027 import com.liferay.portal.model.CacheModel;
028 import com.liferay.portal.model.impl.BaseModelImpl;
029 import com.liferay.portal.service.ServiceContext;
030 import com.liferay.portal.util.PortalUtil;
031
032 import com.liferay.portlet.expando.model.ExpandoBridge;
033 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
034 import com.liferay.portlet.messageboards.model.MBMessage;
035 import com.liferay.portlet.messageboards.model.MBMessageModel;
036 import com.liferay.portlet.messageboards.model.MBMessageSoap;
037
038 import java.io.Serializable;
039
040 import java.sql.Types;
041
042 import java.util.ArrayList;
043 import java.util.Date;
044 import java.util.HashMap;
045 import java.util.List;
046 import java.util.Map;
047
048
061 @JSON(strict = true)
062 public class MBMessageModelImpl extends BaseModelImpl<MBMessage>
063 implements MBMessageModel {
064
069 public static final String TABLE_NAME = "MBMessage";
070 public static final Object[][] TABLE_COLUMNS = {
071 { "uuid_", Types.VARCHAR },
072 { "messageId", Types.BIGINT },
073 { "groupId", Types.BIGINT },
074 { "companyId", Types.BIGINT },
075 { "userId", Types.BIGINT },
076 { "userName", Types.VARCHAR },
077 { "createDate", Types.TIMESTAMP },
078 { "modifiedDate", Types.TIMESTAMP },
079 { "classNameId", Types.BIGINT },
080 { "classPK", Types.BIGINT },
081 { "categoryId", Types.BIGINT },
082 { "threadId", Types.BIGINT },
083 { "rootMessageId", Types.BIGINT },
084 { "parentMessageId", Types.BIGINT },
085 { "subject", Types.VARCHAR },
086 { "body", Types.CLOB },
087 { "format", Types.VARCHAR },
088 { "attachments", Types.BOOLEAN },
089 { "anonymous", Types.BOOLEAN },
090 { "priority", Types.DOUBLE },
091 { "allowPingbacks", Types.BOOLEAN },
092 { "answer", Types.BOOLEAN },
093 { "status", Types.INTEGER },
094 { "statusByUserId", Types.BIGINT },
095 { "statusByUserName", Types.VARCHAR },
096 { "statusDate", Types.TIMESTAMP }
097 };
098 public static final String TABLE_SQL_CREATE = "create table MBMessage (uuid_ VARCHAR(75) null,messageId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,classNameId LONG,classPK LONG,categoryId LONG,threadId LONG,rootMessageId LONG,parentMessageId LONG,subject VARCHAR(75) null,body TEXT null,format VARCHAR(75) null,attachments BOOLEAN,anonymous BOOLEAN,priority DOUBLE,allowPingbacks BOOLEAN,answer BOOLEAN,status INTEGER,statusByUserId LONG,statusByUserName VARCHAR(75) null,statusDate DATE null)";
099 public static final String TABLE_SQL_DROP = "drop table MBMessage";
100 public static final String ORDER_BY_JPQL = " ORDER BY mbMessage.createDate ASC, mbMessage.messageId ASC";
101 public static final String ORDER_BY_SQL = " ORDER BY MBMessage.createDate ASC, MBMessage.messageId ASC";
102 public static final String DATA_SOURCE = "liferayDataSource";
103 public static final String SESSION_FACTORY = "liferaySessionFactory";
104 public static final String TX_MANAGER = "liferayTransactionManager";
105 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
106 "value.object.entity.cache.enabled.com.liferay.portlet.messageboards.model.MBMessage"),
107 true);
108 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
109 "value.object.finder.cache.enabled.com.liferay.portlet.messageboards.model.MBMessage"),
110 true);
111 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
112 "value.object.column.bitmask.enabled.com.liferay.portlet.messageboards.model.MBMessage"),
113 true);
114 public static long ANSWER_COLUMN_BITMASK = 1L;
115 public static long CATEGORYID_COLUMN_BITMASK = 2L;
116 public static long CLASSNAMEID_COLUMN_BITMASK = 4L;
117 public static long CLASSPK_COLUMN_BITMASK = 8L;
118 public static long COMPANYID_COLUMN_BITMASK = 16L;
119 public static long GROUPID_COLUMN_BITMASK = 32L;
120 public static long PARENTMESSAGEID_COLUMN_BITMASK = 64L;
121 public static long STATUS_COLUMN_BITMASK = 128L;
122 public static long THREADID_COLUMN_BITMASK = 256L;
123 public static long USERID_COLUMN_BITMASK = 512L;
124 public static long UUID_COLUMN_BITMASK = 1024L;
125
126
132 public static MBMessage toModel(MBMessageSoap soapModel) {
133 if (soapModel == null) {
134 return null;
135 }
136
137 MBMessage model = new MBMessageImpl();
138
139 model.setUuid(soapModel.getUuid());
140 model.setMessageId(soapModel.getMessageId());
141 model.setGroupId(soapModel.getGroupId());
142 model.setCompanyId(soapModel.getCompanyId());
143 model.setUserId(soapModel.getUserId());
144 model.setUserName(soapModel.getUserName());
145 model.setCreateDate(soapModel.getCreateDate());
146 model.setModifiedDate(soapModel.getModifiedDate());
147 model.setClassNameId(soapModel.getClassNameId());
148 model.setClassPK(soapModel.getClassPK());
149 model.setCategoryId(soapModel.getCategoryId());
150 model.setThreadId(soapModel.getThreadId());
151 model.setRootMessageId(soapModel.getRootMessageId());
152 model.setParentMessageId(soapModel.getParentMessageId());
153 model.setSubject(soapModel.getSubject());
154 model.setBody(soapModel.getBody());
155 model.setFormat(soapModel.getFormat());
156 model.setAttachments(soapModel.getAttachments());
157 model.setAnonymous(soapModel.getAnonymous());
158 model.setPriority(soapModel.getPriority());
159 model.setAllowPingbacks(soapModel.getAllowPingbacks());
160 model.setAnswer(soapModel.getAnswer());
161 model.setStatus(soapModel.getStatus());
162 model.setStatusByUserId(soapModel.getStatusByUserId());
163 model.setStatusByUserName(soapModel.getStatusByUserName());
164 model.setStatusDate(soapModel.getStatusDate());
165
166 return model;
167 }
168
169
175 public static List<MBMessage> toModels(MBMessageSoap[] soapModels) {
176 if (soapModels == null) {
177 return null;
178 }
179
180 List<MBMessage> models = new ArrayList<MBMessage>(soapModels.length);
181
182 for (MBMessageSoap soapModel : soapModels) {
183 models.add(toModel(soapModel));
184 }
185
186 return models;
187 }
188
189 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
190 "lock.expiration.time.com.liferay.portlet.messageboards.model.MBMessage"));
191
192 public MBMessageModelImpl() {
193 }
194
195 public long getPrimaryKey() {
196 return _messageId;
197 }
198
199 public void setPrimaryKey(long primaryKey) {
200 setMessageId(primaryKey);
201 }
202
203 public Serializable getPrimaryKeyObj() {
204 return new Long(_messageId);
205 }
206
207 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
208 setPrimaryKey(((Long)primaryKeyObj).longValue());
209 }
210
211 public Class<?> getModelClass() {
212 return MBMessage.class;
213 }
214
215 public String getModelClassName() {
216 return MBMessage.class.getName();
217 }
218
219 @Override
220 public Map<String, Object> getModelAttributes() {
221 Map<String, Object> attributes = new HashMap<String, Object>();
222
223 attributes.put("uuid", getUuid());
224 attributes.put("messageId", getMessageId());
225 attributes.put("groupId", getGroupId());
226 attributes.put("companyId", getCompanyId());
227 attributes.put("userId", getUserId());
228 attributes.put("userName", getUserName());
229 attributes.put("createDate", getCreateDate());
230 attributes.put("modifiedDate", getModifiedDate());
231 attributes.put("classNameId", getClassNameId());
232 attributes.put("classPK", getClassPK());
233 attributes.put("categoryId", getCategoryId());
234 attributes.put("threadId", getThreadId());
235 attributes.put("rootMessageId", getRootMessageId());
236 attributes.put("parentMessageId", getParentMessageId());
237 attributes.put("subject", getSubject());
238 attributes.put("body", getBody());
239 attributes.put("format", getFormat());
240 attributes.put("attachments", getAttachments());
241 attributes.put("anonymous", getAnonymous());
242 attributes.put("priority", getPriority());
243 attributes.put("allowPingbacks", getAllowPingbacks());
244 attributes.put("answer", getAnswer());
245 attributes.put("status", getStatus());
246 attributes.put("statusByUserId", getStatusByUserId());
247 attributes.put("statusByUserName", getStatusByUserName());
248 attributes.put("statusDate", getStatusDate());
249
250 return attributes;
251 }
252
253 @Override
254 public void setModelAttributes(Map<String, Object> attributes) {
255 String uuid = (String)attributes.get("uuid");
256
257 if (uuid != null) {
258 setUuid(uuid);
259 }
260
261 Long messageId = (Long)attributes.get("messageId");
262
263 if (messageId != null) {
264 setMessageId(messageId);
265 }
266
267 Long groupId = (Long)attributes.get("groupId");
268
269 if (groupId != null) {
270 setGroupId(groupId);
271 }
272
273 Long companyId = (Long)attributes.get("companyId");
274
275 if (companyId != null) {
276 setCompanyId(companyId);
277 }
278
279 Long userId = (Long)attributes.get("userId");
280
281 if (userId != null) {
282 setUserId(userId);
283 }
284
285 String userName = (String)attributes.get("userName");
286
287 if (userName != null) {
288 setUserName(userName);
289 }
290
291 Date createDate = (Date)attributes.get("createDate");
292
293 if (createDate != null) {
294 setCreateDate(createDate);
295 }
296
297 Date modifiedDate = (Date)attributes.get("modifiedDate");
298
299 if (modifiedDate != null) {
300 setModifiedDate(modifiedDate);
301 }
302
303 Long classNameId = (Long)attributes.get("classNameId");
304
305 if (classNameId != null) {
306 setClassNameId(classNameId);
307 }
308
309 Long classPK = (Long)attributes.get("classPK");
310
311 if (classPK != null) {
312 setClassPK(classPK);
313 }
314
315 Long categoryId = (Long)attributes.get("categoryId");
316
317 if (categoryId != null) {
318 setCategoryId(categoryId);
319 }
320
321 Long threadId = (Long)attributes.get("threadId");
322
323 if (threadId != null) {
324 setThreadId(threadId);
325 }
326
327 Long rootMessageId = (Long)attributes.get("rootMessageId");
328
329 if (rootMessageId != null) {
330 setRootMessageId(rootMessageId);
331 }
332
333 Long parentMessageId = (Long)attributes.get("parentMessageId");
334
335 if (parentMessageId != null) {
336 setParentMessageId(parentMessageId);
337 }
338
339 String subject = (String)attributes.get("subject");
340
341 if (subject != null) {
342 setSubject(subject);
343 }
344
345 String body = (String)attributes.get("body");
346
347 if (body != null) {
348 setBody(body);
349 }
350
351 String format = (String)attributes.get("format");
352
353 if (format != null) {
354 setFormat(format);
355 }
356
357 Boolean attachments = (Boolean)attributes.get("attachments");
358
359 if (attachments != null) {
360 setAttachments(attachments);
361 }
362
363 Boolean anonymous = (Boolean)attributes.get("anonymous");
364
365 if (anonymous != null) {
366 setAnonymous(anonymous);
367 }
368
369 Double priority = (Double)attributes.get("priority");
370
371 if (priority != null) {
372 setPriority(priority);
373 }
374
375 Boolean allowPingbacks = (Boolean)attributes.get("allowPingbacks");
376
377 if (allowPingbacks != null) {
378 setAllowPingbacks(allowPingbacks);
379 }
380
381 Boolean answer = (Boolean)attributes.get("answer");
382
383 if (answer != null) {
384 setAnswer(answer);
385 }
386
387 Integer status = (Integer)attributes.get("status");
388
389 if (status != null) {
390 setStatus(status);
391 }
392
393 Long statusByUserId = (Long)attributes.get("statusByUserId");
394
395 if (statusByUserId != null) {
396 setStatusByUserId(statusByUserId);
397 }
398
399 String statusByUserName = (String)attributes.get("statusByUserName");
400
401 if (statusByUserName != null) {
402 setStatusByUserName(statusByUserName);
403 }
404
405 Date statusDate = (Date)attributes.get("statusDate");
406
407 if (statusDate != null) {
408 setStatusDate(statusDate);
409 }
410 }
411
412 @JSON
413 public String getUuid() {
414 if (_uuid == null) {
415 return StringPool.BLANK;
416 }
417 else {
418 return _uuid;
419 }
420 }
421
422 public void setUuid(String uuid) {
423 if (_originalUuid == null) {
424 _originalUuid = _uuid;
425 }
426
427 _uuid = uuid;
428 }
429
430 public String getOriginalUuid() {
431 return GetterUtil.getString(_originalUuid);
432 }
433
434 @JSON
435 public long getMessageId() {
436 return _messageId;
437 }
438
439 public void setMessageId(long messageId) {
440 _columnBitmask = -1L;
441
442 _messageId = messageId;
443 }
444
445 @JSON
446 public long getGroupId() {
447 return _groupId;
448 }
449
450 public void setGroupId(long groupId) {
451 _columnBitmask |= GROUPID_COLUMN_BITMASK;
452
453 if (!_setOriginalGroupId) {
454 _setOriginalGroupId = true;
455
456 _originalGroupId = _groupId;
457 }
458
459 _groupId = groupId;
460 }
461
462 public long getOriginalGroupId() {
463 return _originalGroupId;
464 }
465
466 @JSON
467 public long getCompanyId() {
468 return _companyId;
469 }
470
471 public void setCompanyId(long companyId) {
472 _columnBitmask |= COMPANYID_COLUMN_BITMASK;
473
474 if (!_setOriginalCompanyId) {
475 _setOriginalCompanyId = true;
476
477 _originalCompanyId = _companyId;
478 }
479
480 _companyId = companyId;
481 }
482
483 public long getOriginalCompanyId() {
484 return _originalCompanyId;
485 }
486
487 @JSON
488 public long getUserId() {
489 return _userId;
490 }
491
492 public void setUserId(long userId) {
493 _columnBitmask |= USERID_COLUMN_BITMASK;
494
495 if (!_setOriginalUserId) {
496 _setOriginalUserId = true;
497
498 _originalUserId = _userId;
499 }
500
501 _userId = userId;
502 }
503
504 public String getUserUuid() throws SystemException {
505 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
506 }
507
508 public void setUserUuid(String userUuid) {
509 _userUuid = userUuid;
510 }
511
512 public long getOriginalUserId() {
513 return _originalUserId;
514 }
515
516 @JSON
517 public String getUserName() {
518 if (_userName == null) {
519 return StringPool.BLANK;
520 }
521 else {
522 return _userName;
523 }
524 }
525
526 public void setUserName(String userName) {
527 _userName = userName;
528 }
529
530 @JSON
531 public Date getCreateDate() {
532 return _createDate;
533 }
534
535 public void setCreateDate(Date createDate) {
536 _columnBitmask = -1L;
537
538 _createDate = createDate;
539 }
540
541 @JSON
542 public Date getModifiedDate() {
543 return _modifiedDate;
544 }
545
546 public void setModifiedDate(Date modifiedDate) {
547 _modifiedDate = modifiedDate;
548 }
549
550 public String getClassName() {
551 if (getClassNameId() <= 0) {
552 return StringPool.BLANK;
553 }
554
555 return PortalUtil.getClassName(getClassNameId());
556 }
557
558 public void setClassName(String className) {
559 long classNameId = 0;
560
561 if (Validator.isNotNull(className)) {
562 classNameId = PortalUtil.getClassNameId(className);
563 }
564
565 setClassNameId(classNameId);
566 }
567
568 @JSON
569 public long getClassNameId() {
570 return _classNameId;
571 }
572
573 public void setClassNameId(long classNameId) {
574 _columnBitmask |= CLASSNAMEID_COLUMN_BITMASK;
575
576 if (!_setOriginalClassNameId) {
577 _setOriginalClassNameId = true;
578
579 _originalClassNameId = _classNameId;
580 }
581
582 _classNameId = classNameId;
583 }
584
585 public long getOriginalClassNameId() {
586 return _originalClassNameId;
587 }
588
589 @JSON
590 public long getClassPK() {
591 return _classPK;
592 }
593
594 public void setClassPK(long classPK) {
595 _columnBitmask |= CLASSPK_COLUMN_BITMASK;
596
597 if (!_setOriginalClassPK) {
598 _setOriginalClassPK = true;
599
600 _originalClassPK = _classPK;
601 }
602
603 _classPK = classPK;
604 }
605
606 public long getOriginalClassPK() {
607 return _originalClassPK;
608 }
609
610 @JSON
611 public long getCategoryId() {
612 return _categoryId;
613 }
614
615 public void setCategoryId(long categoryId) {
616 _columnBitmask |= CATEGORYID_COLUMN_BITMASK;
617
618 if (!_setOriginalCategoryId) {
619 _setOriginalCategoryId = true;
620
621 _originalCategoryId = _categoryId;
622 }
623
624 _categoryId = categoryId;
625 }
626
627 public long getOriginalCategoryId() {
628 return _originalCategoryId;
629 }
630
631 @JSON
632 public long getThreadId() {
633 return _threadId;
634 }
635
636 public void setThreadId(long threadId) {
637 _columnBitmask |= THREADID_COLUMN_BITMASK;
638
639 if (!_setOriginalThreadId) {
640 _setOriginalThreadId = true;
641
642 _originalThreadId = _threadId;
643 }
644
645 _threadId = threadId;
646 }
647
648 public long getOriginalThreadId() {
649 return _originalThreadId;
650 }
651
652 @JSON
653 public long getRootMessageId() {
654 return _rootMessageId;
655 }
656
657 public void setRootMessageId(long rootMessageId) {
658 _rootMessageId = rootMessageId;
659 }
660
661 @JSON
662 public long getParentMessageId() {
663 return _parentMessageId;
664 }
665
666 public void setParentMessageId(long parentMessageId) {
667 _columnBitmask |= PARENTMESSAGEID_COLUMN_BITMASK;
668
669 if (!_setOriginalParentMessageId) {
670 _setOriginalParentMessageId = true;
671
672 _originalParentMessageId = _parentMessageId;
673 }
674
675 _parentMessageId = parentMessageId;
676 }
677
678 public long getOriginalParentMessageId() {
679 return _originalParentMessageId;
680 }
681
682 @JSON
683 public String getSubject() {
684 if (_subject == null) {
685 return StringPool.BLANK;
686 }
687 else {
688 return _subject;
689 }
690 }
691
692 public void setSubject(String subject) {
693 _subject = subject;
694 }
695
696 @JSON
697 public String getBody() {
698 if (_body == null) {
699 return StringPool.BLANK;
700 }
701 else {
702 return _body;
703 }
704 }
705
706 public void setBody(String body) {
707 _body = body;
708 }
709
710 @JSON
711 public String getFormat() {
712 if (_format == null) {
713 return StringPool.BLANK;
714 }
715 else {
716 return _format;
717 }
718 }
719
720 public void setFormat(String format) {
721 _format = format;
722 }
723
724 @JSON
725 public boolean getAttachments() {
726 return _attachments;
727 }
728
729 public boolean isAttachments() {
730 return _attachments;
731 }
732
733 public void setAttachments(boolean attachments) {
734 _attachments = attachments;
735 }
736
737 @JSON
738 public boolean getAnonymous() {
739 return _anonymous;
740 }
741
742 public boolean isAnonymous() {
743 return _anonymous;
744 }
745
746 public void setAnonymous(boolean anonymous) {
747 _anonymous = anonymous;
748 }
749
750 @JSON
751 public double getPriority() {
752 return _priority;
753 }
754
755 public void setPriority(double priority) {
756 _priority = priority;
757 }
758
759 @JSON
760 public boolean getAllowPingbacks() {
761 return _allowPingbacks;
762 }
763
764 public boolean isAllowPingbacks() {
765 return _allowPingbacks;
766 }
767
768 public void setAllowPingbacks(boolean allowPingbacks) {
769 _allowPingbacks = allowPingbacks;
770 }
771
772 @JSON
773 public boolean getAnswer() {
774 return _answer;
775 }
776
777 public boolean isAnswer() {
778 return _answer;
779 }
780
781 public void setAnswer(boolean answer) {
782 _columnBitmask |= ANSWER_COLUMN_BITMASK;
783
784 if (!_setOriginalAnswer) {
785 _setOriginalAnswer = true;
786
787 _originalAnswer = _answer;
788 }
789
790 _answer = answer;
791 }
792
793 public boolean getOriginalAnswer() {
794 return _originalAnswer;
795 }
796
797 @JSON
798 public int getStatus() {
799 return _status;
800 }
801
802 public void setStatus(int status) {
803 _columnBitmask |= STATUS_COLUMN_BITMASK;
804
805 if (!_setOriginalStatus) {
806 _setOriginalStatus = true;
807
808 _originalStatus = _status;
809 }
810
811 _status = status;
812 }
813
814 public int getOriginalStatus() {
815 return _originalStatus;
816 }
817
818 @JSON
819 public long getStatusByUserId() {
820 return _statusByUserId;
821 }
822
823 public void setStatusByUserId(long statusByUserId) {
824 _statusByUserId = statusByUserId;
825 }
826
827 public String getStatusByUserUuid() throws SystemException {
828 return PortalUtil.getUserValue(getStatusByUserId(), "uuid",
829 _statusByUserUuid);
830 }
831
832 public void setStatusByUserUuid(String statusByUserUuid) {
833 _statusByUserUuid = statusByUserUuid;
834 }
835
836 @JSON
837 public String getStatusByUserName() {
838 if (_statusByUserName == null) {
839 return StringPool.BLANK;
840 }
841 else {
842 return _statusByUserName;
843 }
844 }
845
846 public void setStatusByUserName(String statusByUserName) {
847 _statusByUserName = statusByUserName;
848 }
849
850 @JSON
851 public Date getStatusDate() {
852 return _statusDate;
853 }
854
855 public void setStatusDate(Date statusDate) {
856 _statusDate = statusDate;
857 }
858
859
862 public boolean getApproved() {
863 return isApproved();
864 }
865
866 public boolean isApproved() {
867 if (getStatus() == WorkflowConstants.STATUS_APPROVED) {
868 return true;
869 }
870 else {
871 return false;
872 }
873 }
874
875 public boolean isDenied() {
876 if (getStatus() == WorkflowConstants.STATUS_DENIED) {
877 return true;
878 }
879 else {
880 return false;
881 }
882 }
883
884 public boolean isDraft() {
885 if ((getStatus() == WorkflowConstants.STATUS_DRAFT) ||
886 (getStatus() == WorkflowConstants.STATUS_DRAFT_FROM_APPROVED)) {
887 return true;
888 }
889 else {
890 return false;
891 }
892 }
893
894 public boolean isExpired() {
895 if (getStatus() == WorkflowConstants.STATUS_EXPIRED) {
896 return true;
897 }
898 else {
899 return false;
900 }
901 }
902
903 public boolean isInactive() {
904 if (getStatus() == WorkflowConstants.STATUS_INACTIVE) {
905 return true;
906 }
907 else {
908 return false;
909 }
910 }
911
912 public boolean isIncomplete() {
913 if (getStatus() == WorkflowConstants.STATUS_INCOMPLETE) {
914 return true;
915 }
916 else {
917 return false;
918 }
919 }
920
921 public boolean isPending() {
922 if (getStatus() == WorkflowConstants.STATUS_PENDING) {
923 return true;
924 }
925 else {
926 return false;
927 }
928 }
929
930 public boolean isScheduled() {
931 if (getStatus() == WorkflowConstants.STATUS_SCHEDULED) {
932 return true;
933 }
934 else {
935 return false;
936 }
937 }
938
939 public long getColumnBitmask() {
940 return _columnBitmask;
941 }
942
943 @Override
944 public ExpandoBridge getExpandoBridge() {
945 return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
946 MBMessage.class.getName(), getPrimaryKey());
947 }
948
949 @Override
950 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
951 ExpandoBridge expandoBridge = getExpandoBridge();
952
953 expandoBridge.setAttributes(serviceContext);
954 }
955
956 @Override
957 public MBMessage toEscapedModel() {
958 if (_escapedModel == null) {
959 _escapedModel = (MBMessage)ProxyUtil.newProxyInstance(_classLoader,
960 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
961 }
962
963 return _escapedModel;
964 }
965
966 public MBMessage toUnescapedModel() {
967 return (MBMessage)this;
968 }
969
970 @Override
971 public Object clone() {
972 MBMessageImpl mbMessageImpl = new MBMessageImpl();
973
974 mbMessageImpl.setUuid(getUuid());
975 mbMessageImpl.setMessageId(getMessageId());
976 mbMessageImpl.setGroupId(getGroupId());
977 mbMessageImpl.setCompanyId(getCompanyId());
978 mbMessageImpl.setUserId(getUserId());
979 mbMessageImpl.setUserName(getUserName());
980 mbMessageImpl.setCreateDate(getCreateDate());
981 mbMessageImpl.setModifiedDate(getModifiedDate());
982 mbMessageImpl.setClassNameId(getClassNameId());
983 mbMessageImpl.setClassPK(getClassPK());
984 mbMessageImpl.setCategoryId(getCategoryId());
985 mbMessageImpl.setThreadId(getThreadId());
986 mbMessageImpl.setRootMessageId(getRootMessageId());
987 mbMessageImpl.setParentMessageId(getParentMessageId());
988 mbMessageImpl.setSubject(getSubject());
989 mbMessageImpl.setBody(getBody());
990 mbMessageImpl.setFormat(getFormat());
991 mbMessageImpl.setAttachments(getAttachments());
992 mbMessageImpl.setAnonymous(getAnonymous());
993 mbMessageImpl.setPriority(getPriority());
994 mbMessageImpl.setAllowPingbacks(getAllowPingbacks());
995 mbMessageImpl.setAnswer(getAnswer());
996 mbMessageImpl.setStatus(getStatus());
997 mbMessageImpl.setStatusByUserId(getStatusByUserId());
998 mbMessageImpl.setStatusByUserName(getStatusByUserName());
999 mbMessageImpl.setStatusDate(getStatusDate());
1000
1001 mbMessageImpl.resetOriginalValues();
1002
1003 return mbMessageImpl;
1004 }
1005
1006 public int compareTo(MBMessage mbMessage) {
1007 int value = 0;
1008
1009 value = DateUtil.compareTo(getCreateDate(), mbMessage.getCreateDate());
1010
1011 if (value != 0) {
1012 return value;
1013 }
1014
1015 if (getMessageId() < mbMessage.getMessageId()) {
1016 value = -1;
1017 }
1018 else if (getMessageId() > mbMessage.getMessageId()) {
1019 value = 1;
1020 }
1021 else {
1022 value = 0;
1023 }
1024
1025 if (value != 0) {
1026 return value;
1027 }
1028
1029 return 0;
1030 }
1031
1032 @Override
1033 public boolean equals(Object obj) {
1034 if (this == obj) {
1035 return true;
1036 }
1037
1038 if (!(obj instanceof MBMessage)) {
1039 return false;
1040 }
1041
1042 MBMessage mbMessage = (MBMessage)obj;
1043
1044 long primaryKey = mbMessage.getPrimaryKey();
1045
1046 if (getPrimaryKey() == primaryKey) {
1047 return true;
1048 }
1049 else {
1050 return false;
1051 }
1052 }
1053
1054 @Override
1055 public int hashCode() {
1056 return (int)getPrimaryKey();
1057 }
1058
1059 @Override
1060 public void resetOriginalValues() {
1061 MBMessageModelImpl mbMessageModelImpl = this;
1062
1063 mbMessageModelImpl._originalUuid = mbMessageModelImpl._uuid;
1064
1065 mbMessageModelImpl._originalGroupId = mbMessageModelImpl._groupId;
1066
1067 mbMessageModelImpl._setOriginalGroupId = false;
1068
1069 mbMessageModelImpl._originalCompanyId = mbMessageModelImpl._companyId;
1070
1071 mbMessageModelImpl._setOriginalCompanyId = false;
1072
1073 mbMessageModelImpl._originalUserId = mbMessageModelImpl._userId;
1074
1075 mbMessageModelImpl._setOriginalUserId = false;
1076
1077 mbMessageModelImpl._originalClassNameId = mbMessageModelImpl._classNameId;
1078
1079 mbMessageModelImpl._setOriginalClassNameId = false;
1080
1081 mbMessageModelImpl._originalClassPK = mbMessageModelImpl._classPK;
1082
1083 mbMessageModelImpl._setOriginalClassPK = false;
1084
1085 mbMessageModelImpl._originalCategoryId = mbMessageModelImpl._categoryId;
1086
1087 mbMessageModelImpl._setOriginalCategoryId = false;
1088
1089 mbMessageModelImpl._originalThreadId = mbMessageModelImpl._threadId;
1090
1091 mbMessageModelImpl._setOriginalThreadId = false;
1092
1093 mbMessageModelImpl._originalParentMessageId = mbMessageModelImpl._parentMessageId;
1094
1095 mbMessageModelImpl._setOriginalParentMessageId = false;
1096
1097 mbMessageModelImpl._originalAnswer = mbMessageModelImpl._answer;
1098
1099 mbMessageModelImpl._setOriginalAnswer = false;
1100
1101 mbMessageModelImpl._originalStatus = mbMessageModelImpl._status;
1102
1103 mbMessageModelImpl._setOriginalStatus = false;
1104
1105 mbMessageModelImpl._columnBitmask = 0;
1106 }
1107
1108 @Override
1109 public CacheModel<MBMessage> toCacheModel() {
1110 MBMessageCacheModel mbMessageCacheModel = new MBMessageCacheModel();
1111
1112 mbMessageCacheModel.uuid = getUuid();
1113
1114 String uuid = mbMessageCacheModel.uuid;
1115
1116 if ((uuid != null) && (uuid.length() == 0)) {
1117 mbMessageCacheModel.uuid = null;
1118 }
1119
1120 mbMessageCacheModel.messageId = getMessageId();
1121
1122 mbMessageCacheModel.groupId = getGroupId();
1123
1124 mbMessageCacheModel.companyId = getCompanyId();
1125
1126 mbMessageCacheModel.userId = getUserId();
1127
1128 mbMessageCacheModel.userName = getUserName();
1129
1130 String userName = mbMessageCacheModel.userName;
1131
1132 if ((userName != null) && (userName.length() == 0)) {
1133 mbMessageCacheModel.userName = null;
1134 }
1135
1136 Date createDate = getCreateDate();
1137
1138 if (createDate != null) {
1139 mbMessageCacheModel.createDate = createDate.getTime();
1140 }
1141 else {
1142 mbMessageCacheModel.createDate = Long.MIN_VALUE;
1143 }
1144
1145 Date modifiedDate = getModifiedDate();
1146
1147 if (modifiedDate != null) {
1148 mbMessageCacheModel.modifiedDate = modifiedDate.getTime();
1149 }
1150 else {
1151 mbMessageCacheModel.modifiedDate = Long.MIN_VALUE;
1152 }
1153
1154 mbMessageCacheModel.classNameId = getClassNameId();
1155
1156 mbMessageCacheModel.classPK = getClassPK();
1157
1158 mbMessageCacheModel.categoryId = getCategoryId();
1159
1160 mbMessageCacheModel.threadId = getThreadId();
1161
1162 mbMessageCacheModel.rootMessageId = getRootMessageId();
1163
1164 mbMessageCacheModel.parentMessageId = getParentMessageId();
1165
1166 mbMessageCacheModel.subject = getSubject();
1167
1168 String subject = mbMessageCacheModel.subject;
1169
1170 if ((subject != null) && (subject.length() == 0)) {
1171 mbMessageCacheModel.subject = null;
1172 }
1173
1174 mbMessageCacheModel.body = getBody();
1175
1176 String body = mbMessageCacheModel.body;
1177
1178 if ((body != null) && (body.length() == 0)) {
1179 mbMessageCacheModel.body = null;
1180 }
1181
1182 mbMessageCacheModel.format = getFormat();
1183
1184 String format = mbMessageCacheModel.format;
1185
1186 if ((format != null) && (format.length() == 0)) {
1187 mbMessageCacheModel.format = null;
1188 }
1189
1190 mbMessageCacheModel.attachments = getAttachments();
1191
1192 mbMessageCacheModel.anonymous = getAnonymous();
1193
1194 mbMessageCacheModel.priority = getPriority();
1195
1196 mbMessageCacheModel.allowPingbacks = getAllowPingbacks();
1197
1198 mbMessageCacheModel.answer = getAnswer();
1199
1200 mbMessageCacheModel.status = getStatus();
1201
1202 mbMessageCacheModel.statusByUserId = getStatusByUserId();
1203
1204 mbMessageCacheModel.statusByUserName = getStatusByUserName();
1205
1206 String statusByUserName = mbMessageCacheModel.statusByUserName;
1207
1208 if ((statusByUserName != null) && (statusByUserName.length() == 0)) {
1209 mbMessageCacheModel.statusByUserName = null;
1210 }
1211
1212 Date statusDate = getStatusDate();
1213
1214 if (statusDate != null) {
1215 mbMessageCacheModel.statusDate = statusDate.getTime();
1216 }
1217 else {
1218 mbMessageCacheModel.statusDate = Long.MIN_VALUE;
1219 }
1220
1221 return mbMessageCacheModel;
1222 }
1223
1224 @Override
1225 public String toString() {
1226 StringBundler sb = new StringBundler(53);
1227
1228 sb.append("{uuid=");
1229 sb.append(getUuid());
1230 sb.append(", messageId=");
1231 sb.append(getMessageId());
1232 sb.append(", groupId=");
1233 sb.append(getGroupId());
1234 sb.append(", companyId=");
1235 sb.append(getCompanyId());
1236 sb.append(", userId=");
1237 sb.append(getUserId());
1238 sb.append(", userName=");
1239 sb.append(getUserName());
1240 sb.append(", createDate=");
1241 sb.append(getCreateDate());
1242 sb.append(", modifiedDate=");
1243 sb.append(getModifiedDate());
1244 sb.append(", classNameId=");
1245 sb.append(getClassNameId());
1246 sb.append(", classPK=");
1247 sb.append(getClassPK());
1248 sb.append(", categoryId=");
1249 sb.append(getCategoryId());
1250 sb.append(", threadId=");
1251 sb.append(getThreadId());
1252 sb.append(", rootMessageId=");
1253 sb.append(getRootMessageId());
1254 sb.append(", parentMessageId=");
1255 sb.append(getParentMessageId());
1256 sb.append(", subject=");
1257 sb.append(getSubject());
1258 sb.append(", body=");
1259 sb.append(getBody());
1260 sb.append(", format=");
1261 sb.append(getFormat());
1262 sb.append(", attachments=");
1263 sb.append(getAttachments());
1264 sb.append(", anonymous=");
1265 sb.append(getAnonymous());
1266 sb.append(", priority=");
1267 sb.append(getPriority());
1268 sb.append(", allowPingbacks=");
1269 sb.append(getAllowPingbacks());
1270 sb.append(", answer=");
1271 sb.append(getAnswer());
1272 sb.append(", status=");
1273 sb.append(getStatus());
1274 sb.append(", statusByUserId=");
1275 sb.append(getStatusByUserId());
1276 sb.append(", statusByUserName=");
1277 sb.append(getStatusByUserName());
1278 sb.append(", statusDate=");
1279 sb.append(getStatusDate());
1280 sb.append("}");
1281
1282 return sb.toString();
1283 }
1284
1285 public String toXmlString() {
1286 StringBundler sb = new StringBundler(82);
1287
1288 sb.append("<model><model-name>");
1289 sb.append("com.liferay.portlet.messageboards.model.MBMessage");
1290 sb.append("</model-name>");
1291
1292 sb.append(
1293 "<column><column-name>uuid</column-name><column-value><![CDATA[");
1294 sb.append(getUuid());
1295 sb.append("]]></column-value></column>");
1296 sb.append(
1297 "<column><column-name>messageId</column-name><column-value><![CDATA[");
1298 sb.append(getMessageId());
1299 sb.append("]]></column-value></column>");
1300 sb.append(
1301 "<column><column-name>groupId</column-name><column-value><![CDATA[");
1302 sb.append(getGroupId());
1303 sb.append("]]></column-value></column>");
1304 sb.append(
1305 "<column><column-name>companyId</column-name><column-value><![CDATA[");
1306 sb.append(getCompanyId());
1307 sb.append("]]></column-value></column>");
1308 sb.append(
1309 "<column><column-name>userId</column-name><column-value><![CDATA[");
1310 sb.append(getUserId());
1311 sb.append("]]></column-value></column>");
1312 sb.append(
1313 "<column><column-name>userName</column-name><column-value><![CDATA[");
1314 sb.append(getUserName());
1315 sb.append("]]></column-value></column>");
1316 sb.append(
1317 "<column><column-name>createDate</column-name><column-value><![CDATA[");
1318 sb.append(getCreateDate());
1319 sb.append("]]></column-value></column>");
1320 sb.append(
1321 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
1322 sb.append(getModifiedDate());
1323 sb.append("]]></column-value></column>");
1324 sb.append(
1325 "<column><column-name>classNameId</column-name><column-value><![CDATA[");
1326 sb.append(getClassNameId());
1327 sb.append("]]></column-value></column>");
1328 sb.append(
1329 "<column><column-name>classPK</column-name><column-value><![CDATA[");
1330 sb.append(getClassPK());
1331 sb.append("]]></column-value></column>");
1332 sb.append(
1333 "<column><column-name>categoryId</column-name><column-value><![CDATA[");
1334 sb.append(getCategoryId());
1335 sb.append("]]></column-value></column>");
1336 sb.append(
1337 "<column><column-name>threadId</column-name><column-value><![CDATA[");
1338 sb.append(getThreadId());
1339 sb.append("]]></column-value></column>");
1340 sb.append(
1341 "<column><column-name>rootMessageId</column-name><column-value><![CDATA[");
1342 sb.append(getRootMessageId());
1343 sb.append("]]></column-value></column>");
1344 sb.append(
1345 "<column><column-name>parentMessageId</column-name><column-value><![CDATA[");
1346 sb.append(getParentMessageId());
1347 sb.append("]]></column-value></column>");
1348 sb.append(
1349 "<column><column-name>subject</column-name><column-value><![CDATA[");
1350 sb.append(getSubject());
1351 sb.append("]]></column-value></column>");
1352 sb.append(
1353 "<column><column-name>body</column-name><column-value><![CDATA[");
1354 sb.append(getBody());
1355 sb.append("]]></column-value></column>");
1356 sb.append(
1357 "<column><column-name>format</column-name><column-value><![CDATA[");
1358 sb.append(getFormat());
1359 sb.append("]]></column-value></column>");
1360 sb.append(
1361 "<column><column-name>attachments</column-name><column-value><![CDATA[");
1362 sb.append(getAttachments());
1363 sb.append("]]></column-value></column>");
1364 sb.append(
1365 "<column><column-name>anonymous</column-name><column-value><![CDATA[");
1366 sb.append(getAnonymous());
1367 sb.append("]]></column-value></column>");
1368 sb.append(
1369 "<column><column-name>priority</column-name><column-value><![CDATA[");
1370 sb.append(getPriority());
1371 sb.append("]]></column-value></column>");
1372 sb.append(
1373 "<column><column-name>allowPingbacks</column-name><column-value><![CDATA[");
1374 sb.append(getAllowPingbacks());
1375 sb.append("]]></column-value></column>");
1376 sb.append(
1377 "<column><column-name>answer</column-name><column-value><![CDATA[");
1378 sb.append(getAnswer());
1379 sb.append("]]></column-value></column>");
1380 sb.append(
1381 "<column><column-name>status</column-name><column-value><![CDATA[");
1382 sb.append(getStatus());
1383 sb.append("]]></column-value></column>");
1384 sb.append(
1385 "<column><column-name>statusByUserId</column-name><column-value><![CDATA[");
1386 sb.append(getStatusByUserId());
1387 sb.append("]]></column-value></column>");
1388 sb.append(
1389 "<column><column-name>statusByUserName</column-name><column-value><![CDATA[");
1390 sb.append(getStatusByUserName());
1391 sb.append("]]></column-value></column>");
1392 sb.append(
1393 "<column><column-name>statusDate</column-name><column-value><![CDATA[");
1394 sb.append(getStatusDate());
1395 sb.append("]]></column-value></column>");
1396
1397 sb.append("</model>");
1398
1399 return sb.toString();
1400 }
1401
1402 private static ClassLoader _classLoader = MBMessage.class.getClassLoader();
1403 private static Class<?>[] _escapedModelInterfaces = new Class[] {
1404 MBMessage.class
1405 };
1406 private String _uuid;
1407 private String _originalUuid;
1408 private long _messageId;
1409 private long _groupId;
1410 private long _originalGroupId;
1411 private boolean _setOriginalGroupId;
1412 private long _companyId;
1413 private long _originalCompanyId;
1414 private boolean _setOriginalCompanyId;
1415 private long _userId;
1416 private String _userUuid;
1417 private long _originalUserId;
1418 private boolean _setOriginalUserId;
1419 private String _userName;
1420 private Date _createDate;
1421 private Date _modifiedDate;
1422 private long _classNameId;
1423 private long _originalClassNameId;
1424 private boolean _setOriginalClassNameId;
1425 private long _classPK;
1426 private long _originalClassPK;
1427 private boolean _setOriginalClassPK;
1428 private long _categoryId;
1429 private long _originalCategoryId;
1430 private boolean _setOriginalCategoryId;
1431 private long _threadId;
1432 private long _originalThreadId;
1433 private boolean _setOriginalThreadId;
1434 private long _rootMessageId;
1435 private long _parentMessageId;
1436 private long _originalParentMessageId;
1437 private boolean _setOriginalParentMessageId;
1438 private String _subject;
1439 private String _body;
1440 private String _format;
1441 private boolean _attachments;
1442 private boolean _anonymous;
1443 private double _priority;
1444 private boolean _allowPingbacks;
1445 private boolean _answer;
1446 private boolean _originalAnswer;
1447 private boolean _setOriginalAnswer;
1448 private int _status;
1449 private int _originalStatus;
1450 private boolean _setOriginalStatus;
1451 private long _statusByUserId;
1452 private String _statusByUserUuid;
1453 private String _statusByUserName;
1454 private Date _statusDate;
1455 private long _columnBitmask;
1456 private MBMessage _escapedModel;
1457 }