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 (_escapedModel == null) {
849 _escapedModel = (DLFolder)ProxyUtil.newProxyInstance(_classLoader,
850 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
851 }
852
853 return _escapedModel;
854 }
855
856 @Override
857 public Object clone() {
858 DLFolderImpl dlFolderImpl = new DLFolderImpl();
859
860 dlFolderImpl.setUuid(getUuid());
861 dlFolderImpl.setFolderId(getFolderId());
862 dlFolderImpl.setGroupId(getGroupId());
863 dlFolderImpl.setCompanyId(getCompanyId());
864 dlFolderImpl.setUserId(getUserId());
865 dlFolderImpl.setUserName(getUserName());
866 dlFolderImpl.setCreateDate(getCreateDate());
867 dlFolderImpl.setModifiedDate(getModifiedDate());
868 dlFolderImpl.setRepositoryId(getRepositoryId());
869 dlFolderImpl.setMountPoint(getMountPoint());
870 dlFolderImpl.setParentFolderId(getParentFolderId());
871 dlFolderImpl.setName(getName());
872 dlFolderImpl.setDescription(getDescription());
873 dlFolderImpl.setLastPostDate(getLastPostDate());
874 dlFolderImpl.setDefaultFileEntryTypeId(getDefaultFileEntryTypeId());
875 dlFolderImpl.setHidden(getHidden());
876 dlFolderImpl.setOverrideFileEntryTypes(getOverrideFileEntryTypes());
877 dlFolderImpl.setStatus(getStatus());
878 dlFolderImpl.setStatusByUserId(getStatusByUserId());
879 dlFolderImpl.setStatusByUserName(getStatusByUserName());
880 dlFolderImpl.setStatusDate(getStatusDate());
881
882 dlFolderImpl.resetOriginalValues();
883
884 return dlFolderImpl;
885 }
886
887 public int compareTo(DLFolder dlFolder) {
888 int value = 0;
889
890 if (getParentFolderId() < dlFolder.getParentFolderId()) {
891 value = -1;
892 }
893 else if (getParentFolderId() > dlFolder.getParentFolderId()) {
894 value = 1;
895 }
896 else {
897 value = 0;
898 }
899
900 if (value != 0) {
901 return value;
902 }
903
904 value = getName().toLowerCase()
905 .compareTo(dlFolder.getName().toLowerCase());
906
907 if (value != 0) {
908 return value;
909 }
910
911 return 0;
912 }
913
914 @Override
915 public boolean equals(Object obj) {
916 if (obj == null) {
917 return false;
918 }
919
920 DLFolder dlFolder = null;
921
922 try {
923 dlFolder = (DLFolder)obj;
924 }
925 catch (ClassCastException cce) {
926 return false;
927 }
928
929 long primaryKey = dlFolder.getPrimaryKey();
930
931 if (getPrimaryKey() == primaryKey) {
932 return true;
933 }
934 else {
935 return false;
936 }
937 }
938
939 @Override
940 public int hashCode() {
941 return (int)getPrimaryKey();
942 }
943
944 @Override
945 public void resetOriginalValues() {
946 DLFolderModelImpl dlFolderModelImpl = this;
947
948 dlFolderModelImpl._originalUuid = dlFolderModelImpl._uuid;
949
950 dlFolderModelImpl._originalGroupId = dlFolderModelImpl._groupId;
951
952 dlFolderModelImpl._setOriginalGroupId = false;
953
954 dlFolderModelImpl._originalCompanyId = dlFolderModelImpl._companyId;
955
956 dlFolderModelImpl._setOriginalCompanyId = false;
957
958 dlFolderModelImpl._originalRepositoryId = dlFolderModelImpl._repositoryId;
959
960 dlFolderModelImpl._setOriginalRepositoryId = false;
961
962 dlFolderModelImpl._originalMountPoint = dlFolderModelImpl._mountPoint;
963
964 dlFolderModelImpl._setOriginalMountPoint = false;
965
966 dlFolderModelImpl._originalParentFolderId = dlFolderModelImpl._parentFolderId;
967
968 dlFolderModelImpl._setOriginalParentFolderId = false;
969
970 dlFolderModelImpl._originalName = dlFolderModelImpl._name;
971
972 dlFolderModelImpl._originalHidden = dlFolderModelImpl._hidden;
973
974 dlFolderModelImpl._setOriginalHidden = false;
975
976 dlFolderModelImpl._originalStatus = dlFolderModelImpl._status;
977
978 dlFolderModelImpl._setOriginalStatus = false;
979
980 dlFolderModelImpl._columnBitmask = 0;
981 }
982
983 @Override
984 public CacheModel<DLFolder> toCacheModel() {
985 DLFolderCacheModel dlFolderCacheModel = new DLFolderCacheModel();
986
987 dlFolderCacheModel.uuid = getUuid();
988
989 String uuid = dlFolderCacheModel.uuid;
990
991 if ((uuid != null) && (uuid.length() == 0)) {
992 dlFolderCacheModel.uuid = null;
993 }
994
995 dlFolderCacheModel.folderId = getFolderId();
996
997 dlFolderCacheModel.groupId = getGroupId();
998
999 dlFolderCacheModel.companyId = getCompanyId();
1000
1001 dlFolderCacheModel.userId = getUserId();
1002
1003 dlFolderCacheModel.userName = getUserName();
1004
1005 String userName = dlFolderCacheModel.userName;
1006
1007 if ((userName != null) && (userName.length() == 0)) {
1008 dlFolderCacheModel.userName = null;
1009 }
1010
1011 Date createDate = getCreateDate();
1012
1013 if (createDate != null) {
1014 dlFolderCacheModel.createDate = createDate.getTime();
1015 }
1016 else {
1017 dlFolderCacheModel.createDate = Long.MIN_VALUE;
1018 }
1019
1020 Date modifiedDate = getModifiedDate();
1021
1022 if (modifiedDate != null) {
1023 dlFolderCacheModel.modifiedDate = modifiedDate.getTime();
1024 }
1025 else {
1026 dlFolderCacheModel.modifiedDate = Long.MIN_VALUE;
1027 }
1028
1029 dlFolderCacheModel.repositoryId = getRepositoryId();
1030
1031 dlFolderCacheModel.mountPoint = getMountPoint();
1032
1033 dlFolderCacheModel.parentFolderId = getParentFolderId();
1034
1035 dlFolderCacheModel.name = getName();
1036
1037 String name = dlFolderCacheModel.name;
1038
1039 if ((name != null) && (name.length() == 0)) {
1040 dlFolderCacheModel.name = null;
1041 }
1042
1043 dlFolderCacheModel.description = getDescription();
1044
1045 String description = dlFolderCacheModel.description;
1046
1047 if ((description != null) && (description.length() == 0)) {
1048 dlFolderCacheModel.description = null;
1049 }
1050
1051 Date lastPostDate = getLastPostDate();
1052
1053 if (lastPostDate != null) {
1054 dlFolderCacheModel.lastPostDate = lastPostDate.getTime();
1055 }
1056 else {
1057 dlFolderCacheModel.lastPostDate = Long.MIN_VALUE;
1058 }
1059
1060 dlFolderCacheModel.defaultFileEntryTypeId = getDefaultFileEntryTypeId();
1061
1062 dlFolderCacheModel.hidden = getHidden();
1063
1064 dlFolderCacheModel.overrideFileEntryTypes = getOverrideFileEntryTypes();
1065
1066 dlFolderCacheModel.status = getStatus();
1067
1068 dlFolderCacheModel.statusByUserId = getStatusByUserId();
1069
1070 dlFolderCacheModel.statusByUserName = getStatusByUserName();
1071
1072 String statusByUserName = dlFolderCacheModel.statusByUserName;
1073
1074 if ((statusByUserName != null) && (statusByUserName.length() == 0)) {
1075 dlFolderCacheModel.statusByUserName = null;
1076 }
1077
1078 Date statusDate = getStatusDate();
1079
1080 if (statusDate != null) {
1081 dlFolderCacheModel.statusDate = statusDate.getTime();
1082 }
1083 else {
1084 dlFolderCacheModel.statusDate = Long.MIN_VALUE;
1085 }
1086
1087 return dlFolderCacheModel;
1088 }
1089
1090 @Override
1091 public String toString() {
1092 StringBundler sb = new StringBundler(43);
1093
1094 sb.append("{uuid=");
1095 sb.append(getUuid());
1096 sb.append(", folderId=");
1097 sb.append(getFolderId());
1098 sb.append(", groupId=");
1099 sb.append(getGroupId());
1100 sb.append(", companyId=");
1101 sb.append(getCompanyId());
1102 sb.append(", userId=");
1103 sb.append(getUserId());
1104 sb.append(", userName=");
1105 sb.append(getUserName());
1106 sb.append(", createDate=");
1107 sb.append(getCreateDate());
1108 sb.append(", modifiedDate=");
1109 sb.append(getModifiedDate());
1110 sb.append(", repositoryId=");
1111 sb.append(getRepositoryId());
1112 sb.append(", mountPoint=");
1113 sb.append(getMountPoint());
1114 sb.append(", parentFolderId=");
1115 sb.append(getParentFolderId());
1116 sb.append(", name=");
1117 sb.append(getName());
1118 sb.append(", description=");
1119 sb.append(getDescription());
1120 sb.append(", lastPostDate=");
1121 sb.append(getLastPostDate());
1122 sb.append(", defaultFileEntryTypeId=");
1123 sb.append(getDefaultFileEntryTypeId());
1124 sb.append(", hidden=");
1125 sb.append(getHidden());
1126 sb.append(", overrideFileEntryTypes=");
1127 sb.append(getOverrideFileEntryTypes());
1128 sb.append(", status=");
1129 sb.append(getStatus());
1130 sb.append(", statusByUserId=");
1131 sb.append(getStatusByUserId());
1132 sb.append(", statusByUserName=");
1133 sb.append(getStatusByUserName());
1134 sb.append(", statusDate=");
1135 sb.append(getStatusDate());
1136 sb.append("}");
1137
1138 return sb.toString();
1139 }
1140
1141 public String toXmlString() {
1142 StringBundler sb = new StringBundler(67);
1143
1144 sb.append("<model><model-name>");
1145 sb.append("com.liferay.portlet.documentlibrary.model.DLFolder");
1146 sb.append("</model-name>");
1147
1148 sb.append(
1149 "<column><column-name>uuid</column-name><column-value><![CDATA[");
1150 sb.append(getUuid());
1151 sb.append("]]></column-value></column>");
1152 sb.append(
1153 "<column><column-name>folderId</column-name><column-value><![CDATA[");
1154 sb.append(getFolderId());
1155 sb.append("]]></column-value></column>");
1156 sb.append(
1157 "<column><column-name>groupId</column-name><column-value><![CDATA[");
1158 sb.append(getGroupId());
1159 sb.append("]]></column-value></column>");
1160 sb.append(
1161 "<column><column-name>companyId</column-name><column-value><![CDATA[");
1162 sb.append(getCompanyId());
1163 sb.append("]]></column-value></column>");
1164 sb.append(
1165 "<column><column-name>userId</column-name><column-value><![CDATA[");
1166 sb.append(getUserId());
1167 sb.append("]]></column-value></column>");
1168 sb.append(
1169 "<column><column-name>userName</column-name><column-value><![CDATA[");
1170 sb.append(getUserName());
1171 sb.append("]]></column-value></column>");
1172 sb.append(
1173 "<column><column-name>createDate</column-name><column-value><![CDATA[");
1174 sb.append(getCreateDate());
1175 sb.append("]]></column-value></column>");
1176 sb.append(
1177 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
1178 sb.append(getModifiedDate());
1179 sb.append("]]></column-value></column>");
1180 sb.append(
1181 "<column><column-name>repositoryId</column-name><column-value><![CDATA[");
1182 sb.append(getRepositoryId());
1183 sb.append("]]></column-value></column>");
1184 sb.append(
1185 "<column><column-name>mountPoint</column-name><column-value><![CDATA[");
1186 sb.append(getMountPoint());
1187 sb.append("]]></column-value></column>");
1188 sb.append(
1189 "<column><column-name>parentFolderId</column-name><column-value><![CDATA[");
1190 sb.append(getParentFolderId());
1191 sb.append("]]></column-value></column>");
1192 sb.append(
1193 "<column><column-name>name</column-name><column-value><![CDATA[");
1194 sb.append(getName());
1195 sb.append("]]></column-value></column>");
1196 sb.append(
1197 "<column><column-name>description</column-name><column-value><![CDATA[");
1198 sb.append(getDescription());
1199 sb.append("]]></column-value></column>");
1200 sb.append(
1201 "<column><column-name>lastPostDate</column-name><column-value><![CDATA[");
1202 sb.append(getLastPostDate());
1203 sb.append("]]></column-value></column>");
1204 sb.append(
1205 "<column><column-name>defaultFileEntryTypeId</column-name><column-value><![CDATA[");
1206 sb.append(getDefaultFileEntryTypeId());
1207 sb.append("]]></column-value></column>");
1208 sb.append(
1209 "<column><column-name>hidden</column-name><column-value><![CDATA[");
1210 sb.append(getHidden());
1211 sb.append("]]></column-value></column>");
1212 sb.append(
1213 "<column><column-name>overrideFileEntryTypes</column-name><column-value><![CDATA[");
1214 sb.append(getOverrideFileEntryTypes());
1215 sb.append("]]></column-value></column>");
1216 sb.append(
1217 "<column><column-name>status</column-name><column-value><![CDATA[");
1218 sb.append(getStatus());
1219 sb.append("]]></column-value></column>");
1220 sb.append(
1221 "<column><column-name>statusByUserId</column-name><column-value><![CDATA[");
1222 sb.append(getStatusByUserId());
1223 sb.append("]]></column-value></column>");
1224 sb.append(
1225 "<column><column-name>statusByUserName</column-name><column-value><![CDATA[");
1226 sb.append(getStatusByUserName());
1227 sb.append("]]></column-value></column>");
1228 sb.append(
1229 "<column><column-name>statusDate</column-name><column-value><![CDATA[");
1230 sb.append(getStatusDate());
1231 sb.append("]]></column-value></column>");
1232
1233 sb.append("</model>");
1234
1235 return sb.toString();
1236 }
1237
1238 private static ClassLoader _classLoader = DLFolder.class.getClassLoader();
1239 private static Class<?>[] _escapedModelInterfaces = new Class[] {
1240 DLFolder.class
1241 };
1242 private String _uuid;
1243 private String _originalUuid;
1244 private long _folderId;
1245 private long _groupId;
1246 private long _originalGroupId;
1247 private boolean _setOriginalGroupId;
1248 private long _companyId;
1249 private long _originalCompanyId;
1250 private boolean _setOriginalCompanyId;
1251 private long _userId;
1252 private String _userUuid;
1253 private String _userName;
1254 private Date _createDate;
1255 private Date _modifiedDate;
1256 private long _repositoryId;
1257 private long _originalRepositoryId;
1258 private boolean _setOriginalRepositoryId;
1259 private boolean _mountPoint;
1260 private boolean _originalMountPoint;
1261 private boolean _setOriginalMountPoint;
1262 private long _parentFolderId;
1263 private long _originalParentFolderId;
1264 private boolean _setOriginalParentFolderId;
1265 private String _name;
1266 private String _originalName;
1267 private String _description;
1268 private Date _lastPostDate;
1269 private long _defaultFileEntryTypeId;
1270 private boolean _hidden;
1271 private boolean _originalHidden;
1272 private boolean _setOriginalHidden;
1273 private boolean _overrideFileEntryTypes;
1274 private int _status;
1275 private int _originalStatus;
1276 private boolean _setOriginalStatus;
1277 private long _statusByUserId;
1278 private String _statusByUserUuid;
1279 private String _statusByUserName;
1280 private Date _statusDate;
1281 private long _columnBitmask;
1282 private DLFolder _escapedModel;
1283 }