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