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