001
014
015 package com.liferay.portlet.documentlibrary.model.impl;
016
017 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018 import com.liferay.portal.kernel.exception.PortalException;
019 import com.liferay.portal.kernel.exception.SystemException;
020 import com.liferay.portal.kernel.json.JSON;
021 import com.liferay.portal.kernel.lar.StagedModelType;
022 import com.liferay.portal.kernel.trash.TrashHandler;
023 import com.liferay.portal.kernel.trash.TrashHandlerRegistryUtil;
024 import com.liferay.portal.kernel.util.GetterUtil;
025 import com.liferay.portal.kernel.util.ProxyUtil;
026 import com.liferay.portal.kernel.util.StringBundler;
027 import com.liferay.portal.kernel.util.StringPool;
028 import com.liferay.portal.kernel.util.Validator;
029 import com.liferay.portal.kernel.workflow.WorkflowConstants;
030 import com.liferay.portal.model.CacheModel;
031 import com.liferay.portal.model.ContainerModel;
032 import com.liferay.portal.model.TrashedModel;
033 import com.liferay.portal.model.impl.BaseModelImpl;
034 import com.liferay.portal.service.ServiceContext;
035 import com.liferay.portal.util.PortalUtil;
036
037 import com.liferay.portlet.documentlibrary.model.DLFileShortcut;
038 import com.liferay.portlet.documentlibrary.model.DLFileShortcutModel;
039 import com.liferay.portlet.documentlibrary.model.DLFileShortcutSoap;
040 import com.liferay.portlet.expando.model.ExpandoBridge;
041 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
042 import com.liferay.portlet.trash.model.TrashEntry;
043 import com.liferay.portlet.trash.service.TrashEntryLocalServiceUtil;
044
045 import java.io.Serializable;
046
047 import java.sql.Types;
048
049 import java.util.ArrayList;
050 import java.util.Date;
051 import java.util.HashMap;
052 import java.util.List;
053 import java.util.Map;
054
055
068 @JSON(strict = true)
069 public class DLFileShortcutModelImpl extends BaseModelImpl<DLFileShortcut>
070 implements DLFileShortcutModel {
071
076 public static final String TABLE_NAME = "DLFileShortcut";
077 public static final Object[][] TABLE_COLUMNS = {
078 { "uuid_", Types.VARCHAR },
079 { "fileShortcutId", Types.BIGINT },
080 { "groupId", Types.BIGINT },
081 { "companyId", Types.BIGINT },
082 { "userId", Types.BIGINT },
083 { "userName", Types.VARCHAR },
084 { "createDate", Types.TIMESTAMP },
085 { "modifiedDate", Types.TIMESTAMP },
086 { "repositoryId", Types.BIGINT },
087 { "folderId", Types.BIGINT },
088 { "toFileEntryId", Types.BIGINT },
089 { "treePath", Types.VARCHAR },
090 { "active_", Types.BOOLEAN },
091 { "status", Types.INTEGER },
092 { "statusByUserId", Types.BIGINT },
093 { "statusByUserName", Types.VARCHAR },
094 { "statusDate", Types.TIMESTAMP }
095 };
096 public static final String TABLE_SQL_CREATE = "create table DLFileShortcut (uuid_ VARCHAR(75) null,fileShortcutId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,repositoryId LONG,folderId LONG,toFileEntryId LONG,treePath STRING null,active_ BOOLEAN,status INTEGER,statusByUserId LONG,statusByUserName VARCHAR(75) null,statusDate DATE null)";
097 public static final String TABLE_SQL_DROP = "drop table DLFileShortcut";
098 public static final String ORDER_BY_JPQL = " ORDER BY dlFileShortcut.fileShortcutId ASC";
099 public static final String ORDER_BY_SQL = " ORDER BY DLFileShortcut.fileShortcutId ASC";
100 public static final String DATA_SOURCE = "liferayDataSource";
101 public static final String SESSION_FACTORY = "liferaySessionFactory";
102 public static final String TX_MANAGER = "liferayTransactionManager";
103 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
104 "value.object.entity.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileShortcut"),
105 true);
106 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
107 "value.object.finder.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileShortcut"),
108 true);
109 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
110 "value.object.column.bitmask.enabled.com.liferay.portlet.documentlibrary.model.DLFileShortcut"),
111 true);
112 public static long ACTIVE_COLUMN_BITMASK = 1L;
113 public static long COMPANYID_COLUMN_BITMASK = 2L;
114 public static long FOLDERID_COLUMN_BITMASK = 4L;
115 public static long GROUPID_COLUMN_BITMASK = 8L;
116 public static long STATUS_COLUMN_BITMASK = 16L;
117 public static long TOFILEENTRYID_COLUMN_BITMASK = 32L;
118 public static long UUID_COLUMN_BITMASK = 64L;
119 public static long FILESHORTCUTID_COLUMN_BITMASK = 128L;
120
121
127 public static DLFileShortcut toModel(DLFileShortcutSoap soapModel) {
128 if (soapModel == null) {
129 return null;
130 }
131
132 DLFileShortcut model = new DLFileShortcutImpl();
133
134 model.setUuid(soapModel.getUuid());
135 model.setFileShortcutId(soapModel.getFileShortcutId());
136 model.setGroupId(soapModel.getGroupId());
137 model.setCompanyId(soapModel.getCompanyId());
138 model.setUserId(soapModel.getUserId());
139 model.setUserName(soapModel.getUserName());
140 model.setCreateDate(soapModel.getCreateDate());
141 model.setModifiedDate(soapModel.getModifiedDate());
142 model.setRepositoryId(soapModel.getRepositoryId());
143 model.setFolderId(soapModel.getFolderId());
144 model.setToFileEntryId(soapModel.getToFileEntryId());
145 model.setTreePath(soapModel.getTreePath());
146 model.setActive(soapModel.getActive());
147 model.setStatus(soapModel.getStatus());
148 model.setStatusByUserId(soapModel.getStatusByUserId());
149 model.setStatusByUserName(soapModel.getStatusByUserName());
150 model.setStatusDate(soapModel.getStatusDate());
151
152 return model;
153 }
154
155
161 public static List<DLFileShortcut> toModels(DLFileShortcutSoap[] soapModels) {
162 if (soapModels == null) {
163 return null;
164 }
165
166 List<DLFileShortcut> models = new ArrayList<DLFileShortcut>(soapModels.length);
167
168 for (DLFileShortcutSoap soapModel : soapModels) {
169 models.add(toModel(soapModel));
170 }
171
172 return models;
173 }
174
175 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
176 "lock.expiration.time.com.liferay.portlet.documentlibrary.model.DLFileShortcut"));
177
178 public DLFileShortcutModelImpl() {
179 }
180
181 @Override
182 public long getPrimaryKey() {
183 return _fileShortcutId;
184 }
185
186 @Override
187 public void setPrimaryKey(long primaryKey) {
188 setFileShortcutId(primaryKey);
189 }
190
191 @Override
192 public Serializable getPrimaryKeyObj() {
193 return _fileShortcutId;
194 }
195
196 @Override
197 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
198 setPrimaryKey(((Long)primaryKeyObj).longValue());
199 }
200
201 @Override
202 public Class<?> getModelClass() {
203 return DLFileShortcut.class;
204 }
205
206 @Override
207 public String getModelClassName() {
208 return DLFileShortcut.class.getName();
209 }
210
211 @Override
212 public Map<String, Object> getModelAttributes() {
213 Map<String, Object> attributes = new HashMap<String, Object>();
214
215 attributes.put("uuid", getUuid());
216 attributes.put("fileShortcutId", getFileShortcutId());
217 attributes.put("groupId", getGroupId());
218 attributes.put("companyId", getCompanyId());
219 attributes.put("userId", getUserId());
220 attributes.put("userName", getUserName());
221 attributes.put("createDate", getCreateDate());
222 attributes.put("modifiedDate", getModifiedDate());
223 attributes.put("repositoryId", getRepositoryId());
224 attributes.put("folderId", getFolderId());
225 attributes.put("toFileEntryId", getToFileEntryId());
226 attributes.put("treePath", getTreePath());
227 attributes.put("active", getActive());
228 attributes.put("status", getStatus());
229 attributes.put("statusByUserId", getStatusByUserId());
230 attributes.put("statusByUserName", getStatusByUserName());
231 attributes.put("statusDate", getStatusDate());
232
233 return attributes;
234 }
235
236 @Override
237 public void setModelAttributes(Map<String, Object> attributes) {
238 String uuid = (String)attributes.get("uuid");
239
240 if (uuid != null) {
241 setUuid(uuid);
242 }
243
244 Long fileShortcutId = (Long)attributes.get("fileShortcutId");
245
246 if (fileShortcutId != null) {
247 setFileShortcutId(fileShortcutId);
248 }
249
250 Long groupId = (Long)attributes.get("groupId");
251
252 if (groupId != null) {
253 setGroupId(groupId);
254 }
255
256 Long companyId = (Long)attributes.get("companyId");
257
258 if (companyId != null) {
259 setCompanyId(companyId);
260 }
261
262 Long userId = (Long)attributes.get("userId");
263
264 if (userId != null) {
265 setUserId(userId);
266 }
267
268 String userName = (String)attributes.get("userName");
269
270 if (userName != null) {
271 setUserName(userName);
272 }
273
274 Date createDate = (Date)attributes.get("createDate");
275
276 if (createDate != null) {
277 setCreateDate(createDate);
278 }
279
280 Date modifiedDate = (Date)attributes.get("modifiedDate");
281
282 if (modifiedDate != null) {
283 setModifiedDate(modifiedDate);
284 }
285
286 Long repositoryId = (Long)attributes.get("repositoryId");
287
288 if (repositoryId != null) {
289 setRepositoryId(repositoryId);
290 }
291
292 Long folderId = (Long)attributes.get("folderId");
293
294 if (folderId != null) {
295 setFolderId(folderId);
296 }
297
298 Long toFileEntryId = (Long)attributes.get("toFileEntryId");
299
300 if (toFileEntryId != null) {
301 setToFileEntryId(toFileEntryId);
302 }
303
304 String treePath = (String)attributes.get("treePath");
305
306 if (treePath != null) {
307 setTreePath(treePath);
308 }
309
310 Boolean active = (Boolean)attributes.get("active");
311
312 if (active != null) {
313 setActive(active);
314 }
315
316 Integer status = (Integer)attributes.get("status");
317
318 if (status != null) {
319 setStatus(status);
320 }
321
322 Long statusByUserId = (Long)attributes.get("statusByUserId");
323
324 if (statusByUserId != null) {
325 setStatusByUserId(statusByUserId);
326 }
327
328 String statusByUserName = (String)attributes.get("statusByUserName");
329
330 if (statusByUserName != null) {
331 setStatusByUserName(statusByUserName);
332 }
333
334 Date statusDate = (Date)attributes.get("statusDate");
335
336 if (statusDate != null) {
337 setStatusDate(statusDate);
338 }
339 }
340
341 @JSON
342 @Override
343 public String getUuid() {
344 if (_uuid == null) {
345 return StringPool.BLANK;
346 }
347 else {
348 return _uuid;
349 }
350 }
351
352 @Override
353 public void setUuid(String uuid) {
354 if (_originalUuid == null) {
355 _originalUuid = _uuid;
356 }
357
358 _uuid = uuid;
359 }
360
361 public String getOriginalUuid() {
362 return GetterUtil.getString(_originalUuid);
363 }
364
365 @JSON
366 @Override
367 public long getFileShortcutId() {
368 return _fileShortcutId;
369 }
370
371 @Override
372 public void setFileShortcutId(long fileShortcutId) {
373 _fileShortcutId = fileShortcutId;
374 }
375
376 @JSON
377 @Override
378 public long getGroupId() {
379 return _groupId;
380 }
381
382 @Override
383 public void setGroupId(long groupId) {
384 _columnBitmask |= GROUPID_COLUMN_BITMASK;
385
386 if (!_setOriginalGroupId) {
387 _setOriginalGroupId = true;
388
389 _originalGroupId = _groupId;
390 }
391
392 _groupId = groupId;
393 }
394
395 public long getOriginalGroupId() {
396 return _originalGroupId;
397 }
398
399 @JSON
400 @Override
401 public long getCompanyId() {
402 return _companyId;
403 }
404
405 @Override
406 public void setCompanyId(long companyId) {
407 _columnBitmask |= COMPANYID_COLUMN_BITMASK;
408
409 if (!_setOriginalCompanyId) {
410 _setOriginalCompanyId = true;
411
412 _originalCompanyId = _companyId;
413 }
414
415 _companyId = companyId;
416 }
417
418 public long getOriginalCompanyId() {
419 return _originalCompanyId;
420 }
421
422 @JSON
423 @Override
424 public long getUserId() {
425 return _userId;
426 }
427
428 @Override
429 public void setUserId(long userId) {
430 _userId = userId;
431 }
432
433 @Override
434 public String getUserUuid() throws SystemException {
435 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
436 }
437
438 @Override
439 public void setUserUuid(String userUuid) {
440 _userUuid = userUuid;
441 }
442
443 @JSON
444 @Override
445 public String getUserName() {
446 if (_userName == null) {
447 return StringPool.BLANK;
448 }
449 else {
450 return _userName;
451 }
452 }
453
454 @Override
455 public void setUserName(String userName) {
456 _userName = userName;
457 }
458
459 @JSON
460 @Override
461 public Date getCreateDate() {
462 return _createDate;
463 }
464
465 @Override
466 public void setCreateDate(Date createDate) {
467 _createDate = createDate;
468 }
469
470 @JSON
471 @Override
472 public Date getModifiedDate() {
473 return _modifiedDate;
474 }
475
476 @Override
477 public void setModifiedDate(Date modifiedDate) {
478 _modifiedDate = modifiedDate;
479 }
480
481 @JSON
482 @Override
483 public long getRepositoryId() {
484 return _repositoryId;
485 }
486
487 @Override
488 public void setRepositoryId(long repositoryId) {
489 _repositoryId = repositoryId;
490 }
491
492 @JSON
493 @Override
494 public long getFolderId() {
495 return _folderId;
496 }
497
498 @Override
499 public void setFolderId(long folderId) {
500 _columnBitmask |= FOLDERID_COLUMN_BITMASK;
501
502 if (!_setOriginalFolderId) {
503 _setOriginalFolderId = true;
504
505 _originalFolderId = _folderId;
506 }
507
508 _folderId = folderId;
509 }
510
511 public long getOriginalFolderId() {
512 return _originalFolderId;
513 }
514
515 @JSON
516 @Override
517 public long getToFileEntryId() {
518 return _toFileEntryId;
519 }
520
521 @Override
522 public void setToFileEntryId(long toFileEntryId) {
523 _columnBitmask |= TOFILEENTRYID_COLUMN_BITMASK;
524
525 if (!_setOriginalToFileEntryId) {
526 _setOriginalToFileEntryId = true;
527
528 _originalToFileEntryId = _toFileEntryId;
529 }
530
531 _toFileEntryId = toFileEntryId;
532 }
533
534 public long getOriginalToFileEntryId() {
535 return _originalToFileEntryId;
536 }
537
538 @JSON
539 @Override
540 public String getTreePath() {
541 if (_treePath == null) {
542 return StringPool.BLANK;
543 }
544 else {
545 return _treePath;
546 }
547 }
548
549 @Override
550 public void setTreePath(String treePath) {
551 _treePath = treePath;
552 }
553
554 @JSON
555 @Override
556 public boolean getActive() {
557 return _active;
558 }
559
560 @Override
561 public boolean isActive() {
562 return _active;
563 }
564
565 @Override
566 public void setActive(boolean active) {
567 _columnBitmask |= ACTIVE_COLUMN_BITMASK;
568
569 if (!_setOriginalActive) {
570 _setOriginalActive = true;
571
572 _originalActive = _active;
573 }
574
575 _active = active;
576 }
577
578 public boolean getOriginalActive() {
579 return _originalActive;
580 }
581
582 @JSON
583 @Override
584 public int getStatus() {
585 return _status;
586 }
587
588 @Override
589 public void setStatus(int status) {
590 _columnBitmask |= STATUS_COLUMN_BITMASK;
591
592 if (!_setOriginalStatus) {
593 _setOriginalStatus = true;
594
595 _originalStatus = _status;
596 }
597
598 _status = status;
599 }
600
601 public int getOriginalStatus() {
602 return _originalStatus;
603 }
604
605 @JSON
606 @Override
607 public long getStatusByUserId() {
608 return _statusByUserId;
609 }
610
611 @Override
612 public void setStatusByUserId(long statusByUserId) {
613 _statusByUserId = statusByUserId;
614 }
615
616 @Override
617 public String getStatusByUserUuid() throws SystemException {
618 return PortalUtil.getUserValue(getStatusByUserId(), "uuid",
619 _statusByUserUuid);
620 }
621
622 @Override
623 public void setStatusByUserUuid(String statusByUserUuid) {
624 _statusByUserUuid = statusByUserUuid;
625 }
626
627 @JSON
628 @Override
629 public String getStatusByUserName() {
630 if (_statusByUserName == null) {
631 return StringPool.BLANK;
632 }
633 else {
634 return _statusByUserName;
635 }
636 }
637
638 @Override
639 public void setStatusByUserName(String statusByUserName) {
640 _statusByUserName = statusByUserName;
641 }
642
643 @JSON
644 @Override
645 public Date getStatusDate() {
646 return _statusDate;
647 }
648
649 @Override
650 public void setStatusDate(Date statusDate) {
651 _statusDate = statusDate;
652 }
653
654 @Override
655 public StagedModelType getStagedModelType() {
656 return new StagedModelType(PortalUtil.getClassNameId(
657 DLFileShortcut.class.getName()));
658 }
659
660 @Override
661 public TrashEntry getTrashEntry() throws PortalException, SystemException {
662 if (!isInTrash() && !isInTrashContainer()) {
663 return null;
664 }
665
666 TrashEntry trashEntry = TrashEntryLocalServiceUtil.fetchEntry(getModelClassName(),
667 getPrimaryKey());
668
669 if (trashEntry != null) {
670 return trashEntry;
671 }
672
673 TrashHandler trashHandler = getTrashHandler();
674
675 if (!Validator.isNull(trashHandler.getContainerModelClassName())) {
676 ContainerModel containerModel = trashHandler.getParentContainerModel(this);
677
678 while (containerModel != null) {
679 if (containerModel instanceof TrashedModel) {
680 TrashedModel trashedModel = (TrashedModel)containerModel;
681
682 return trashedModel.getTrashEntry();
683 }
684
685 trashHandler = TrashHandlerRegistryUtil.getTrashHandler(trashHandler.getContainerModelClassName());
686
687 if (trashHandler == null) {
688 return null;
689 }
690
691 containerModel = trashHandler.getContainerModel(containerModel.getParentContainerModelId());
692 }
693 }
694
695 return null;
696 }
697
698 @Override
699 public TrashHandler getTrashHandler() {
700 return TrashHandlerRegistryUtil.getTrashHandler(getModelClassName());
701 }
702
703 @Override
704 public boolean isInTrash() {
705 if (getStatus() == WorkflowConstants.STATUS_IN_TRASH) {
706 return true;
707 }
708 else {
709 return false;
710 }
711 }
712
713 @Override
714 public boolean isInTrashContainer() {
715 TrashHandler trashHandler = getTrashHandler();
716
717 if ((trashHandler == null) ||
718 Validator.isNull(trashHandler.getContainerModelClassName())) {
719 return false;
720 }
721
722 try {
723 ContainerModel containerModel = trashHandler.getParentContainerModel(this);
724
725 if (containerModel == null) {
726 return false;
727 }
728
729 if (containerModel instanceof TrashedModel) {
730 return ((TrashedModel)containerModel).isInTrash();
731 }
732 }
733 catch (Exception e) {
734 }
735
736 return false;
737 }
738
739
742 @Override
743 public boolean getApproved() {
744 return isApproved();
745 }
746
747 @Override
748 public boolean isApproved() {
749 if (getStatus() == WorkflowConstants.STATUS_APPROVED) {
750 return true;
751 }
752 else {
753 return false;
754 }
755 }
756
757 @Override
758 public boolean isDenied() {
759 if (getStatus() == WorkflowConstants.STATUS_DENIED) {
760 return true;
761 }
762 else {
763 return false;
764 }
765 }
766
767 @Override
768 public boolean isDraft() {
769 if (getStatus() == WorkflowConstants.STATUS_DRAFT) {
770 return true;
771 }
772 else {
773 return false;
774 }
775 }
776
777 @Override
778 public boolean isExpired() {
779 if (getStatus() == WorkflowConstants.STATUS_EXPIRED) {
780 return true;
781 }
782 else {
783 return false;
784 }
785 }
786
787 @Override
788 public boolean isInactive() {
789 if (getStatus() == WorkflowConstants.STATUS_INACTIVE) {
790 return true;
791 }
792 else {
793 return false;
794 }
795 }
796
797 @Override
798 public boolean isIncomplete() {
799 if (getStatus() == WorkflowConstants.STATUS_INCOMPLETE) {
800 return true;
801 }
802 else {
803 return false;
804 }
805 }
806
807 @Override
808 public boolean isPending() {
809 if (getStatus() == WorkflowConstants.STATUS_PENDING) {
810 return true;
811 }
812 else {
813 return false;
814 }
815 }
816
817 @Override
818 public boolean isScheduled() {
819 if (getStatus() == WorkflowConstants.STATUS_SCHEDULED) {
820 return true;
821 }
822 else {
823 return false;
824 }
825 }
826
827 public long getColumnBitmask() {
828 return _columnBitmask;
829 }
830
831 @Override
832 public ExpandoBridge getExpandoBridge() {
833 return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
834 DLFileShortcut.class.getName(), getPrimaryKey());
835 }
836
837 @Override
838 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
839 ExpandoBridge expandoBridge = getExpandoBridge();
840
841 expandoBridge.setAttributes(serviceContext);
842 }
843
844 @Override
845 public DLFileShortcut toEscapedModel() {
846 if (_escapedModel == null) {
847 _escapedModel = (DLFileShortcut)ProxyUtil.newProxyInstance(_classLoader,
848 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
849 }
850
851 return _escapedModel;
852 }
853
854 @Override
855 public Object clone() {
856 DLFileShortcutImpl dlFileShortcutImpl = new DLFileShortcutImpl();
857
858 dlFileShortcutImpl.setUuid(getUuid());
859 dlFileShortcutImpl.setFileShortcutId(getFileShortcutId());
860 dlFileShortcutImpl.setGroupId(getGroupId());
861 dlFileShortcutImpl.setCompanyId(getCompanyId());
862 dlFileShortcutImpl.setUserId(getUserId());
863 dlFileShortcutImpl.setUserName(getUserName());
864 dlFileShortcutImpl.setCreateDate(getCreateDate());
865 dlFileShortcutImpl.setModifiedDate(getModifiedDate());
866 dlFileShortcutImpl.setRepositoryId(getRepositoryId());
867 dlFileShortcutImpl.setFolderId(getFolderId());
868 dlFileShortcutImpl.setToFileEntryId(getToFileEntryId());
869 dlFileShortcutImpl.setTreePath(getTreePath());
870 dlFileShortcutImpl.setActive(getActive());
871 dlFileShortcutImpl.setStatus(getStatus());
872 dlFileShortcutImpl.setStatusByUserId(getStatusByUserId());
873 dlFileShortcutImpl.setStatusByUserName(getStatusByUserName());
874 dlFileShortcutImpl.setStatusDate(getStatusDate());
875
876 dlFileShortcutImpl.resetOriginalValues();
877
878 return dlFileShortcutImpl;
879 }
880
881 @Override
882 public int compareTo(DLFileShortcut dlFileShortcut) {
883 long primaryKey = dlFileShortcut.getPrimaryKey();
884
885 if (getPrimaryKey() < primaryKey) {
886 return -1;
887 }
888 else if (getPrimaryKey() > primaryKey) {
889 return 1;
890 }
891 else {
892 return 0;
893 }
894 }
895
896 @Override
897 public boolean equals(Object obj) {
898 if (this == obj) {
899 return true;
900 }
901
902 if (!(obj instanceof DLFileShortcut)) {
903 return false;
904 }
905
906 DLFileShortcut dlFileShortcut = (DLFileShortcut)obj;
907
908 long primaryKey = dlFileShortcut.getPrimaryKey();
909
910 if (getPrimaryKey() == primaryKey) {
911 return true;
912 }
913 else {
914 return false;
915 }
916 }
917
918 @Override
919 public int hashCode() {
920 return (int)getPrimaryKey();
921 }
922
923 @Override
924 public void resetOriginalValues() {
925 DLFileShortcutModelImpl dlFileShortcutModelImpl = this;
926
927 dlFileShortcutModelImpl._originalUuid = dlFileShortcutModelImpl._uuid;
928
929 dlFileShortcutModelImpl._originalGroupId = dlFileShortcutModelImpl._groupId;
930
931 dlFileShortcutModelImpl._setOriginalGroupId = false;
932
933 dlFileShortcutModelImpl._originalCompanyId = dlFileShortcutModelImpl._companyId;
934
935 dlFileShortcutModelImpl._setOriginalCompanyId = false;
936
937 dlFileShortcutModelImpl._originalFolderId = dlFileShortcutModelImpl._folderId;
938
939 dlFileShortcutModelImpl._setOriginalFolderId = false;
940
941 dlFileShortcutModelImpl._originalToFileEntryId = dlFileShortcutModelImpl._toFileEntryId;
942
943 dlFileShortcutModelImpl._setOriginalToFileEntryId = false;
944
945 dlFileShortcutModelImpl._originalActive = dlFileShortcutModelImpl._active;
946
947 dlFileShortcutModelImpl._setOriginalActive = false;
948
949 dlFileShortcutModelImpl._originalStatus = dlFileShortcutModelImpl._status;
950
951 dlFileShortcutModelImpl._setOriginalStatus = false;
952
953 dlFileShortcutModelImpl._columnBitmask = 0;
954 }
955
956 @Override
957 public CacheModel<DLFileShortcut> toCacheModel() {
958 DLFileShortcutCacheModel dlFileShortcutCacheModel = new DLFileShortcutCacheModel();
959
960 dlFileShortcutCacheModel.uuid = getUuid();
961
962 String uuid = dlFileShortcutCacheModel.uuid;
963
964 if ((uuid != null) && (uuid.length() == 0)) {
965 dlFileShortcutCacheModel.uuid = null;
966 }
967
968 dlFileShortcutCacheModel.fileShortcutId = getFileShortcutId();
969
970 dlFileShortcutCacheModel.groupId = getGroupId();
971
972 dlFileShortcutCacheModel.companyId = getCompanyId();
973
974 dlFileShortcutCacheModel.userId = getUserId();
975
976 dlFileShortcutCacheModel.userName = getUserName();
977
978 String userName = dlFileShortcutCacheModel.userName;
979
980 if ((userName != null) && (userName.length() == 0)) {
981 dlFileShortcutCacheModel.userName = null;
982 }
983
984 Date createDate = getCreateDate();
985
986 if (createDate != null) {
987 dlFileShortcutCacheModel.createDate = createDate.getTime();
988 }
989 else {
990 dlFileShortcutCacheModel.createDate = Long.MIN_VALUE;
991 }
992
993 Date modifiedDate = getModifiedDate();
994
995 if (modifiedDate != null) {
996 dlFileShortcutCacheModel.modifiedDate = modifiedDate.getTime();
997 }
998 else {
999 dlFileShortcutCacheModel.modifiedDate = Long.MIN_VALUE;
1000 }
1001
1002 dlFileShortcutCacheModel.repositoryId = getRepositoryId();
1003
1004 dlFileShortcutCacheModel.folderId = getFolderId();
1005
1006 dlFileShortcutCacheModel.toFileEntryId = getToFileEntryId();
1007
1008 dlFileShortcutCacheModel.treePath = getTreePath();
1009
1010 String treePath = dlFileShortcutCacheModel.treePath;
1011
1012 if ((treePath != null) && (treePath.length() == 0)) {
1013 dlFileShortcutCacheModel.treePath = null;
1014 }
1015
1016 dlFileShortcutCacheModel.active = getActive();
1017
1018 dlFileShortcutCacheModel.status = getStatus();
1019
1020 dlFileShortcutCacheModel.statusByUserId = getStatusByUserId();
1021
1022 dlFileShortcutCacheModel.statusByUserName = getStatusByUserName();
1023
1024 String statusByUserName = dlFileShortcutCacheModel.statusByUserName;
1025
1026 if ((statusByUserName != null) && (statusByUserName.length() == 0)) {
1027 dlFileShortcutCacheModel.statusByUserName = null;
1028 }
1029
1030 Date statusDate = getStatusDate();
1031
1032 if (statusDate != null) {
1033 dlFileShortcutCacheModel.statusDate = statusDate.getTime();
1034 }
1035 else {
1036 dlFileShortcutCacheModel.statusDate = Long.MIN_VALUE;
1037 }
1038
1039 return dlFileShortcutCacheModel;
1040 }
1041
1042 @Override
1043 public String toString() {
1044 StringBundler sb = new StringBundler(35);
1045
1046 sb.append("{uuid=");
1047 sb.append(getUuid());
1048 sb.append(", fileShortcutId=");
1049 sb.append(getFileShortcutId());
1050 sb.append(", groupId=");
1051 sb.append(getGroupId());
1052 sb.append(", companyId=");
1053 sb.append(getCompanyId());
1054 sb.append(", userId=");
1055 sb.append(getUserId());
1056 sb.append(", userName=");
1057 sb.append(getUserName());
1058 sb.append(", createDate=");
1059 sb.append(getCreateDate());
1060 sb.append(", modifiedDate=");
1061 sb.append(getModifiedDate());
1062 sb.append(", repositoryId=");
1063 sb.append(getRepositoryId());
1064 sb.append(", folderId=");
1065 sb.append(getFolderId());
1066 sb.append(", toFileEntryId=");
1067 sb.append(getToFileEntryId());
1068 sb.append(", treePath=");
1069 sb.append(getTreePath());
1070 sb.append(", active=");
1071 sb.append(getActive());
1072 sb.append(", status=");
1073 sb.append(getStatus());
1074 sb.append(", statusByUserId=");
1075 sb.append(getStatusByUserId());
1076 sb.append(", statusByUserName=");
1077 sb.append(getStatusByUserName());
1078 sb.append(", statusDate=");
1079 sb.append(getStatusDate());
1080 sb.append("}");
1081
1082 return sb.toString();
1083 }
1084
1085 @Override
1086 public String toXmlString() {
1087 StringBundler sb = new StringBundler(55);
1088
1089 sb.append("<model><model-name>");
1090 sb.append("com.liferay.portlet.documentlibrary.model.DLFileShortcut");
1091 sb.append("</model-name>");
1092
1093 sb.append(
1094 "<column><column-name>uuid</column-name><column-value><![CDATA[");
1095 sb.append(getUuid());
1096 sb.append("]]></column-value></column>");
1097 sb.append(
1098 "<column><column-name>fileShortcutId</column-name><column-value><![CDATA[");
1099 sb.append(getFileShortcutId());
1100 sb.append("]]></column-value></column>");
1101 sb.append(
1102 "<column><column-name>groupId</column-name><column-value><![CDATA[");
1103 sb.append(getGroupId());
1104 sb.append("]]></column-value></column>");
1105 sb.append(
1106 "<column><column-name>companyId</column-name><column-value><![CDATA[");
1107 sb.append(getCompanyId());
1108 sb.append("]]></column-value></column>");
1109 sb.append(
1110 "<column><column-name>userId</column-name><column-value><![CDATA[");
1111 sb.append(getUserId());
1112 sb.append("]]></column-value></column>");
1113 sb.append(
1114 "<column><column-name>userName</column-name><column-value><![CDATA[");
1115 sb.append(getUserName());
1116 sb.append("]]></column-value></column>");
1117 sb.append(
1118 "<column><column-name>createDate</column-name><column-value><![CDATA[");
1119 sb.append(getCreateDate());
1120 sb.append("]]></column-value></column>");
1121 sb.append(
1122 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
1123 sb.append(getModifiedDate());
1124 sb.append("]]></column-value></column>");
1125 sb.append(
1126 "<column><column-name>repositoryId</column-name><column-value><![CDATA[");
1127 sb.append(getRepositoryId());
1128 sb.append("]]></column-value></column>");
1129 sb.append(
1130 "<column><column-name>folderId</column-name><column-value><![CDATA[");
1131 sb.append(getFolderId());
1132 sb.append("]]></column-value></column>");
1133 sb.append(
1134 "<column><column-name>toFileEntryId</column-name><column-value><![CDATA[");
1135 sb.append(getToFileEntryId());
1136 sb.append("]]></column-value></column>");
1137 sb.append(
1138 "<column><column-name>treePath</column-name><column-value><![CDATA[");
1139 sb.append(getTreePath());
1140 sb.append("]]></column-value></column>");
1141 sb.append(
1142 "<column><column-name>active</column-name><column-value><![CDATA[");
1143 sb.append(getActive());
1144 sb.append("]]></column-value></column>");
1145 sb.append(
1146 "<column><column-name>status</column-name><column-value><![CDATA[");
1147 sb.append(getStatus());
1148 sb.append("]]></column-value></column>");
1149 sb.append(
1150 "<column><column-name>statusByUserId</column-name><column-value><![CDATA[");
1151 sb.append(getStatusByUserId());
1152 sb.append("]]></column-value></column>");
1153 sb.append(
1154 "<column><column-name>statusByUserName</column-name><column-value><![CDATA[");
1155 sb.append(getStatusByUserName());
1156 sb.append("]]></column-value></column>");
1157 sb.append(
1158 "<column><column-name>statusDate</column-name><column-value><![CDATA[");
1159 sb.append(getStatusDate());
1160 sb.append("]]></column-value></column>");
1161
1162 sb.append("</model>");
1163
1164 return sb.toString();
1165 }
1166
1167 private static ClassLoader _classLoader = DLFileShortcut.class.getClassLoader();
1168 private static Class<?>[] _escapedModelInterfaces = new Class[] {
1169 DLFileShortcut.class
1170 };
1171 private String _uuid;
1172 private String _originalUuid;
1173 private long _fileShortcutId;
1174 private long _groupId;
1175 private long _originalGroupId;
1176 private boolean _setOriginalGroupId;
1177 private long _companyId;
1178 private long _originalCompanyId;
1179 private boolean _setOriginalCompanyId;
1180 private long _userId;
1181 private String _userUuid;
1182 private String _userName;
1183 private Date _createDate;
1184 private Date _modifiedDate;
1185 private long _repositoryId;
1186 private long _folderId;
1187 private long _originalFolderId;
1188 private boolean _setOriginalFolderId;
1189 private long _toFileEntryId;
1190 private long _originalToFileEntryId;
1191 private boolean _setOriginalToFileEntryId;
1192 private String _treePath;
1193 private boolean _active;
1194 private boolean _originalActive;
1195 private boolean _setOriginalActive;
1196 private int _status;
1197 private int _originalStatus;
1198 private boolean _setOriginalStatus;
1199 private long _statusByUserId;
1200 private String _statusByUserUuid;
1201 private String _statusByUserName;
1202 private Date _statusDate;
1203 private long _columnBitmask;
1204 private DLFileShortcut _escapedModel;
1205 }