001
014
015 package com.liferay.portlet.documentlibrary.model.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.document.library.kernel.model.DLFileEntryType;
020 import com.liferay.document.library.kernel.model.DLFileEntryTypeModel;
021 import com.liferay.document.library.kernel.model.DLFileEntryTypeSoap;
022
023 import com.liferay.expando.kernel.model.ExpandoBridge;
024 import com.liferay.expando.kernel.util.ExpandoBridgeFactoryUtil;
025
026 import com.liferay.exportimport.kernel.lar.StagedModelType;
027
028 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
029 import com.liferay.portal.kernel.exception.LocaleException;
030 import com.liferay.portal.kernel.exception.PortalException;
031 import com.liferay.portal.kernel.json.JSON;
032 import com.liferay.portal.kernel.model.CacheModel;
033 import com.liferay.portal.kernel.model.User;
034 import com.liferay.portal.kernel.model.impl.BaseModelImpl;
035 import com.liferay.portal.kernel.service.ServiceContext;
036 import com.liferay.portal.kernel.service.UserLocalServiceUtil;
037 import com.liferay.portal.kernel.util.GetterUtil;
038 import com.liferay.portal.kernel.util.LocaleUtil;
039 import com.liferay.portal.kernel.util.LocalizationUtil;
040 import com.liferay.portal.kernel.util.PortalUtil;
041 import com.liferay.portal.kernel.util.ProxyUtil;
042 import com.liferay.portal.kernel.util.StringBundler;
043 import com.liferay.portal.kernel.util.StringPool;
044 import com.liferay.portal.kernel.util.Validator;
045
046 import java.io.Serializable;
047
048 import java.sql.Types;
049
050 import java.util.ArrayList;
051 import java.util.Date;
052 import java.util.HashMap;
053 import java.util.List;
054 import java.util.Locale;
055 import java.util.Map;
056 import java.util.Set;
057 import java.util.TreeSet;
058
059
072 @JSON(strict = true)
073 @ProviderType
074 public class DLFileEntryTypeModelImpl extends BaseModelImpl<DLFileEntryType>
075 implements DLFileEntryTypeModel {
076
081 public static final String TABLE_NAME = "DLFileEntryType";
082 public static final Object[][] TABLE_COLUMNS = {
083 { "uuid_", Types.VARCHAR },
084 { "fileEntryTypeId", Types.BIGINT },
085 { "groupId", Types.BIGINT },
086 { "companyId", Types.BIGINT },
087 { "userId", Types.BIGINT },
088 { "userName", Types.VARCHAR },
089 { "createDate", Types.TIMESTAMP },
090 { "modifiedDate", Types.TIMESTAMP },
091 { "fileEntryTypeKey", Types.VARCHAR },
092 { "name", Types.VARCHAR },
093 { "description", Types.VARCHAR },
094 { "lastPublishDate", Types.TIMESTAMP }
095 };
096 public static final Map<String, Integer> TABLE_COLUMNS_MAP = new HashMap<String, Integer>();
097
098 static {
099 TABLE_COLUMNS_MAP.put("uuid_", Types.VARCHAR);
100 TABLE_COLUMNS_MAP.put("fileEntryTypeId", Types.BIGINT);
101 TABLE_COLUMNS_MAP.put("groupId", Types.BIGINT);
102 TABLE_COLUMNS_MAP.put("companyId", Types.BIGINT);
103 TABLE_COLUMNS_MAP.put("userId", Types.BIGINT);
104 TABLE_COLUMNS_MAP.put("userName", Types.VARCHAR);
105 TABLE_COLUMNS_MAP.put("createDate", Types.TIMESTAMP);
106 TABLE_COLUMNS_MAP.put("modifiedDate", Types.TIMESTAMP);
107 TABLE_COLUMNS_MAP.put("fileEntryTypeKey", Types.VARCHAR);
108 TABLE_COLUMNS_MAP.put("name", Types.VARCHAR);
109 TABLE_COLUMNS_MAP.put("description", Types.VARCHAR);
110 TABLE_COLUMNS_MAP.put("lastPublishDate", Types.TIMESTAMP);
111 }
112
113 public static final String TABLE_SQL_CREATE = "create table DLFileEntryType (uuid_ VARCHAR(75) null,fileEntryTypeId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,fileEntryTypeKey VARCHAR(75) null,name STRING null,description STRING null,lastPublishDate DATE null)";
114 public static final String TABLE_SQL_DROP = "drop table DLFileEntryType";
115 public static final String ORDER_BY_JPQL = " ORDER BY dlFileEntryType.fileEntryTypeId ASC";
116 public static final String ORDER_BY_SQL = " ORDER BY DLFileEntryType.fileEntryTypeId ASC";
117 public static final String DATA_SOURCE = "liferayDataSource";
118 public static final String SESSION_FACTORY = "liferaySessionFactory";
119 public static final String TX_MANAGER = "liferayTransactionManager";
120 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
121 "value.object.entity.cache.enabled.com.liferay.document.library.kernel.model.DLFileEntryType"),
122 true);
123 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
124 "value.object.finder.cache.enabled.com.liferay.document.library.kernel.model.DLFileEntryType"),
125 true);
126 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
127 "value.object.column.bitmask.enabled.com.liferay.document.library.kernel.model.DLFileEntryType"),
128 true);
129 public static final long COMPANYID_COLUMN_BITMASK = 1L;
130 public static final long FILEENTRYTYPEKEY_COLUMN_BITMASK = 2L;
131 public static final long GROUPID_COLUMN_BITMASK = 4L;
132 public static final long UUID_COLUMN_BITMASK = 8L;
133 public static final long FILEENTRYTYPEID_COLUMN_BITMASK = 16L;
134
135
141 public static DLFileEntryType toModel(DLFileEntryTypeSoap soapModel) {
142 if (soapModel == null) {
143 return null;
144 }
145
146 DLFileEntryType model = new DLFileEntryTypeImpl();
147
148 model.setUuid(soapModel.getUuid());
149 model.setFileEntryTypeId(soapModel.getFileEntryTypeId());
150 model.setGroupId(soapModel.getGroupId());
151 model.setCompanyId(soapModel.getCompanyId());
152 model.setUserId(soapModel.getUserId());
153 model.setUserName(soapModel.getUserName());
154 model.setCreateDate(soapModel.getCreateDate());
155 model.setModifiedDate(soapModel.getModifiedDate());
156 model.setFileEntryTypeKey(soapModel.getFileEntryTypeKey());
157 model.setName(soapModel.getName());
158 model.setDescription(soapModel.getDescription());
159 model.setLastPublishDate(soapModel.getLastPublishDate());
160
161 return model;
162 }
163
164
170 public static List<DLFileEntryType> toModels(
171 DLFileEntryTypeSoap[] soapModels) {
172 if (soapModels == null) {
173 return null;
174 }
175
176 List<DLFileEntryType> models = new ArrayList<DLFileEntryType>(soapModels.length);
177
178 for (DLFileEntryTypeSoap soapModel : soapModels) {
179 models.add(toModel(soapModel));
180 }
181
182 return models;
183 }
184
185 public static final String MAPPING_TABLE_DLFILEENTRYTYPES_DLFOLDERS_NAME = "DLFileEntryTypes_DLFolders";
186 public static final Object[][] MAPPING_TABLE_DLFILEENTRYTYPES_DLFOLDERS_COLUMNS =
187 {
188 { "companyId", Types.BIGINT },
189 { "fileEntryTypeId", Types.BIGINT },
190 { "folderId", Types.BIGINT }
191 };
192 public static final String MAPPING_TABLE_DLFILEENTRYTYPES_DLFOLDERS_SQL_CREATE =
193 "create table DLFileEntryTypes_DLFolders (companyId LONG not null,fileEntryTypeId LONG not null,folderId LONG not null,primary key (fileEntryTypeId, folderId))";
194 public static final boolean FINDER_CACHE_ENABLED_DLFILEENTRYTYPES_DLFOLDERS = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
195 "value.object.finder.cache.enabled.DLFileEntryTypes_DLFolders"),
196 true);
197 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
198 "lock.expiration.time.com.liferay.document.library.kernel.model.DLFileEntryType"));
199
200 public DLFileEntryTypeModelImpl() {
201 }
202
203 @Override
204 public long getPrimaryKey() {
205 return _fileEntryTypeId;
206 }
207
208 @Override
209 public void setPrimaryKey(long primaryKey) {
210 setFileEntryTypeId(primaryKey);
211 }
212
213 @Override
214 public Serializable getPrimaryKeyObj() {
215 return _fileEntryTypeId;
216 }
217
218 @Override
219 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
220 setPrimaryKey(((Long)primaryKeyObj).longValue());
221 }
222
223 @Override
224 public Class<?> getModelClass() {
225 return DLFileEntryType.class;
226 }
227
228 @Override
229 public String getModelClassName() {
230 return DLFileEntryType.class.getName();
231 }
232
233 @Override
234 public Map<String, Object> getModelAttributes() {
235 Map<String, Object> attributes = new HashMap<String, Object>();
236
237 attributes.put("uuid", getUuid());
238 attributes.put("fileEntryTypeId", getFileEntryTypeId());
239 attributes.put("groupId", getGroupId());
240 attributes.put("companyId", getCompanyId());
241 attributes.put("userId", getUserId());
242 attributes.put("userName", getUserName());
243 attributes.put("createDate", getCreateDate());
244 attributes.put("modifiedDate", getModifiedDate());
245 attributes.put("fileEntryTypeKey", getFileEntryTypeKey());
246 attributes.put("name", getName());
247 attributes.put("description", getDescription());
248 attributes.put("lastPublishDate", getLastPublishDate());
249
250 attributes.put("entityCacheEnabled", isEntityCacheEnabled());
251 attributes.put("finderCacheEnabled", isFinderCacheEnabled());
252
253 return attributes;
254 }
255
256 @Override
257 public void setModelAttributes(Map<String, Object> attributes) {
258 String uuid = (String)attributes.get("uuid");
259
260 if (uuid != null) {
261 setUuid(uuid);
262 }
263
264 Long fileEntryTypeId = (Long)attributes.get("fileEntryTypeId");
265
266 if (fileEntryTypeId != null) {
267 setFileEntryTypeId(fileEntryTypeId);
268 }
269
270 Long groupId = (Long)attributes.get("groupId");
271
272 if (groupId != null) {
273 setGroupId(groupId);
274 }
275
276 Long companyId = (Long)attributes.get("companyId");
277
278 if (companyId != null) {
279 setCompanyId(companyId);
280 }
281
282 Long userId = (Long)attributes.get("userId");
283
284 if (userId != null) {
285 setUserId(userId);
286 }
287
288 String userName = (String)attributes.get("userName");
289
290 if (userName != null) {
291 setUserName(userName);
292 }
293
294 Date createDate = (Date)attributes.get("createDate");
295
296 if (createDate != null) {
297 setCreateDate(createDate);
298 }
299
300 Date modifiedDate = (Date)attributes.get("modifiedDate");
301
302 if (modifiedDate != null) {
303 setModifiedDate(modifiedDate);
304 }
305
306 String fileEntryTypeKey = (String)attributes.get("fileEntryTypeKey");
307
308 if (fileEntryTypeKey != null) {
309 setFileEntryTypeKey(fileEntryTypeKey);
310 }
311
312 String name = (String)attributes.get("name");
313
314 if (name != null) {
315 setName(name);
316 }
317
318 String description = (String)attributes.get("description");
319
320 if (description != null) {
321 setDescription(description);
322 }
323
324 Date lastPublishDate = (Date)attributes.get("lastPublishDate");
325
326 if (lastPublishDate != null) {
327 setLastPublishDate(lastPublishDate);
328 }
329 }
330
331 @JSON
332 @Override
333 public String getUuid() {
334 if (_uuid == null) {
335 return StringPool.BLANK;
336 }
337 else {
338 return _uuid;
339 }
340 }
341
342 @Override
343 public void setUuid(String uuid) {
344 if (_originalUuid == null) {
345 _originalUuid = _uuid;
346 }
347
348 _uuid = uuid;
349 }
350
351 public String getOriginalUuid() {
352 return GetterUtil.getString(_originalUuid);
353 }
354
355 @JSON
356 @Override
357 public long getFileEntryTypeId() {
358 return _fileEntryTypeId;
359 }
360
361 @Override
362 public void setFileEntryTypeId(long fileEntryTypeId) {
363 _fileEntryTypeId = fileEntryTypeId;
364 }
365
366 @JSON
367 @Override
368 public long getGroupId() {
369 return _groupId;
370 }
371
372 @Override
373 public void setGroupId(long groupId) {
374 _columnBitmask |= GROUPID_COLUMN_BITMASK;
375
376 if (!_setOriginalGroupId) {
377 _setOriginalGroupId = true;
378
379 _originalGroupId = _groupId;
380 }
381
382 _groupId = groupId;
383 }
384
385 public long getOriginalGroupId() {
386 return _originalGroupId;
387 }
388
389 @JSON
390 @Override
391 public long getCompanyId() {
392 return _companyId;
393 }
394
395 @Override
396 public void setCompanyId(long companyId) {
397 _columnBitmask |= COMPANYID_COLUMN_BITMASK;
398
399 if (!_setOriginalCompanyId) {
400 _setOriginalCompanyId = true;
401
402 _originalCompanyId = _companyId;
403 }
404
405 _companyId = companyId;
406 }
407
408 public long getOriginalCompanyId() {
409 return _originalCompanyId;
410 }
411
412 @JSON
413 @Override
414 public long getUserId() {
415 return _userId;
416 }
417
418 @Override
419 public void setUserId(long userId) {
420 _userId = userId;
421 }
422
423 @Override
424 public String getUserUuid() {
425 try {
426 User user = UserLocalServiceUtil.getUserById(getUserId());
427
428 return user.getUuid();
429 }
430 catch (PortalException pe) {
431 return StringPool.BLANK;
432 }
433 }
434
435 @Override
436 public void setUserUuid(String userUuid) {
437 }
438
439 @JSON
440 @Override
441 public String getUserName() {
442 if (_userName == null) {
443 return StringPool.BLANK;
444 }
445 else {
446 return _userName;
447 }
448 }
449
450 @Override
451 public void setUserName(String userName) {
452 _userName = userName;
453 }
454
455 @JSON
456 @Override
457 public Date getCreateDate() {
458 return _createDate;
459 }
460
461 @Override
462 public void setCreateDate(Date createDate) {
463 _createDate = createDate;
464 }
465
466 @JSON
467 @Override
468 public Date getModifiedDate() {
469 return _modifiedDate;
470 }
471
472 public boolean hasSetModifiedDate() {
473 return _setModifiedDate;
474 }
475
476 @Override
477 public void setModifiedDate(Date modifiedDate) {
478 _setModifiedDate = true;
479
480 _modifiedDate = modifiedDate;
481 }
482
483 @JSON
484 @Override
485 public String getFileEntryTypeKey() {
486 if (_fileEntryTypeKey == null) {
487 return StringPool.BLANK;
488 }
489 else {
490 return _fileEntryTypeKey;
491 }
492 }
493
494 @Override
495 public void setFileEntryTypeKey(String fileEntryTypeKey) {
496 _columnBitmask |= FILEENTRYTYPEKEY_COLUMN_BITMASK;
497
498 if (_originalFileEntryTypeKey == null) {
499 _originalFileEntryTypeKey = _fileEntryTypeKey;
500 }
501
502 _fileEntryTypeKey = fileEntryTypeKey;
503 }
504
505 public String getOriginalFileEntryTypeKey() {
506 return GetterUtil.getString(_originalFileEntryTypeKey);
507 }
508
509 @JSON
510 @Override
511 public String getName() {
512 if (_name == null) {
513 return StringPool.BLANK;
514 }
515 else {
516 return _name;
517 }
518 }
519
520 @Override
521 public String getName(Locale locale) {
522 String languageId = LocaleUtil.toLanguageId(locale);
523
524 return getName(languageId);
525 }
526
527 @Override
528 public String getName(Locale locale, boolean useDefault) {
529 String languageId = LocaleUtil.toLanguageId(locale);
530
531 return getName(languageId, useDefault);
532 }
533
534 @Override
535 public String getName(String languageId) {
536 return LocalizationUtil.getLocalization(getName(), languageId);
537 }
538
539 @Override
540 public String getName(String languageId, boolean useDefault) {
541 return LocalizationUtil.getLocalization(getName(), languageId,
542 useDefault);
543 }
544
545 @Override
546 public String getNameCurrentLanguageId() {
547 return _nameCurrentLanguageId;
548 }
549
550 @JSON
551 @Override
552 public String getNameCurrentValue() {
553 Locale locale = getLocale(_nameCurrentLanguageId);
554
555 return getName(locale);
556 }
557
558 @Override
559 public Map<Locale, String> getNameMap() {
560 return LocalizationUtil.getLocalizationMap(getName());
561 }
562
563 @Override
564 public void setName(String name) {
565 _name = name;
566 }
567
568 @Override
569 public void setName(String name, Locale locale) {
570 setName(name, locale, LocaleUtil.getSiteDefault());
571 }
572
573 @Override
574 public void setName(String name, Locale locale, Locale defaultLocale) {
575 String languageId = LocaleUtil.toLanguageId(locale);
576 String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
577
578 if (Validator.isNotNull(name)) {
579 setName(LocalizationUtil.updateLocalization(getName(), "Name",
580 name, languageId, defaultLanguageId));
581 }
582 else {
583 setName(LocalizationUtil.removeLocalization(getName(), "Name",
584 languageId));
585 }
586 }
587
588 @Override
589 public void setNameCurrentLanguageId(String languageId) {
590 _nameCurrentLanguageId = languageId;
591 }
592
593 @Override
594 public void setNameMap(Map<Locale, String> nameMap) {
595 setNameMap(nameMap, LocaleUtil.getSiteDefault());
596 }
597
598 @Override
599 public void setNameMap(Map<Locale, String> nameMap, Locale defaultLocale) {
600 if (nameMap == null) {
601 return;
602 }
603
604 setName(LocalizationUtil.updateLocalization(nameMap, getName(), "Name",
605 LocaleUtil.toLanguageId(defaultLocale)));
606 }
607
608 @JSON
609 @Override
610 public String getDescription() {
611 if (_description == null) {
612 return StringPool.BLANK;
613 }
614 else {
615 return _description;
616 }
617 }
618
619 @Override
620 public String getDescription(Locale locale) {
621 String languageId = LocaleUtil.toLanguageId(locale);
622
623 return getDescription(languageId);
624 }
625
626 @Override
627 public String getDescription(Locale locale, boolean useDefault) {
628 String languageId = LocaleUtil.toLanguageId(locale);
629
630 return getDescription(languageId, useDefault);
631 }
632
633 @Override
634 public String getDescription(String languageId) {
635 return LocalizationUtil.getLocalization(getDescription(), languageId);
636 }
637
638 @Override
639 public String getDescription(String languageId, boolean useDefault) {
640 return LocalizationUtil.getLocalization(getDescription(), languageId,
641 useDefault);
642 }
643
644 @Override
645 public String getDescriptionCurrentLanguageId() {
646 return _descriptionCurrentLanguageId;
647 }
648
649 @JSON
650 @Override
651 public String getDescriptionCurrentValue() {
652 Locale locale = getLocale(_descriptionCurrentLanguageId);
653
654 return getDescription(locale);
655 }
656
657 @Override
658 public Map<Locale, String> getDescriptionMap() {
659 return LocalizationUtil.getLocalizationMap(getDescription());
660 }
661
662 @Override
663 public void setDescription(String description) {
664 _description = description;
665 }
666
667 @Override
668 public void setDescription(String description, Locale locale) {
669 setDescription(description, locale, LocaleUtil.getSiteDefault());
670 }
671
672 @Override
673 public void setDescription(String description, Locale locale,
674 Locale defaultLocale) {
675 String languageId = LocaleUtil.toLanguageId(locale);
676 String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
677
678 if (Validator.isNotNull(description)) {
679 setDescription(LocalizationUtil.updateLocalization(
680 getDescription(), "Description", description, languageId,
681 defaultLanguageId));
682 }
683 else {
684 setDescription(LocalizationUtil.removeLocalization(
685 getDescription(), "Description", languageId));
686 }
687 }
688
689 @Override
690 public void setDescriptionCurrentLanguageId(String languageId) {
691 _descriptionCurrentLanguageId = languageId;
692 }
693
694 @Override
695 public void setDescriptionMap(Map<Locale, String> descriptionMap) {
696 setDescriptionMap(descriptionMap, LocaleUtil.getSiteDefault());
697 }
698
699 @Override
700 public void setDescriptionMap(Map<Locale, String> descriptionMap,
701 Locale defaultLocale) {
702 if (descriptionMap == null) {
703 return;
704 }
705
706 setDescription(LocalizationUtil.updateLocalization(descriptionMap,
707 getDescription(), "Description",
708 LocaleUtil.toLanguageId(defaultLocale)));
709 }
710
711 @JSON
712 @Override
713 public Date getLastPublishDate() {
714 return _lastPublishDate;
715 }
716
717 @Override
718 public void setLastPublishDate(Date lastPublishDate) {
719 _lastPublishDate = lastPublishDate;
720 }
721
722 @Override
723 public StagedModelType getStagedModelType() {
724 return new StagedModelType(PortalUtil.getClassNameId(
725 DLFileEntryType.class.getName()));
726 }
727
728 public long getColumnBitmask() {
729 return _columnBitmask;
730 }
731
732 @Override
733 public ExpandoBridge getExpandoBridge() {
734 return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
735 DLFileEntryType.class.getName(), getPrimaryKey());
736 }
737
738 @Override
739 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
740 ExpandoBridge expandoBridge = getExpandoBridge();
741
742 expandoBridge.setAttributes(serviceContext);
743 }
744
745 @Override
746 public String[] getAvailableLanguageIds() {
747 Set<String> availableLanguageIds = new TreeSet<String>();
748
749 Map<Locale, String> nameMap = getNameMap();
750
751 for (Map.Entry<Locale, String> entry : nameMap.entrySet()) {
752 Locale locale = entry.getKey();
753 String value = entry.getValue();
754
755 if (Validator.isNotNull(value)) {
756 availableLanguageIds.add(LocaleUtil.toLanguageId(locale));
757 }
758 }
759
760 Map<Locale, String> descriptionMap = getDescriptionMap();
761
762 for (Map.Entry<Locale, String> entry : descriptionMap.entrySet()) {
763 Locale locale = entry.getKey();
764 String value = entry.getValue();
765
766 if (Validator.isNotNull(value)) {
767 availableLanguageIds.add(LocaleUtil.toLanguageId(locale));
768 }
769 }
770
771 return availableLanguageIds.toArray(new String[availableLanguageIds.size()]);
772 }
773
774 @Override
775 public String getDefaultLanguageId() {
776 String xml = getName();
777
778 if (xml == null) {
779 return StringPool.BLANK;
780 }
781
782 Locale defaultLocale = LocaleUtil.getSiteDefault();
783
784 return LocalizationUtil.getDefaultLanguageId(xml, defaultLocale);
785 }
786
787 @Override
788 public void prepareLocalizedFieldsForImport() throws LocaleException {
789 Locale defaultLocale = LocaleUtil.fromLanguageId(getDefaultLanguageId());
790
791 Locale[] availableLocales = LocaleUtil.fromLanguageIds(getAvailableLanguageIds());
792
793 Locale defaultImportLocale = LocalizationUtil.getDefaultImportLocale(DLFileEntryType.class.getName(),
794 getPrimaryKey(), defaultLocale, availableLocales);
795
796 prepareLocalizedFieldsForImport(defaultImportLocale);
797 }
798
799 @Override
800 @SuppressWarnings("unused")
801 public void prepareLocalizedFieldsForImport(Locale defaultImportLocale)
802 throws LocaleException {
803 Locale defaultLocale = LocaleUtil.getSiteDefault();
804
805 String modelDefaultLanguageId = getDefaultLanguageId();
806
807 String name = getName(defaultLocale);
808
809 if (Validator.isNull(name)) {
810 setName(getName(modelDefaultLanguageId), defaultLocale);
811 }
812 else {
813 setName(getName(defaultLocale), defaultLocale, defaultLocale);
814 }
815
816 String description = getDescription(defaultLocale);
817
818 if (Validator.isNull(description)) {
819 setDescription(getDescription(modelDefaultLanguageId), defaultLocale);
820 }
821 else {
822 setDescription(getDescription(defaultLocale), defaultLocale,
823 defaultLocale);
824 }
825 }
826
827 @Override
828 public DLFileEntryType toEscapedModel() {
829 if (_escapedModel == null) {
830 _escapedModel = (DLFileEntryType)ProxyUtil.newProxyInstance(_classLoader,
831 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
832 }
833
834 return _escapedModel;
835 }
836
837 @Override
838 public Object clone() {
839 DLFileEntryTypeImpl dlFileEntryTypeImpl = new DLFileEntryTypeImpl();
840
841 dlFileEntryTypeImpl.setUuid(getUuid());
842 dlFileEntryTypeImpl.setFileEntryTypeId(getFileEntryTypeId());
843 dlFileEntryTypeImpl.setGroupId(getGroupId());
844 dlFileEntryTypeImpl.setCompanyId(getCompanyId());
845 dlFileEntryTypeImpl.setUserId(getUserId());
846 dlFileEntryTypeImpl.setUserName(getUserName());
847 dlFileEntryTypeImpl.setCreateDate(getCreateDate());
848 dlFileEntryTypeImpl.setModifiedDate(getModifiedDate());
849 dlFileEntryTypeImpl.setFileEntryTypeKey(getFileEntryTypeKey());
850 dlFileEntryTypeImpl.setName(getName());
851 dlFileEntryTypeImpl.setDescription(getDescription());
852 dlFileEntryTypeImpl.setLastPublishDate(getLastPublishDate());
853
854 dlFileEntryTypeImpl.resetOriginalValues();
855
856 return dlFileEntryTypeImpl;
857 }
858
859 @Override
860 public int compareTo(DLFileEntryType dlFileEntryType) {
861 long primaryKey = dlFileEntryType.getPrimaryKey();
862
863 if (getPrimaryKey() < primaryKey) {
864 return -1;
865 }
866 else if (getPrimaryKey() > primaryKey) {
867 return 1;
868 }
869 else {
870 return 0;
871 }
872 }
873
874 @Override
875 public boolean equals(Object obj) {
876 if (this == obj) {
877 return true;
878 }
879
880 if (!(obj instanceof DLFileEntryType)) {
881 return false;
882 }
883
884 DLFileEntryType dlFileEntryType = (DLFileEntryType)obj;
885
886 long primaryKey = dlFileEntryType.getPrimaryKey();
887
888 if (getPrimaryKey() == primaryKey) {
889 return true;
890 }
891 else {
892 return false;
893 }
894 }
895
896 @Override
897 public int hashCode() {
898 return (int)getPrimaryKey();
899 }
900
901 @Override
902 public boolean isEntityCacheEnabled() {
903 return ENTITY_CACHE_ENABLED;
904 }
905
906 @Override
907 public boolean isFinderCacheEnabled() {
908 return FINDER_CACHE_ENABLED;
909 }
910
911 @Override
912 public void resetOriginalValues() {
913 DLFileEntryTypeModelImpl dlFileEntryTypeModelImpl = this;
914
915 dlFileEntryTypeModelImpl._originalUuid = dlFileEntryTypeModelImpl._uuid;
916
917 dlFileEntryTypeModelImpl._originalGroupId = dlFileEntryTypeModelImpl._groupId;
918
919 dlFileEntryTypeModelImpl._setOriginalGroupId = false;
920
921 dlFileEntryTypeModelImpl._originalCompanyId = dlFileEntryTypeModelImpl._companyId;
922
923 dlFileEntryTypeModelImpl._setOriginalCompanyId = false;
924
925 dlFileEntryTypeModelImpl._setModifiedDate = false;
926
927 dlFileEntryTypeModelImpl._originalFileEntryTypeKey = dlFileEntryTypeModelImpl._fileEntryTypeKey;
928
929 dlFileEntryTypeModelImpl._columnBitmask = 0;
930 }
931
932 @Override
933 public CacheModel<DLFileEntryType> toCacheModel() {
934 DLFileEntryTypeCacheModel dlFileEntryTypeCacheModel = new DLFileEntryTypeCacheModel();
935
936 dlFileEntryTypeCacheModel.uuid = getUuid();
937
938 String uuid = dlFileEntryTypeCacheModel.uuid;
939
940 if ((uuid != null) && (uuid.length() == 0)) {
941 dlFileEntryTypeCacheModel.uuid = null;
942 }
943
944 dlFileEntryTypeCacheModel.fileEntryTypeId = getFileEntryTypeId();
945
946 dlFileEntryTypeCacheModel.groupId = getGroupId();
947
948 dlFileEntryTypeCacheModel.companyId = getCompanyId();
949
950 dlFileEntryTypeCacheModel.userId = getUserId();
951
952 dlFileEntryTypeCacheModel.userName = getUserName();
953
954 String userName = dlFileEntryTypeCacheModel.userName;
955
956 if ((userName != null) && (userName.length() == 0)) {
957 dlFileEntryTypeCacheModel.userName = null;
958 }
959
960 Date createDate = getCreateDate();
961
962 if (createDate != null) {
963 dlFileEntryTypeCacheModel.createDate = createDate.getTime();
964 }
965 else {
966 dlFileEntryTypeCacheModel.createDate = Long.MIN_VALUE;
967 }
968
969 Date modifiedDate = getModifiedDate();
970
971 if (modifiedDate != null) {
972 dlFileEntryTypeCacheModel.modifiedDate = modifiedDate.getTime();
973 }
974 else {
975 dlFileEntryTypeCacheModel.modifiedDate = Long.MIN_VALUE;
976 }
977
978 dlFileEntryTypeCacheModel.fileEntryTypeKey = getFileEntryTypeKey();
979
980 String fileEntryTypeKey = dlFileEntryTypeCacheModel.fileEntryTypeKey;
981
982 if ((fileEntryTypeKey != null) && (fileEntryTypeKey.length() == 0)) {
983 dlFileEntryTypeCacheModel.fileEntryTypeKey = null;
984 }
985
986 dlFileEntryTypeCacheModel.name = getName();
987
988 String name = dlFileEntryTypeCacheModel.name;
989
990 if ((name != null) && (name.length() == 0)) {
991 dlFileEntryTypeCacheModel.name = null;
992 }
993
994 dlFileEntryTypeCacheModel.description = getDescription();
995
996 String description = dlFileEntryTypeCacheModel.description;
997
998 if ((description != null) && (description.length() == 0)) {
999 dlFileEntryTypeCacheModel.description = null;
1000 }
1001
1002 Date lastPublishDate = getLastPublishDate();
1003
1004 if (lastPublishDate != null) {
1005 dlFileEntryTypeCacheModel.lastPublishDate = lastPublishDate.getTime();
1006 }
1007 else {
1008 dlFileEntryTypeCacheModel.lastPublishDate = Long.MIN_VALUE;
1009 }
1010
1011 return dlFileEntryTypeCacheModel;
1012 }
1013
1014 @Override
1015 public String toString() {
1016 StringBundler sb = new StringBundler(25);
1017
1018 sb.append("{uuid=");
1019 sb.append(getUuid());
1020 sb.append(", fileEntryTypeId=");
1021 sb.append(getFileEntryTypeId());
1022 sb.append(", groupId=");
1023 sb.append(getGroupId());
1024 sb.append(", companyId=");
1025 sb.append(getCompanyId());
1026 sb.append(", userId=");
1027 sb.append(getUserId());
1028 sb.append(", userName=");
1029 sb.append(getUserName());
1030 sb.append(", createDate=");
1031 sb.append(getCreateDate());
1032 sb.append(", modifiedDate=");
1033 sb.append(getModifiedDate());
1034 sb.append(", fileEntryTypeKey=");
1035 sb.append(getFileEntryTypeKey());
1036 sb.append(", name=");
1037 sb.append(getName());
1038 sb.append(", description=");
1039 sb.append(getDescription());
1040 sb.append(", lastPublishDate=");
1041 sb.append(getLastPublishDate());
1042 sb.append("}");
1043
1044 return sb.toString();
1045 }
1046
1047 @Override
1048 public String toXmlString() {
1049 StringBundler sb = new StringBundler(40);
1050
1051 sb.append("<model><model-name>");
1052 sb.append("com.liferay.document.library.kernel.model.DLFileEntryType");
1053 sb.append("</model-name>");
1054
1055 sb.append(
1056 "<column><column-name>uuid</column-name><column-value><![CDATA[");
1057 sb.append(getUuid());
1058 sb.append("]]></column-value></column>");
1059 sb.append(
1060 "<column><column-name>fileEntryTypeId</column-name><column-value><![CDATA[");
1061 sb.append(getFileEntryTypeId());
1062 sb.append("]]></column-value></column>");
1063 sb.append(
1064 "<column><column-name>groupId</column-name><column-value><![CDATA[");
1065 sb.append(getGroupId());
1066 sb.append("]]></column-value></column>");
1067 sb.append(
1068 "<column><column-name>companyId</column-name><column-value><![CDATA[");
1069 sb.append(getCompanyId());
1070 sb.append("]]></column-value></column>");
1071 sb.append(
1072 "<column><column-name>userId</column-name><column-value><![CDATA[");
1073 sb.append(getUserId());
1074 sb.append("]]></column-value></column>");
1075 sb.append(
1076 "<column><column-name>userName</column-name><column-value><![CDATA[");
1077 sb.append(getUserName());
1078 sb.append("]]></column-value></column>");
1079 sb.append(
1080 "<column><column-name>createDate</column-name><column-value><![CDATA[");
1081 sb.append(getCreateDate());
1082 sb.append("]]></column-value></column>");
1083 sb.append(
1084 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
1085 sb.append(getModifiedDate());
1086 sb.append("]]></column-value></column>");
1087 sb.append(
1088 "<column><column-name>fileEntryTypeKey</column-name><column-value><![CDATA[");
1089 sb.append(getFileEntryTypeKey());
1090 sb.append("]]></column-value></column>");
1091 sb.append(
1092 "<column><column-name>name</column-name><column-value><![CDATA[");
1093 sb.append(getName());
1094 sb.append("]]></column-value></column>");
1095 sb.append(
1096 "<column><column-name>description</column-name><column-value><![CDATA[");
1097 sb.append(getDescription());
1098 sb.append("]]></column-value></column>");
1099 sb.append(
1100 "<column><column-name>lastPublishDate</column-name><column-value><![CDATA[");
1101 sb.append(getLastPublishDate());
1102 sb.append("]]></column-value></column>");
1103
1104 sb.append("</model>");
1105
1106 return sb.toString();
1107 }
1108
1109 private static final ClassLoader _classLoader = DLFileEntryType.class.getClassLoader();
1110 private static final Class<?>[] _escapedModelInterfaces = new Class[] {
1111 DLFileEntryType.class
1112 };
1113 private String _uuid;
1114 private String _originalUuid;
1115 private long _fileEntryTypeId;
1116 private long _groupId;
1117 private long _originalGroupId;
1118 private boolean _setOriginalGroupId;
1119 private long _companyId;
1120 private long _originalCompanyId;
1121 private boolean _setOriginalCompanyId;
1122 private long _userId;
1123 private String _userName;
1124 private Date _createDate;
1125 private Date _modifiedDate;
1126 private boolean _setModifiedDate;
1127 private String _fileEntryTypeKey;
1128 private String _originalFileEntryTypeKey;
1129 private String _name;
1130 private String _nameCurrentLanguageId;
1131 private String _description;
1132 private String _descriptionCurrentLanguageId;
1133 private Date _lastPublishDate;
1134 private long _columnBitmask;
1135 private DLFileEntryType _escapedModel;
1136 }