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.DLFileEntry;
038 import com.liferay.portlet.documentlibrary.model.DLFileEntryModel;
039 import com.liferay.portlet.documentlibrary.model.DLFileEntrySoap;
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 DLFileEntryModelImpl extends BaseModelImpl<DLFileEntry>
070 implements DLFileEntryModel {
071
076 public static final String TABLE_NAME = "DLFileEntry";
077 public static final Object[][] TABLE_COLUMNS = {
078 { "uuid_", Types.VARCHAR },
079 { "fileEntryId", 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 { "classNameId", Types.BIGINT },
087 { "classPK", Types.BIGINT },
088 { "repositoryId", Types.BIGINT },
089 { "folderId", Types.BIGINT },
090 { "treePath", Types.VARCHAR },
091 { "name", Types.VARCHAR },
092 { "extension", Types.VARCHAR },
093 { "mimeType", Types.VARCHAR },
094 { "title", Types.VARCHAR },
095 { "description", Types.VARCHAR },
096 { "extraSettings", Types.CLOB },
097 { "fileEntryTypeId", Types.BIGINT },
098 { "version", Types.VARCHAR },
099 { "size_", Types.BIGINT },
100 { "readCount", Types.INTEGER },
101 { "smallImageId", Types.BIGINT },
102 { "largeImageId", Types.BIGINT },
103 { "custom1ImageId", Types.BIGINT },
104 { "custom2ImageId", Types.BIGINT },
105 { "manualCheckInRequired", Types.BOOLEAN }
106 };
107 public static final String TABLE_SQL_CREATE = "create table DLFileEntry (uuid_ VARCHAR(75) null,fileEntryId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,classNameId LONG,classPK LONG,repositoryId LONG,folderId LONG,treePath STRING null,name VARCHAR(255) null,extension VARCHAR(75) null,mimeType VARCHAR(75) null,title VARCHAR(255) null,description STRING null,extraSettings TEXT null,fileEntryTypeId LONG,version VARCHAR(75) null,size_ LONG,readCount INTEGER,smallImageId LONG,largeImageId LONG,custom1ImageId LONG,custom2ImageId LONG,manualCheckInRequired BOOLEAN)";
108 public static final String TABLE_SQL_DROP = "drop table DLFileEntry";
109 public static final String ORDER_BY_JPQL = " ORDER BY dlFileEntry.folderId ASC, dlFileEntry.name ASC";
110 public static final String ORDER_BY_SQL = " ORDER BY DLFileEntry.folderId ASC, DLFileEntry.name ASC";
111 public static final String DATA_SOURCE = "liferayDataSource";
112 public static final String SESSION_FACTORY = "liferaySessionFactory";
113 public static final String TX_MANAGER = "liferayTransactionManager";
114 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
115 "value.object.entity.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileEntry"),
116 true);
117 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
118 "value.object.finder.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileEntry"),
119 true);
120 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
121 "value.object.column.bitmask.enabled.com.liferay.portlet.documentlibrary.model.DLFileEntry"),
122 true);
123 public static long COMPANYID_COLUMN_BITMASK = 1L;
124 public static long FILEENTRYTYPEID_COLUMN_BITMASK = 2L;
125 public static long FOLDERID_COLUMN_BITMASK = 4L;
126 public static long GROUPID_COLUMN_BITMASK = 8L;
127 public static long MIMETYPE_COLUMN_BITMASK = 16L;
128 public static long NAME_COLUMN_BITMASK = 32L;
129 public static long REPOSITORYID_COLUMN_BITMASK = 64L;
130 public static long TITLE_COLUMN_BITMASK = 128L;
131 public static long USERID_COLUMN_BITMASK = 256L;
132 public static long UUID_COLUMN_BITMASK = 512L;
133
134
140 public static DLFileEntry toModel(DLFileEntrySoap soapModel) {
141 if (soapModel == null) {
142 return null;
143 }
144
145 DLFileEntry model = new DLFileEntryImpl();
146
147 model.setUuid(soapModel.getUuid());
148 model.setFileEntryId(soapModel.getFileEntryId());
149 model.setGroupId(soapModel.getGroupId());
150 model.setCompanyId(soapModel.getCompanyId());
151 model.setUserId(soapModel.getUserId());
152 model.setUserName(soapModel.getUserName());
153 model.setCreateDate(soapModel.getCreateDate());
154 model.setModifiedDate(soapModel.getModifiedDate());
155 model.setClassNameId(soapModel.getClassNameId());
156 model.setClassPK(soapModel.getClassPK());
157 model.setRepositoryId(soapModel.getRepositoryId());
158 model.setFolderId(soapModel.getFolderId());
159 model.setTreePath(soapModel.getTreePath());
160 model.setName(soapModel.getName());
161 model.setExtension(soapModel.getExtension());
162 model.setMimeType(soapModel.getMimeType());
163 model.setTitle(soapModel.getTitle());
164 model.setDescription(soapModel.getDescription());
165 model.setExtraSettings(soapModel.getExtraSettings());
166 model.setFileEntryTypeId(soapModel.getFileEntryTypeId());
167 model.setVersion(soapModel.getVersion());
168 model.setSize(soapModel.getSize());
169 model.setReadCount(soapModel.getReadCount());
170 model.setSmallImageId(soapModel.getSmallImageId());
171 model.setLargeImageId(soapModel.getLargeImageId());
172 model.setCustom1ImageId(soapModel.getCustom1ImageId());
173 model.setCustom2ImageId(soapModel.getCustom2ImageId());
174 model.setManualCheckInRequired(soapModel.getManualCheckInRequired());
175
176 return model;
177 }
178
179
185 public static List<DLFileEntry> toModels(DLFileEntrySoap[] soapModels) {
186 if (soapModels == null) {
187 return null;
188 }
189
190 List<DLFileEntry> models = new ArrayList<DLFileEntry>(soapModels.length);
191
192 for (DLFileEntrySoap soapModel : soapModels) {
193 models.add(toModel(soapModel));
194 }
195
196 return models;
197 }
198
199 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
200 "lock.expiration.time.com.liferay.portlet.documentlibrary.model.DLFileEntry"));
201
202 public DLFileEntryModelImpl() {
203 }
204
205 @Override
206 public long getPrimaryKey() {
207 return _fileEntryId;
208 }
209
210 @Override
211 public void setPrimaryKey(long primaryKey) {
212 setFileEntryId(primaryKey);
213 }
214
215 @Override
216 public Serializable getPrimaryKeyObj() {
217 return _fileEntryId;
218 }
219
220 @Override
221 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
222 setPrimaryKey(((Long)primaryKeyObj).longValue());
223 }
224
225 @Override
226 public Class<?> getModelClass() {
227 return DLFileEntry.class;
228 }
229
230 @Override
231 public String getModelClassName() {
232 return DLFileEntry.class.getName();
233 }
234
235 @Override
236 public Map<String, Object> getModelAttributes() {
237 Map<String, Object> attributes = new HashMap<String, Object>();
238
239 attributes.put("uuid", getUuid());
240 attributes.put("fileEntryId", getFileEntryId());
241 attributes.put("groupId", getGroupId());
242 attributes.put("companyId", getCompanyId());
243 attributes.put("userId", getUserId());
244 attributes.put("userName", getUserName());
245 attributes.put("createDate", getCreateDate());
246 attributes.put("modifiedDate", getModifiedDate());
247 attributes.put("classNameId", getClassNameId());
248 attributes.put("classPK", getClassPK());
249 attributes.put("repositoryId", getRepositoryId());
250 attributes.put("folderId", getFolderId());
251 attributes.put("treePath", getTreePath());
252 attributes.put("name", getName());
253 attributes.put("extension", getExtension());
254 attributes.put("mimeType", getMimeType());
255 attributes.put("title", getTitle());
256 attributes.put("description", getDescription());
257 attributes.put("extraSettings", getExtraSettings());
258 attributes.put("fileEntryTypeId", getFileEntryTypeId());
259 attributes.put("version", getVersion());
260 attributes.put("size", getSize());
261 attributes.put("readCount", getReadCount());
262 attributes.put("smallImageId", getSmallImageId());
263 attributes.put("largeImageId", getLargeImageId());
264 attributes.put("custom1ImageId", getCustom1ImageId());
265 attributes.put("custom2ImageId", getCustom2ImageId());
266 attributes.put("manualCheckInRequired", getManualCheckInRequired());
267
268 return attributes;
269 }
270
271 @Override
272 public void setModelAttributes(Map<String, Object> attributes) {
273 String uuid = (String)attributes.get("uuid");
274
275 if (uuid != null) {
276 setUuid(uuid);
277 }
278
279 Long fileEntryId = (Long)attributes.get("fileEntryId");
280
281 if (fileEntryId != null) {
282 setFileEntryId(fileEntryId);
283 }
284
285 Long groupId = (Long)attributes.get("groupId");
286
287 if (groupId != null) {
288 setGroupId(groupId);
289 }
290
291 Long companyId = (Long)attributes.get("companyId");
292
293 if (companyId != null) {
294 setCompanyId(companyId);
295 }
296
297 Long userId = (Long)attributes.get("userId");
298
299 if (userId != null) {
300 setUserId(userId);
301 }
302
303 String userName = (String)attributes.get("userName");
304
305 if (userName != null) {
306 setUserName(userName);
307 }
308
309 Date createDate = (Date)attributes.get("createDate");
310
311 if (createDate != null) {
312 setCreateDate(createDate);
313 }
314
315 Date modifiedDate = (Date)attributes.get("modifiedDate");
316
317 if (modifiedDate != null) {
318 setModifiedDate(modifiedDate);
319 }
320
321 Long classNameId = (Long)attributes.get("classNameId");
322
323 if (classNameId != null) {
324 setClassNameId(classNameId);
325 }
326
327 Long classPK = (Long)attributes.get("classPK");
328
329 if (classPK != null) {
330 setClassPK(classPK);
331 }
332
333 Long repositoryId = (Long)attributes.get("repositoryId");
334
335 if (repositoryId != null) {
336 setRepositoryId(repositoryId);
337 }
338
339 Long folderId = (Long)attributes.get("folderId");
340
341 if (folderId != null) {
342 setFolderId(folderId);
343 }
344
345 String treePath = (String)attributes.get("treePath");
346
347 if (treePath != null) {
348 setTreePath(treePath);
349 }
350
351 String name = (String)attributes.get("name");
352
353 if (name != null) {
354 setName(name);
355 }
356
357 String extension = (String)attributes.get("extension");
358
359 if (extension != null) {
360 setExtension(extension);
361 }
362
363 String mimeType = (String)attributes.get("mimeType");
364
365 if (mimeType != null) {
366 setMimeType(mimeType);
367 }
368
369 String title = (String)attributes.get("title");
370
371 if (title != null) {
372 setTitle(title);
373 }
374
375 String description = (String)attributes.get("description");
376
377 if (description != null) {
378 setDescription(description);
379 }
380
381 String extraSettings = (String)attributes.get("extraSettings");
382
383 if (extraSettings != null) {
384 setExtraSettings(extraSettings);
385 }
386
387 Long fileEntryTypeId = (Long)attributes.get("fileEntryTypeId");
388
389 if (fileEntryTypeId != null) {
390 setFileEntryTypeId(fileEntryTypeId);
391 }
392
393 String version = (String)attributes.get("version");
394
395 if (version != null) {
396 setVersion(version);
397 }
398
399 Long size = (Long)attributes.get("size");
400
401 if (size != null) {
402 setSize(size);
403 }
404
405 Integer readCount = (Integer)attributes.get("readCount");
406
407 if (readCount != null) {
408 setReadCount(readCount);
409 }
410
411 Long smallImageId = (Long)attributes.get("smallImageId");
412
413 if (smallImageId != null) {
414 setSmallImageId(smallImageId);
415 }
416
417 Long largeImageId = (Long)attributes.get("largeImageId");
418
419 if (largeImageId != null) {
420 setLargeImageId(largeImageId);
421 }
422
423 Long custom1ImageId = (Long)attributes.get("custom1ImageId");
424
425 if (custom1ImageId != null) {
426 setCustom1ImageId(custom1ImageId);
427 }
428
429 Long custom2ImageId = (Long)attributes.get("custom2ImageId");
430
431 if (custom2ImageId != null) {
432 setCustom2ImageId(custom2ImageId);
433 }
434
435 Boolean manualCheckInRequired = (Boolean)attributes.get(
436 "manualCheckInRequired");
437
438 if (manualCheckInRequired != null) {
439 setManualCheckInRequired(manualCheckInRequired);
440 }
441 }
442
443 @JSON
444 @Override
445 public String getUuid() {
446 if (_uuid == null) {
447 return StringPool.BLANK;
448 }
449 else {
450 return _uuid;
451 }
452 }
453
454 @Override
455 public void setUuid(String uuid) {
456 if (_originalUuid == null) {
457 _originalUuid = _uuid;
458 }
459
460 _uuid = uuid;
461 }
462
463 public String getOriginalUuid() {
464 return GetterUtil.getString(_originalUuid);
465 }
466
467 @JSON
468 @Override
469 public long getFileEntryId() {
470 return _fileEntryId;
471 }
472
473 @Override
474 public void setFileEntryId(long fileEntryId) {
475 _fileEntryId = fileEntryId;
476 }
477
478 @JSON
479 @Override
480 public long getGroupId() {
481 return _groupId;
482 }
483
484 @Override
485 public void setGroupId(long groupId) {
486 _columnBitmask |= GROUPID_COLUMN_BITMASK;
487
488 if (!_setOriginalGroupId) {
489 _setOriginalGroupId = true;
490
491 _originalGroupId = _groupId;
492 }
493
494 _groupId = groupId;
495 }
496
497 public long getOriginalGroupId() {
498 return _originalGroupId;
499 }
500
501 @JSON
502 @Override
503 public long getCompanyId() {
504 return _companyId;
505 }
506
507 @Override
508 public void setCompanyId(long companyId) {
509 _columnBitmask |= COMPANYID_COLUMN_BITMASK;
510
511 if (!_setOriginalCompanyId) {
512 _setOriginalCompanyId = true;
513
514 _originalCompanyId = _companyId;
515 }
516
517 _companyId = companyId;
518 }
519
520 public long getOriginalCompanyId() {
521 return _originalCompanyId;
522 }
523
524 @JSON
525 @Override
526 public long getUserId() {
527 return _userId;
528 }
529
530 @Override
531 public void setUserId(long userId) {
532 _columnBitmask |= USERID_COLUMN_BITMASK;
533
534 if (!_setOriginalUserId) {
535 _setOriginalUserId = true;
536
537 _originalUserId = _userId;
538 }
539
540 _userId = userId;
541 }
542
543 @Override
544 public String getUserUuid() throws SystemException {
545 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
546 }
547
548 @Override
549 public void setUserUuid(String userUuid) {
550 _userUuid = userUuid;
551 }
552
553 public long getOriginalUserId() {
554 return _originalUserId;
555 }
556
557 @JSON
558 @Override
559 public String getUserName() {
560 if (_userName == null) {
561 return StringPool.BLANK;
562 }
563 else {
564 return _userName;
565 }
566 }
567
568 @Override
569 public void setUserName(String userName) {
570 _userName = userName;
571 }
572
573 @JSON
574 @Override
575 public Date getCreateDate() {
576 return _createDate;
577 }
578
579 @Override
580 public void setCreateDate(Date createDate) {
581 _createDate = createDate;
582 }
583
584 @JSON
585 @Override
586 public Date getModifiedDate() {
587 return _modifiedDate;
588 }
589
590 @Override
591 public void setModifiedDate(Date modifiedDate) {
592 _modifiedDate = modifiedDate;
593 }
594
595 @Override
596 public String getClassName() {
597 if (getClassNameId() <= 0) {
598 return StringPool.BLANK;
599 }
600
601 return PortalUtil.getClassName(getClassNameId());
602 }
603
604 @Override
605 public void setClassName(String className) {
606 long classNameId = 0;
607
608 if (Validator.isNotNull(className)) {
609 classNameId = PortalUtil.getClassNameId(className);
610 }
611
612 setClassNameId(classNameId);
613 }
614
615 @JSON
616 @Override
617 public long getClassNameId() {
618 return _classNameId;
619 }
620
621 @Override
622 public void setClassNameId(long classNameId) {
623 _classNameId = classNameId;
624 }
625
626 @JSON
627 @Override
628 public long getClassPK() {
629 return _classPK;
630 }
631
632 @Override
633 public void setClassPK(long classPK) {
634 _classPK = classPK;
635 }
636
637 @JSON
638 @Override
639 public long getRepositoryId() {
640 return _repositoryId;
641 }
642
643 @Override
644 public void setRepositoryId(long repositoryId) {
645 _columnBitmask |= REPOSITORYID_COLUMN_BITMASK;
646
647 if (!_setOriginalRepositoryId) {
648 _setOriginalRepositoryId = true;
649
650 _originalRepositoryId = _repositoryId;
651 }
652
653 _repositoryId = repositoryId;
654 }
655
656 public long getOriginalRepositoryId() {
657 return _originalRepositoryId;
658 }
659
660 @JSON
661 @Override
662 public long getFolderId() {
663 return _folderId;
664 }
665
666 @Override
667 public void setFolderId(long folderId) {
668 _columnBitmask = -1L;
669
670 if (!_setOriginalFolderId) {
671 _setOriginalFolderId = true;
672
673 _originalFolderId = _folderId;
674 }
675
676 _folderId = folderId;
677 }
678
679 public long getOriginalFolderId() {
680 return _originalFolderId;
681 }
682
683 @JSON
684 @Override
685 public String getTreePath() {
686 if (_treePath == null) {
687 return StringPool.BLANK;
688 }
689 else {
690 return _treePath;
691 }
692 }
693
694 @Override
695 public void setTreePath(String treePath) {
696 _treePath = treePath;
697 }
698
699 @JSON
700 @Override
701 public String getName() {
702 if (_name == null) {
703 return StringPool.BLANK;
704 }
705 else {
706 return _name;
707 }
708 }
709
710 @Override
711 public void setName(String name) {
712 _columnBitmask = -1L;
713
714 if (_originalName == null) {
715 _originalName = _name;
716 }
717
718 _name = name;
719 }
720
721 public String getOriginalName() {
722 return GetterUtil.getString(_originalName);
723 }
724
725 @JSON
726 @Override
727 public String getExtension() {
728 if (_extension == null) {
729 return StringPool.BLANK;
730 }
731 else {
732 return _extension;
733 }
734 }
735
736 @Override
737 public void setExtension(String extension) {
738 _extension = extension;
739 }
740
741 @JSON
742 @Override
743 public String getMimeType() {
744 if (_mimeType == null) {
745 return StringPool.BLANK;
746 }
747 else {
748 return _mimeType;
749 }
750 }
751
752 @Override
753 public void setMimeType(String mimeType) {
754 _columnBitmask |= MIMETYPE_COLUMN_BITMASK;
755
756 if (_originalMimeType == null) {
757 _originalMimeType = _mimeType;
758 }
759
760 _mimeType = mimeType;
761 }
762
763 public String getOriginalMimeType() {
764 return GetterUtil.getString(_originalMimeType);
765 }
766
767 @JSON
768 @Override
769 public String getTitle() {
770 if (_title == null) {
771 return StringPool.BLANK;
772 }
773 else {
774 return _title;
775 }
776 }
777
778 @Override
779 public void setTitle(String title) {
780 _columnBitmask |= TITLE_COLUMN_BITMASK;
781
782 if (_originalTitle == null) {
783 _originalTitle = _title;
784 }
785
786 _title = title;
787 }
788
789 public String getOriginalTitle() {
790 return GetterUtil.getString(_originalTitle);
791 }
792
793 @JSON
794 @Override
795 public String getDescription() {
796 if (_description == null) {
797 return StringPool.BLANK;
798 }
799 else {
800 return _description;
801 }
802 }
803
804 @Override
805 public void setDescription(String description) {
806 _description = description;
807 }
808
809 @JSON
810 @Override
811 public String getExtraSettings() {
812 if (_extraSettings == null) {
813 return StringPool.BLANK;
814 }
815 else {
816 return _extraSettings;
817 }
818 }
819
820 @Override
821 public void setExtraSettings(String extraSettings) {
822 _extraSettings = extraSettings;
823 }
824
825 @JSON
826 @Override
827 public long getFileEntryTypeId() {
828 return _fileEntryTypeId;
829 }
830
831 @Override
832 public void setFileEntryTypeId(long fileEntryTypeId) {
833 _columnBitmask |= FILEENTRYTYPEID_COLUMN_BITMASK;
834
835 if (!_setOriginalFileEntryTypeId) {
836 _setOriginalFileEntryTypeId = true;
837
838 _originalFileEntryTypeId = _fileEntryTypeId;
839 }
840
841 _fileEntryTypeId = fileEntryTypeId;
842 }
843
844 public long getOriginalFileEntryTypeId() {
845 return _originalFileEntryTypeId;
846 }
847
848 @JSON
849 @Override
850 public String getVersion() {
851 if (_version == null) {
852 return StringPool.BLANK;
853 }
854 else {
855 return _version;
856 }
857 }
858
859 @Override
860 public void setVersion(String version) {
861 _version = version;
862 }
863
864 @JSON
865 @Override
866 public long getSize() {
867 return _size;
868 }
869
870 @Override
871 public void setSize(long size) {
872 _size = size;
873 }
874
875 @JSON
876 @Override
877 public int getReadCount() {
878 return _readCount;
879 }
880
881 @Override
882 public void setReadCount(int readCount) {
883 _readCount = readCount;
884 }
885
886 @JSON
887 @Override
888 public long getSmallImageId() {
889 return _smallImageId;
890 }
891
892 @Override
893 public void setSmallImageId(long smallImageId) {
894 _smallImageId = smallImageId;
895 }
896
897 @JSON
898 @Override
899 public long getLargeImageId() {
900 return _largeImageId;
901 }
902
903 @Override
904 public void setLargeImageId(long largeImageId) {
905 _largeImageId = largeImageId;
906 }
907
908 @JSON
909 @Override
910 public long getCustom1ImageId() {
911 return _custom1ImageId;
912 }
913
914 @Override
915 public void setCustom1ImageId(long custom1ImageId) {
916 _custom1ImageId = custom1ImageId;
917 }
918
919 @JSON
920 @Override
921 public long getCustom2ImageId() {
922 return _custom2ImageId;
923 }
924
925 @Override
926 public void setCustom2ImageId(long custom2ImageId) {
927 _custom2ImageId = custom2ImageId;
928 }
929
930 @JSON
931 @Override
932 public boolean getManualCheckInRequired() {
933 return _manualCheckInRequired;
934 }
935
936 @Override
937 public boolean isManualCheckInRequired() {
938 return _manualCheckInRequired;
939 }
940
941 @Override
942 public void setManualCheckInRequired(boolean manualCheckInRequired) {
943 _manualCheckInRequired = manualCheckInRequired;
944 }
945
946 @Override
947 public StagedModelType getStagedModelType() {
948 return new StagedModelType(PortalUtil.getClassNameId(
949 DLFileEntry.class.getName()), getClassNameId());
950 }
951
952 @Override
953 public int getStatus() {
954 return 0;
955 }
956
957 @Override
958 public TrashEntry getTrashEntry() throws PortalException, SystemException {
959 if (!isInTrash()) {
960 return null;
961 }
962
963 TrashEntry trashEntry = TrashEntryLocalServiceUtil.fetchEntry(getModelClassName(),
964 getTrashEntryClassPK());
965
966 if (trashEntry != null) {
967 return trashEntry;
968 }
969
970 TrashHandler trashHandler = getTrashHandler();
971
972 if (!Validator.isNull(trashHandler.getContainerModelClassName())) {
973 ContainerModel containerModel = trashHandler.getParentContainerModel(this);
974
975 while (containerModel != null) {
976 if (containerModel instanceof TrashedModel) {
977 TrashedModel trashedModel = (TrashedModel)containerModel;
978
979 return trashedModel.getTrashEntry();
980 }
981
982 trashHandler = TrashHandlerRegistryUtil.getTrashHandler(trashHandler.getContainerModelClassName());
983
984 if (trashHandler == null) {
985 return null;
986 }
987
988 containerModel = trashHandler.getContainerModel(containerModel.getParentContainerModelId());
989 }
990 }
991
992 return null;
993 }
994
995 @Override
996 public long getTrashEntryClassPK() {
997 return getPrimaryKey();
998 }
999
1000 @Override
1001 public TrashHandler getTrashHandler() {
1002 return TrashHandlerRegistryUtil.getTrashHandler(getModelClassName());
1003 }
1004
1005 @Override
1006 public boolean isInTrash() {
1007 if (getStatus() == WorkflowConstants.STATUS_IN_TRASH) {
1008 return true;
1009 }
1010 else {
1011 return false;
1012 }
1013 }
1014
1015 @Override
1016 public boolean isInTrashContainer() {
1017 TrashHandler trashHandler = getTrashHandler();
1018
1019 if ((trashHandler == null) ||
1020 Validator.isNull(trashHandler.getContainerModelClassName())) {
1021 return false;
1022 }
1023
1024 try {
1025 ContainerModel containerModel = trashHandler.getParentContainerModel(this);
1026
1027 if (containerModel == null) {
1028 return false;
1029 }
1030
1031 if (containerModel instanceof TrashedModel) {
1032 return ((TrashedModel)containerModel).isInTrash();
1033 }
1034 }
1035 catch (Exception e) {
1036 }
1037
1038 return false;
1039 }
1040
1041 public long getColumnBitmask() {
1042 return _columnBitmask;
1043 }
1044
1045 @Override
1046 public ExpandoBridge getExpandoBridge() {
1047 return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
1048 DLFileEntry.class.getName(), getPrimaryKey());
1049 }
1050
1051 @Override
1052 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
1053 ExpandoBridge expandoBridge = getExpandoBridge();
1054
1055 expandoBridge.setAttributes(serviceContext);
1056 }
1057
1058 @Override
1059 public DLFileEntry toEscapedModel() {
1060 if (_escapedModel == null) {
1061 _escapedModel = (DLFileEntry)ProxyUtil.newProxyInstance(_classLoader,
1062 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
1063 }
1064
1065 return _escapedModel;
1066 }
1067
1068 @Override
1069 public Object clone() {
1070 DLFileEntryImpl dlFileEntryImpl = new DLFileEntryImpl();
1071
1072 dlFileEntryImpl.setUuid(getUuid());
1073 dlFileEntryImpl.setFileEntryId(getFileEntryId());
1074 dlFileEntryImpl.setGroupId(getGroupId());
1075 dlFileEntryImpl.setCompanyId(getCompanyId());
1076 dlFileEntryImpl.setUserId(getUserId());
1077 dlFileEntryImpl.setUserName(getUserName());
1078 dlFileEntryImpl.setCreateDate(getCreateDate());
1079 dlFileEntryImpl.setModifiedDate(getModifiedDate());
1080 dlFileEntryImpl.setClassNameId(getClassNameId());
1081 dlFileEntryImpl.setClassPK(getClassPK());
1082 dlFileEntryImpl.setRepositoryId(getRepositoryId());
1083 dlFileEntryImpl.setFolderId(getFolderId());
1084 dlFileEntryImpl.setTreePath(getTreePath());
1085 dlFileEntryImpl.setName(getName());
1086 dlFileEntryImpl.setExtension(getExtension());
1087 dlFileEntryImpl.setMimeType(getMimeType());
1088 dlFileEntryImpl.setTitle(getTitle());
1089 dlFileEntryImpl.setDescription(getDescription());
1090 dlFileEntryImpl.setExtraSettings(getExtraSettings());
1091 dlFileEntryImpl.setFileEntryTypeId(getFileEntryTypeId());
1092 dlFileEntryImpl.setVersion(getVersion());
1093 dlFileEntryImpl.setSize(getSize());
1094 dlFileEntryImpl.setReadCount(getReadCount());
1095 dlFileEntryImpl.setSmallImageId(getSmallImageId());
1096 dlFileEntryImpl.setLargeImageId(getLargeImageId());
1097 dlFileEntryImpl.setCustom1ImageId(getCustom1ImageId());
1098 dlFileEntryImpl.setCustom2ImageId(getCustom2ImageId());
1099 dlFileEntryImpl.setManualCheckInRequired(getManualCheckInRequired());
1100
1101 dlFileEntryImpl.resetOriginalValues();
1102
1103 return dlFileEntryImpl;
1104 }
1105
1106 @Override
1107 public int compareTo(DLFileEntry dlFileEntry) {
1108 int value = 0;
1109
1110 if (getFolderId() < dlFileEntry.getFolderId()) {
1111 value = -1;
1112 }
1113 else if (getFolderId() > dlFileEntry.getFolderId()) {
1114 value = 1;
1115 }
1116 else {
1117 value = 0;
1118 }
1119
1120 if (value != 0) {
1121 return value;
1122 }
1123
1124 value = getName().compareTo(dlFileEntry.getName());
1125
1126 if (value != 0) {
1127 return value;
1128 }
1129
1130 return 0;
1131 }
1132
1133 @Override
1134 public boolean equals(Object obj) {
1135 if (this == obj) {
1136 return true;
1137 }
1138
1139 if (!(obj instanceof DLFileEntry)) {
1140 return false;
1141 }
1142
1143 DLFileEntry dlFileEntry = (DLFileEntry)obj;
1144
1145 long primaryKey = dlFileEntry.getPrimaryKey();
1146
1147 if (getPrimaryKey() == primaryKey) {
1148 return true;
1149 }
1150 else {
1151 return false;
1152 }
1153 }
1154
1155 @Override
1156 public int hashCode() {
1157 return (int)getPrimaryKey();
1158 }
1159
1160 @Override
1161 public void resetOriginalValues() {
1162 DLFileEntryModelImpl dlFileEntryModelImpl = this;
1163
1164 dlFileEntryModelImpl._originalUuid = dlFileEntryModelImpl._uuid;
1165
1166 dlFileEntryModelImpl._originalGroupId = dlFileEntryModelImpl._groupId;
1167
1168 dlFileEntryModelImpl._setOriginalGroupId = false;
1169
1170 dlFileEntryModelImpl._originalCompanyId = dlFileEntryModelImpl._companyId;
1171
1172 dlFileEntryModelImpl._setOriginalCompanyId = false;
1173
1174 dlFileEntryModelImpl._originalUserId = dlFileEntryModelImpl._userId;
1175
1176 dlFileEntryModelImpl._setOriginalUserId = false;
1177
1178 dlFileEntryModelImpl._originalRepositoryId = dlFileEntryModelImpl._repositoryId;
1179
1180 dlFileEntryModelImpl._setOriginalRepositoryId = false;
1181
1182 dlFileEntryModelImpl._originalFolderId = dlFileEntryModelImpl._folderId;
1183
1184 dlFileEntryModelImpl._setOriginalFolderId = false;
1185
1186 dlFileEntryModelImpl._originalName = dlFileEntryModelImpl._name;
1187
1188 dlFileEntryModelImpl._originalMimeType = dlFileEntryModelImpl._mimeType;
1189
1190 dlFileEntryModelImpl._originalTitle = dlFileEntryModelImpl._title;
1191
1192 dlFileEntryModelImpl._originalFileEntryTypeId = dlFileEntryModelImpl._fileEntryTypeId;
1193
1194 dlFileEntryModelImpl._setOriginalFileEntryTypeId = false;
1195
1196 dlFileEntryModelImpl._columnBitmask = 0;
1197 }
1198
1199 @Override
1200 public CacheModel<DLFileEntry> toCacheModel() {
1201 DLFileEntryCacheModel dlFileEntryCacheModel = new DLFileEntryCacheModel();
1202
1203 dlFileEntryCacheModel.uuid = getUuid();
1204
1205 String uuid = dlFileEntryCacheModel.uuid;
1206
1207 if ((uuid != null) && (uuid.length() == 0)) {
1208 dlFileEntryCacheModel.uuid = null;
1209 }
1210
1211 dlFileEntryCacheModel.fileEntryId = getFileEntryId();
1212
1213 dlFileEntryCacheModel.groupId = getGroupId();
1214
1215 dlFileEntryCacheModel.companyId = getCompanyId();
1216
1217 dlFileEntryCacheModel.userId = getUserId();
1218
1219 dlFileEntryCacheModel.userName = getUserName();
1220
1221 String userName = dlFileEntryCacheModel.userName;
1222
1223 if ((userName != null) && (userName.length() == 0)) {
1224 dlFileEntryCacheModel.userName = null;
1225 }
1226
1227 Date createDate = getCreateDate();
1228
1229 if (createDate != null) {
1230 dlFileEntryCacheModel.createDate = createDate.getTime();
1231 }
1232 else {
1233 dlFileEntryCacheModel.createDate = Long.MIN_VALUE;
1234 }
1235
1236 Date modifiedDate = getModifiedDate();
1237
1238 if (modifiedDate != null) {
1239 dlFileEntryCacheModel.modifiedDate = modifiedDate.getTime();
1240 }
1241 else {
1242 dlFileEntryCacheModel.modifiedDate = Long.MIN_VALUE;
1243 }
1244
1245 dlFileEntryCacheModel.classNameId = getClassNameId();
1246
1247 dlFileEntryCacheModel.classPK = getClassPK();
1248
1249 dlFileEntryCacheModel.repositoryId = getRepositoryId();
1250
1251 dlFileEntryCacheModel.folderId = getFolderId();
1252
1253 dlFileEntryCacheModel.treePath = getTreePath();
1254
1255 String treePath = dlFileEntryCacheModel.treePath;
1256
1257 if ((treePath != null) && (treePath.length() == 0)) {
1258 dlFileEntryCacheModel.treePath = null;
1259 }
1260
1261 dlFileEntryCacheModel.name = getName();
1262
1263 String name = dlFileEntryCacheModel.name;
1264
1265 if ((name != null) && (name.length() == 0)) {
1266 dlFileEntryCacheModel.name = null;
1267 }
1268
1269 dlFileEntryCacheModel.extension = getExtension();
1270
1271 String extension = dlFileEntryCacheModel.extension;
1272
1273 if ((extension != null) && (extension.length() == 0)) {
1274 dlFileEntryCacheModel.extension = null;
1275 }
1276
1277 dlFileEntryCacheModel.mimeType = getMimeType();
1278
1279 String mimeType = dlFileEntryCacheModel.mimeType;
1280
1281 if ((mimeType != null) && (mimeType.length() == 0)) {
1282 dlFileEntryCacheModel.mimeType = null;
1283 }
1284
1285 dlFileEntryCacheModel.title = getTitle();
1286
1287 String title = dlFileEntryCacheModel.title;
1288
1289 if ((title != null) && (title.length() == 0)) {
1290 dlFileEntryCacheModel.title = null;
1291 }
1292
1293 dlFileEntryCacheModel.description = getDescription();
1294
1295 String description = dlFileEntryCacheModel.description;
1296
1297 if ((description != null) && (description.length() == 0)) {
1298 dlFileEntryCacheModel.description = null;
1299 }
1300
1301 dlFileEntryCacheModel.extraSettings = getExtraSettings();
1302
1303 String extraSettings = dlFileEntryCacheModel.extraSettings;
1304
1305 if ((extraSettings != null) && (extraSettings.length() == 0)) {
1306 dlFileEntryCacheModel.extraSettings = null;
1307 }
1308
1309 dlFileEntryCacheModel.fileEntryTypeId = getFileEntryTypeId();
1310
1311 dlFileEntryCacheModel.version = getVersion();
1312
1313 String version = dlFileEntryCacheModel.version;
1314
1315 if ((version != null) && (version.length() == 0)) {
1316 dlFileEntryCacheModel.version = null;
1317 }
1318
1319 dlFileEntryCacheModel.size = getSize();
1320
1321 dlFileEntryCacheModel.readCount = getReadCount();
1322
1323 dlFileEntryCacheModel.smallImageId = getSmallImageId();
1324
1325 dlFileEntryCacheModel.largeImageId = getLargeImageId();
1326
1327 dlFileEntryCacheModel.custom1ImageId = getCustom1ImageId();
1328
1329 dlFileEntryCacheModel.custom2ImageId = getCustom2ImageId();
1330
1331 dlFileEntryCacheModel.manualCheckInRequired = getManualCheckInRequired();
1332
1333 return dlFileEntryCacheModel;
1334 }
1335
1336 @Override
1337 public String toString() {
1338 StringBundler sb = new StringBundler(57);
1339
1340 sb.append("{uuid=");
1341 sb.append(getUuid());
1342 sb.append(", fileEntryId=");
1343 sb.append(getFileEntryId());
1344 sb.append(", groupId=");
1345 sb.append(getGroupId());
1346 sb.append(", companyId=");
1347 sb.append(getCompanyId());
1348 sb.append(", userId=");
1349 sb.append(getUserId());
1350 sb.append(", userName=");
1351 sb.append(getUserName());
1352 sb.append(", createDate=");
1353 sb.append(getCreateDate());
1354 sb.append(", modifiedDate=");
1355 sb.append(getModifiedDate());
1356 sb.append(", classNameId=");
1357 sb.append(getClassNameId());
1358 sb.append(", classPK=");
1359 sb.append(getClassPK());
1360 sb.append(", repositoryId=");
1361 sb.append(getRepositoryId());
1362 sb.append(", folderId=");
1363 sb.append(getFolderId());
1364 sb.append(", treePath=");
1365 sb.append(getTreePath());
1366 sb.append(", name=");
1367 sb.append(getName());
1368 sb.append(", extension=");
1369 sb.append(getExtension());
1370 sb.append(", mimeType=");
1371 sb.append(getMimeType());
1372 sb.append(", title=");
1373 sb.append(getTitle());
1374 sb.append(", description=");
1375 sb.append(getDescription());
1376 sb.append(", extraSettings=");
1377 sb.append(getExtraSettings());
1378 sb.append(", fileEntryTypeId=");
1379 sb.append(getFileEntryTypeId());
1380 sb.append(", version=");
1381 sb.append(getVersion());
1382 sb.append(", size=");
1383 sb.append(getSize());
1384 sb.append(", readCount=");
1385 sb.append(getReadCount());
1386 sb.append(", smallImageId=");
1387 sb.append(getSmallImageId());
1388 sb.append(", largeImageId=");
1389 sb.append(getLargeImageId());
1390 sb.append(", custom1ImageId=");
1391 sb.append(getCustom1ImageId());
1392 sb.append(", custom2ImageId=");
1393 sb.append(getCustom2ImageId());
1394 sb.append(", manualCheckInRequired=");
1395 sb.append(getManualCheckInRequired());
1396 sb.append("}");
1397
1398 return sb.toString();
1399 }
1400
1401 @Override
1402 public String toXmlString() {
1403 StringBundler sb = new StringBundler(88);
1404
1405 sb.append("<model><model-name>");
1406 sb.append("com.liferay.portlet.documentlibrary.model.DLFileEntry");
1407 sb.append("</model-name>");
1408
1409 sb.append(
1410 "<column><column-name>uuid</column-name><column-value><![CDATA[");
1411 sb.append(getUuid());
1412 sb.append("]]></column-value></column>");
1413 sb.append(
1414 "<column><column-name>fileEntryId</column-name><column-value><![CDATA[");
1415 sb.append(getFileEntryId());
1416 sb.append("]]></column-value></column>");
1417 sb.append(
1418 "<column><column-name>groupId</column-name><column-value><![CDATA[");
1419 sb.append(getGroupId());
1420 sb.append("]]></column-value></column>");
1421 sb.append(
1422 "<column><column-name>companyId</column-name><column-value><![CDATA[");
1423 sb.append(getCompanyId());
1424 sb.append("]]></column-value></column>");
1425 sb.append(
1426 "<column><column-name>userId</column-name><column-value><![CDATA[");
1427 sb.append(getUserId());
1428 sb.append("]]></column-value></column>");
1429 sb.append(
1430 "<column><column-name>userName</column-name><column-value><![CDATA[");
1431 sb.append(getUserName());
1432 sb.append("]]></column-value></column>");
1433 sb.append(
1434 "<column><column-name>createDate</column-name><column-value><![CDATA[");
1435 sb.append(getCreateDate());
1436 sb.append("]]></column-value></column>");
1437 sb.append(
1438 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
1439 sb.append(getModifiedDate());
1440 sb.append("]]></column-value></column>");
1441 sb.append(
1442 "<column><column-name>classNameId</column-name><column-value><![CDATA[");
1443 sb.append(getClassNameId());
1444 sb.append("]]></column-value></column>");
1445 sb.append(
1446 "<column><column-name>classPK</column-name><column-value><![CDATA[");
1447 sb.append(getClassPK());
1448 sb.append("]]></column-value></column>");
1449 sb.append(
1450 "<column><column-name>repositoryId</column-name><column-value><![CDATA[");
1451 sb.append(getRepositoryId());
1452 sb.append("]]></column-value></column>");
1453 sb.append(
1454 "<column><column-name>folderId</column-name><column-value><![CDATA[");
1455 sb.append(getFolderId());
1456 sb.append("]]></column-value></column>");
1457 sb.append(
1458 "<column><column-name>treePath</column-name><column-value><![CDATA[");
1459 sb.append(getTreePath());
1460 sb.append("]]></column-value></column>");
1461 sb.append(
1462 "<column><column-name>name</column-name><column-value><![CDATA[");
1463 sb.append(getName());
1464 sb.append("]]></column-value></column>");
1465 sb.append(
1466 "<column><column-name>extension</column-name><column-value><![CDATA[");
1467 sb.append(getExtension());
1468 sb.append("]]></column-value></column>");
1469 sb.append(
1470 "<column><column-name>mimeType</column-name><column-value><![CDATA[");
1471 sb.append(getMimeType());
1472 sb.append("]]></column-value></column>");
1473 sb.append(
1474 "<column><column-name>title</column-name><column-value><![CDATA[");
1475 sb.append(getTitle());
1476 sb.append("]]></column-value></column>");
1477 sb.append(
1478 "<column><column-name>description</column-name><column-value><![CDATA[");
1479 sb.append(getDescription());
1480 sb.append("]]></column-value></column>");
1481 sb.append(
1482 "<column><column-name>extraSettings</column-name><column-value><![CDATA[");
1483 sb.append(getExtraSettings());
1484 sb.append("]]></column-value></column>");
1485 sb.append(
1486 "<column><column-name>fileEntryTypeId</column-name><column-value><![CDATA[");
1487 sb.append(getFileEntryTypeId());
1488 sb.append("]]></column-value></column>");
1489 sb.append(
1490 "<column><column-name>version</column-name><column-value><![CDATA[");
1491 sb.append(getVersion());
1492 sb.append("]]></column-value></column>");
1493 sb.append(
1494 "<column><column-name>size</column-name><column-value><![CDATA[");
1495 sb.append(getSize());
1496 sb.append("]]></column-value></column>");
1497 sb.append(
1498 "<column><column-name>readCount</column-name><column-value><![CDATA[");
1499 sb.append(getReadCount());
1500 sb.append("]]></column-value></column>");
1501 sb.append(
1502 "<column><column-name>smallImageId</column-name><column-value><![CDATA[");
1503 sb.append(getSmallImageId());
1504 sb.append("]]></column-value></column>");
1505 sb.append(
1506 "<column><column-name>largeImageId</column-name><column-value><![CDATA[");
1507 sb.append(getLargeImageId());
1508 sb.append("]]></column-value></column>");
1509 sb.append(
1510 "<column><column-name>custom1ImageId</column-name><column-value><![CDATA[");
1511 sb.append(getCustom1ImageId());
1512 sb.append("]]></column-value></column>");
1513 sb.append(
1514 "<column><column-name>custom2ImageId</column-name><column-value><![CDATA[");
1515 sb.append(getCustom2ImageId());
1516 sb.append("]]></column-value></column>");
1517 sb.append(
1518 "<column><column-name>manualCheckInRequired</column-name><column-value><![CDATA[");
1519 sb.append(getManualCheckInRequired());
1520 sb.append("]]></column-value></column>");
1521
1522 sb.append("</model>");
1523
1524 return sb.toString();
1525 }
1526
1527 private static ClassLoader _classLoader = DLFileEntry.class.getClassLoader();
1528 private static Class<?>[] _escapedModelInterfaces = new Class[] {
1529 DLFileEntry.class
1530 };
1531 private String _uuid;
1532 private String _originalUuid;
1533 private long _fileEntryId;
1534 private long _groupId;
1535 private long _originalGroupId;
1536 private boolean _setOriginalGroupId;
1537 private long _companyId;
1538 private long _originalCompanyId;
1539 private boolean _setOriginalCompanyId;
1540 private long _userId;
1541 private String _userUuid;
1542 private long _originalUserId;
1543 private boolean _setOriginalUserId;
1544 private String _userName;
1545 private Date _createDate;
1546 private Date _modifiedDate;
1547 private long _classNameId;
1548 private long _classPK;
1549 private long _repositoryId;
1550 private long _originalRepositoryId;
1551 private boolean _setOriginalRepositoryId;
1552 private long _folderId;
1553 private long _originalFolderId;
1554 private boolean _setOriginalFolderId;
1555 private String _treePath;
1556 private String _name;
1557 private String _originalName;
1558 private String _extension;
1559 private String _mimeType;
1560 private String _originalMimeType;
1561 private String _title;
1562 private String _originalTitle;
1563 private String _description;
1564 private String _extraSettings;
1565 private long _fileEntryTypeId;
1566 private long _originalFileEntryTypeId;
1567 private boolean _setOriginalFileEntryTypeId;
1568 private String _version;
1569 private long _size;
1570 private int _readCount;
1571 private long _smallImageId;
1572 private long _largeImageId;
1573 private long _custom1ImageId;
1574 private long _custom2ImageId;
1575 private boolean _manualCheckInRequired;
1576 private long _columnBitmask;
1577 private DLFileEntry _escapedModel;
1578 }