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