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