001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
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.util.GetterUtil;
024    import com.liferay.portal.kernel.util.LocaleUtil;
025    import com.liferay.portal.kernel.util.LocalizationUtil;
026    import com.liferay.portal.kernel.util.ProxyUtil;
027    import com.liferay.portal.kernel.util.StringBundler;
028    import com.liferay.portal.kernel.util.StringPool;
029    import com.liferay.portal.kernel.util.Validator;
030    import com.liferay.portal.model.CacheModel;
031    import com.liferay.portal.model.User;
032    import com.liferay.portal.model.impl.BaseModelImpl;
033    import com.liferay.portal.service.ServiceContext;
034    import com.liferay.portal.service.UserLocalServiceUtil;
035    import com.liferay.portal.util.PortalUtil;
036    
037    import com.liferay.portlet.documentlibrary.model.DLFileEntryType;
038    import com.liferay.portlet.documentlibrary.model.DLFileEntryTypeModel;
039    import com.liferay.portlet.documentlibrary.model.DLFileEntryTypeSoap;
040    import com.liferay.portlet.expando.model.ExpandoBridge;
041    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
042    import com.liferay.portlet.exportimport.lar.StagedModelType;
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    /**
058     * The base model implementation for the DLFileEntryType service. Represents a row in the "DLFileEntryType" database table, with each column mapped to a property of this class.
059     *
060     * <p>
061     * This implementation and its corresponding interface {@link DLFileEntryTypeModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link DLFileEntryTypeImpl}.
062     * </p>
063     *
064     * @author Brian Wing Shun Chan
065     * @see DLFileEntryTypeImpl
066     * @see DLFileEntryType
067     * @see DLFileEntryTypeModel
068     * @generated
069     */
070    @JSON(strict = true)
071    @ProviderType
072    public class DLFileEntryTypeModelImpl extends BaseModelImpl<DLFileEntryType>
073            implements DLFileEntryTypeModel {
074            /*
075             * NOTE FOR DEVELOPERS:
076             *
077             * Never modify or reference this class directly. All methods that expect a document library file entry type model instance should use the {@link DLFileEntryType} interface instead.
078             */
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            /**
116             * Converts the soap model instance into a normal model instance.
117             *
118             * @param soapModel the soap model instance to convert
119             * @return the normal model instance
120             */
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            /**
144             * Converts the soap model instances into normal model instances.
145             *
146             * @param soapModels the soap model instances to convert
147             * @return the normal model instances
148             */
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            public boolean hasSetModifiedDate() {
457                    return _setModifiedDate;
458            }
459    
460            @Override
461            public void setModifiedDate(Date modifiedDate) {
462                    _setModifiedDate = true;
463    
464                    _modifiedDate = modifiedDate;
465            }
466    
467            @JSON
468            @Override
469            public String getFileEntryTypeKey() {
470                    if (_fileEntryTypeKey == null) {
471                            return StringPool.BLANK;
472                    }
473                    else {
474                            return _fileEntryTypeKey;
475                    }
476            }
477    
478            @Override
479            public void setFileEntryTypeKey(String fileEntryTypeKey) {
480                    _columnBitmask |= FILEENTRYTYPEKEY_COLUMN_BITMASK;
481    
482                    if (_originalFileEntryTypeKey == null) {
483                            _originalFileEntryTypeKey = _fileEntryTypeKey;
484                    }
485    
486                    _fileEntryTypeKey = fileEntryTypeKey;
487            }
488    
489            public String getOriginalFileEntryTypeKey() {
490                    return GetterUtil.getString(_originalFileEntryTypeKey);
491            }
492    
493            @JSON
494            @Override
495            public String getName() {
496                    if (_name == null) {
497                            return StringPool.BLANK;
498                    }
499                    else {
500                            return _name;
501                    }
502            }
503    
504            @Override
505            public String getName(Locale locale) {
506                    String languageId = LocaleUtil.toLanguageId(locale);
507    
508                    return getName(languageId);
509            }
510    
511            @Override
512            public String getName(Locale locale, boolean useDefault) {
513                    String languageId = LocaleUtil.toLanguageId(locale);
514    
515                    return getName(languageId, useDefault);
516            }
517    
518            @Override
519            public String getName(String languageId) {
520                    return LocalizationUtil.getLocalization(getName(), languageId);
521            }
522    
523            @Override
524            public String getName(String languageId, boolean useDefault) {
525                    return LocalizationUtil.getLocalization(getName(), languageId,
526                            useDefault);
527            }
528    
529            @Override
530            public String getNameCurrentLanguageId() {
531                    return _nameCurrentLanguageId;
532            }
533    
534            @JSON
535            @Override
536            public String getNameCurrentValue() {
537                    Locale locale = getLocale(_nameCurrentLanguageId);
538    
539                    return getName(locale);
540            }
541    
542            @Override
543            public Map<Locale, String> getNameMap() {
544                    return LocalizationUtil.getLocalizationMap(getName());
545            }
546    
547            @Override
548            public void setName(String name) {
549                    _name = name;
550            }
551    
552            @Override
553            public void setName(String name, Locale locale) {
554                    setName(name, locale, LocaleUtil.getSiteDefault());
555            }
556    
557            @Override
558            public void setName(String name, Locale locale, Locale defaultLocale) {
559                    String languageId = LocaleUtil.toLanguageId(locale);
560                    String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
561    
562                    if (Validator.isNotNull(name)) {
563                            setName(LocalizationUtil.updateLocalization(getName(), "Name",
564                                            name, languageId, defaultLanguageId));
565                    }
566                    else {
567                            setName(LocalizationUtil.removeLocalization(getName(), "Name",
568                                            languageId));
569                    }
570            }
571    
572            @Override
573            public void setNameCurrentLanguageId(String languageId) {
574                    _nameCurrentLanguageId = languageId;
575            }
576    
577            @Override
578            public void setNameMap(Map<Locale, String> nameMap) {
579                    setNameMap(nameMap, LocaleUtil.getSiteDefault());
580            }
581    
582            @Override
583            public void setNameMap(Map<Locale, String> nameMap, Locale defaultLocale) {
584                    if (nameMap == null) {
585                            return;
586                    }
587    
588                    setName(LocalizationUtil.updateLocalization(nameMap, getName(), "Name",
589                                    LocaleUtil.toLanguageId(defaultLocale)));
590            }
591    
592            @JSON
593            @Override
594            public String getDescription() {
595                    if (_description == null) {
596                            return StringPool.BLANK;
597                    }
598                    else {
599                            return _description;
600                    }
601            }
602    
603            @Override
604            public String getDescription(Locale locale) {
605                    String languageId = LocaleUtil.toLanguageId(locale);
606    
607                    return getDescription(languageId);
608            }
609    
610            @Override
611            public String getDescription(Locale locale, boolean useDefault) {
612                    String languageId = LocaleUtil.toLanguageId(locale);
613    
614                    return getDescription(languageId, useDefault);
615            }
616    
617            @Override
618            public String getDescription(String languageId) {
619                    return LocalizationUtil.getLocalization(getDescription(), languageId);
620            }
621    
622            @Override
623            public String getDescription(String languageId, boolean useDefault) {
624                    return LocalizationUtil.getLocalization(getDescription(), languageId,
625                            useDefault);
626            }
627    
628            @Override
629            public String getDescriptionCurrentLanguageId() {
630                    return _descriptionCurrentLanguageId;
631            }
632    
633            @JSON
634            @Override
635            public String getDescriptionCurrentValue() {
636                    Locale locale = getLocale(_descriptionCurrentLanguageId);
637    
638                    return getDescription(locale);
639            }
640    
641            @Override
642            public Map<Locale, String> getDescriptionMap() {
643                    return LocalizationUtil.getLocalizationMap(getDescription());
644            }
645    
646            @Override
647            public void setDescription(String description) {
648                    _description = description;
649            }
650    
651            @Override
652            public void setDescription(String description, Locale locale) {
653                    setDescription(description, locale, LocaleUtil.getSiteDefault());
654            }
655    
656            @Override
657            public void setDescription(String description, Locale locale,
658                    Locale defaultLocale) {
659                    String languageId = LocaleUtil.toLanguageId(locale);
660                    String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
661    
662                    if (Validator.isNotNull(description)) {
663                            setDescription(LocalizationUtil.updateLocalization(
664                                            getDescription(), "Description", description, languageId,
665                                            defaultLanguageId));
666                    }
667                    else {
668                            setDescription(LocalizationUtil.removeLocalization(
669                                            getDescription(), "Description", languageId));
670                    }
671            }
672    
673            @Override
674            public void setDescriptionCurrentLanguageId(String languageId) {
675                    _descriptionCurrentLanguageId = languageId;
676            }
677    
678            @Override
679            public void setDescriptionMap(Map<Locale, String> descriptionMap) {
680                    setDescriptionMap(descriptionMap, LocaleUtil.getSiteDefault());
681            }
682    
683            @Override
684            public void setDescriptionMap(Map<Locale, String> descriptionMap,
685                    Locale defaultLocale) {
686                    if (descriptionMap == null) {
687                            return;
688                    }
689    
690                    setDescription(LocalizationUtil.updateLocalization(descriptionMap,
691                                    getDescription(), "Description",
692                                    LocaleUtil.toLanguageId(defaultLocale)));
693            }
694    
695            @Override
696            public StagedModelType getStagedModelType() {
697                    return new StagedModelType(PortalUtil.getClassNameId(
698                                    DLFileEntryType.class.getName()));
699            }
700    
701            public long getColumnBitmask() {
702                    return _columnBitmask;
703            }
704    
705            @Override
706            public ExpandoBridge getExpandoBridge() {
707                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
708                            DLFileEntryType.class.getName(), getPrimaryKey());
709            }
710    
711            @Override
712            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
713                    ExpandoBridge expandoBridge = getExpandoBridge();
714    
715                    expandoBridge.setAttributes(serviceContext);
716            }
717    
718            @Override
719            public String[] getAvailableLanguageIds() {
720                    Set<String> availableLanguageIds = new TreeSet<String>();
721    
722                    Map<Locale, String> nameMap = getNameMap();
723    
724                    for (Map.Entry<Locale, String> entry : nameMap.entrySet()) {
725                            Locale locale = entry.getKey();
726                            String value = entry.getValue();
727    
728                            if (Validator.isNotNull(value)) {
729                                    availableLanguageIds.add(LocaleUtil.toLanguageId(locale));
730                            }
731                    }
732    
733                    Map<Locale, String> descriptionMap = getDescriptionMap();
734    
735                    for (Map.Entry<Locale, String> entry : descriptionMap.entrySet()) {
736                            Locale locale = entry.getKey();
737                            String value = entry.getValue();
738    
739                            if (Validator.isNotNull(value)) {
740                                    availableLanguageIds.add(LocaleUtil.toLanguageId(locale));
741                            }
742                    }
743    
744                    return availableLanguageIds.toArray(new String[availableLanguageIds.size()]);
745            }
746    
747            @Override
748            public String getDefaultLanguageId() {
749                    String xml = getName();
750    
751                    if (xml == null) {
752                            return StringPool.BLANK;
753                    }
754    
755                    Locale defaultLocale = LocaleUtil.getSiteDefault();
756    
757                    return LocalizationUtil.getDefaultLanguageId(xml, defaultLocale);
758            }
759    
760            @Override
761            public void prepareLocalizedFieldsForImport() throws LocaleException {
762                    Locale defaultLocale = LocaleUtil.fromLanguageId(getDefaultLanguageId());
763    
764                    Locale[] availableLocales = LocaleUtil.fromLanguageIds(getAvailableLanguageIds());
765    
766                    Locale defaultImportLocale = LocalizationUtil.getDefaultImportLocale(DLFileEntryType.class.getName(),
767                                    getPrimaryKey(), defaultLocale, availableLocales);
768    
769                    prepareLocalizedFieldsForImport(defaultImportLocale);
770            }
771    
772            @Override
773            @SuppressWarnings("unused")
774            public void prepareLocalizedFieldsForImport(Locale defaultImportLocale)
775                    throws LocaleException {
776                    Locale defaultLocale = LocaleUtil.getSiteDefault();
777    
778                    String modelDefaultLanguageId = getDefaultLanguageId();
779    
780                    String name = getName(defaultLocale);
781    
782                    if (Validator.isNull(name)) {
783                            setName(getName(modelDefaultLanguageId), defaultLocale);
784                    }
785                    else {
786                            setName(getName(defaultLocale), defaultLocale, defaultLocale);
787                    }
788    
789                    String description = getDescription(defaultLocale);
790    
791                    if (Validator.isNull(description)) {
792                            setDescription(getDescription(modelDefaultLanguageId), defaultLocale);
793                    }
794                    else {
795                            setDescription(getDescription(defaultLocale), defaultLocale,
796                                    defaultLocale);
797                    }
798            }
799    
800            @Override
801            public DLFileEntryType toEscapedModel() {
802                    if (_escapedModel == null) {
803                            _escapedModel = (DLFileEntryType)ProxyUtil.newProxyInstance(_classLoader,
804                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
805                    }
806    
807                    return _escapedModel;
808            }
809    
810            @Override
811            public Object clone() {
812                    DLFileEntryTypeImpl dlFileEntryTypeImpl = new DLFileEntryTypeImpl();
813    
814                    dlFileEntryTypeImpl.setUuid(getUuid());
815                    dlFileEntryTypeImpl.setFileEntryTypeId(getFileEntryTypeId());
816                    dlFileEntryTypeImpl.setGroupId(getGroupId());
817                    dlFileEntryTypeImpl.setCompanyId(getCompanyId());
818                    dlFileEntryTypeImpl.setUserId(getUserId());
819                    dlFileEntryTypeImpl.setUserName(getUserName());
820                    dlFileEntryTypeImpl.setCreateDate(getCreateDate());
821                    dlFileEntryTypeImpl.setModifiedDate(getModifiedDate());
822                    dlFileEntryTypeImpl.setFileEntryTypeKey(getFileEntryTypeKey());
823                    dlFileEntryTypeImpl.setName(getName());
824                    dlFileEntryTypeImpl.setDescription(getDescription());
825    
826                    dlFileEntryTypeImpl.resetOriginalValues();
827    
828                    return dlFileEntryTypeImpl;
829            }
830    
831            @Override
832            public int compareTo(DLFileEntryType dlFileEntryType) {
833                    long primaryKey = dlFileEntryType.getPrimaryKey();
834    
835                    if (getPrimaryKey() < primaryKey) {
836                            return -1;
837                    }
838                    else if (getPrimaryKey() > primaryKey) {
839                            return 1;
840                    }
841                    else {
842                            return 0;
843                    }
844            }
845    
846            @Override
847            public boolean equals(Object obj) {
848                    if (this == obj) {
849                            return true;
850                    }
851    
852                    if (!(obj instanceof DLFileEntryType)) {
853                            return false;
854                    }
855    
856                    DLFileEntryType dlFileEntryType = (DLFileEntryType)obj;
857    
858                    long primaryKey = dlFileEntryType.getPrimaryKey();
859    
860                    if (getPrimaryKey() == primaryKey) {
861                            return true;
862                    }
863                    else {
864                            return false;
865                    }
866            }
867    
868            @Override
869            public int hashCode() {
870                    return (int)getPrimaryKey();
871            }
872    
873            @Override
874            public boolean isEntityCacheEnabled() {
875                    return ENTITY_CACHE_ENABLED;
876            }
877    
878            @Override
879            public boolean isFinderCacheEnabled() {
880                    return FINDER_CACHE_ENABLED;
881            }
882    
883            @Override
884            public void resetOriginalValues() {
885                    DLFileEntryTypeModelImpl dlFileEntryTypeModelImpl = this;
886    
887                    dlFileEntryTypeModelImpl._originalUuid = dlFileEntryTypeModelImpl._uuid;
888    
889                    dlFileEntryTypeModelImpl._originalGroupId = dlFileEntryTypeModelImpl._groupId;
890    
891                    dlFileEntryTypeModelImpl._setOriginalGroupId = false;
892    
893                    dlFileEntryTypeModelImpl._originalCompanyId = dlFileEntryTypeModelImpl._companyId;
894    
895                    dlFileEntryTypeModelImpl._setOriginalCompanyId = false;
896    
897                    dlFileEntryTypeModelImpl._setModifiedDate = false;
898    
899                    dlFileEntryTypeModelImpl._originalFileEntryTypeKey = dlFileEntryTypeModelImpl._fileEntryTypeKey;
900    
901                    dlFileEntryTypeModelImpl._columnBitmask = 0;
902            }
903    
904            @Override
905            public CacheModel<DLFileEntryType> toCacheModel() {
906                    DLFileEntryTypeCacheModel dlFileEntryTypeCacheModel = new DLFileEntryTypeCacheModel();
907    
908                    dlFileEntryTypeCacheModel.uuid = getUuid();
909    
910                    String uuid = dlFileEntryTypeCacheModel.uuid;
911    
912                    if ((uuid != null) && (uuid.length() == 0)) {
913                            dlFileEntryTypeCacheModel.uuid = null;
914                    }
915    
916                    dlFileEntryTypeCacheModel.fileEntryTypeId = getFileEntryTypeId();
917    
918                    dlFileEntryTypeCacheModel.groupId = getGroupId();
919    
920                    dlFileEntryTypeCacheModel.companyId = getCompanyId();
921    
922                    dlFileEntryTypeCacheModel.userId = getUserId();
923    
924                    dlFileEntryTypeCacheModel.userName = getUserName();
925    
926                    String userName = dlFileEntryTypeCacheModel.userName;
927    
928                    if ((userName != null) && (userName.length() == 0)) {
929                            dlFileEntryTypeCacheModel.userName = null;
930                    }
931    
932                    Date createDate = getCreateDate();
933    
934                    if (createDate != null) {
935                            dlFileEntryTypeCacheModel.createDate = createDate.getTime();
936                    }
937                    else {
938                            dlFileEntryTypeCacheModel.createDate = Long.MIN_VALUE;
939                    }
940    
941                    Date modifiedDate = getModifiedDate();
942    
943                    if (modifiedDate != null) {
944                            dlFileEntryTypeCacheModel.modifiedDate = modifiedDate.getTime();
945                    }
946                    else {
947                            dlFileEntryTypeCacheModel.modifiedDate = Long.MIN_VALUE;
948                    }
949    
950                    dlFileEntryTypeCacheModel.fileEntryTypeKey = getFileEntryTypeKey();
951    
952                    String fileEntryTypeKey = dlFileEntryTypeCacheModel.fileEntryTypeKey;
953    
954                    if ((fileEntryTypeKey != null) && (fileEntryTypeKey.length() == 0)) {
955                            dlFileEntryTypeCacheModel.fileEntryTypeKey = null;
956                    }
957    
958                    dlFileEntryTypeCacheModel.name = getName();
959    
960                    String name = dlFileEntryTypeCacheModel.name;
961    
962                    if ((name != null) && (name.length() == 0)) {
963                            dlFileEntryTypeCacheModel.name = null;
964                    }
965    
966                    dlFileEntryTypeCacheModel.description = getDescription();
967    
968                    String description = dlFileEntryTypeCacheModel.description;
969    
970                    if ((description != null) && (description.length() == 0)) {
971                            dlFileEntryTypeCacheModel.description = null;
972                    }
973    
974                    return dlFileEntryTypeCacheModel;
975            }
976    
977            @Override
978            public String toString() {
979                    StringBundler sb = new StringBundler(23);
980    
981                    sb.append("{uuid=");
982                    sb.append(getUuid());
983                    sb.append(", fileEntryTypeId=");
984                    sb.append(getFileEntryTypeId());
985                    sb.append(", groupId=");
986                    sb.append(getGroupId());
987                    sb.append(", companyId=");
988                    sb.append(getCompanyId());
989                    sb.append(", userId=");
990                    sb.append(getUserId());
991                    sb.append(", userName=");
992                    sb.append(getUserName());
993                    sb.append(", createDate=");
994                    sb.append(getCreateDate());
995                    sb.append(", modifiedDate=");
996                    sb.append(getModifiedDate());
997                    sb.append(", fileEntryTypeKey=");
998                    sb.append(getFileEntryTypeKey());
999                    sb.append(", name=");
1000                    sb.append(getName());
1001                    sb.append(", description=");
1002                    sb.append(getDescription());
1003                    sb.append("}");
1004    
1005                    return sb.toString();
1006            }
1007    
1008            @Override
1009            public String toXmlString() {
1010                    StringBundler sb = new StringBundler(37);
1011    
1012                    sb.append("<model><model-name>");
1013                    sb.append("com.liferay.portlet.documentlibrary.model.DLFileEntryType");
1014                    sb.append("</model-name>");
1015    
1016                    sb.append(
1017                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
1018                    sb.append(getUuid());
1019                    sb.append("]]></column-value></column>");
1020                    sb.append(
1021                            "<column><column-name>fileEntryTypeId</column-name><column-value><![CDATA[");
1022                    sb.append(getFileEntryTypeId());
1023                    sb.append("]]></column-value></column>");
1024                    sb.append(
1025                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
1026                    sb.append(getGroupId());
1027                    sb.append("]]></column-value></column>");
1028                    sb.append(
1029                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
1030                    sb.append(getCompanyId());
1031                    sb.append("]]></column-value></column>");
1032                    sb.append(
1033                            "<column><column-name>userId</column-name><column-value><![CDATA[");
1034                    sb.append(getUserId());
1035                    sb.append("]]></column-value></column>");
1036                    sb.append(
1037                            "<column><column-name>userName</column-name><column-value><![CDATA[");
1038                    sb.append(getUserName());
1039                    sb.append("]]></column-value></column>");
1040                    sb.append(
1041                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
1042                    sb.append(getCreateDate());
1043                    sb.append("]]></column-value></column>");
1044                    sb.append(
1045                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
1046                    sb.append(getModifiedDate());
1047                    sb.append("]]></column-value></column>");
1048                    sb.append(
1049                            "<column><column-name>fileEntryTypeKey</column-name><column-value><![CDATA[");
1050                    sb.append(getFileEntryTypeKey());
1051                    sb.append("]]></column-value></column>");
1052                    sb.append(
1053                            "<column><column-name>name</column-name><column-value><![CDATA[");
1054                    sb.append(getName());
1055                    sb.append("]]></column-value></column>");
1056                    sb.append(
1057                            "<column><column-name>description</column-name><column-value><![CDATA[");
1058                    sb.append(getDescription());
1059                    sb.append("]]></column-value></column>");
1060    
1061                    sb.append("</model>");
1062    
1063                    return sb.toString();
1064            }
1065    
1066            private static final ClassLoader _classLoader = DLFileEntryType.class.getClassLoader();
1067            private static final Class<?>[] _escapedModelInterfaces = new Class[] {
1068                            DLFileEntryType.class
1069                    };
1070            private String _uuid;
1071            private String _originalUuid;
1072            private long _fileEntryTypeId;
1073            private long _groupId;
1074            private long _originalGroupId;
1075            private boolean _setOriginalGroupId;
1076            private long _companyId;
1077            private long _originalCompanyId;
1078            private boolean _setOriginalCompanyId;
1079            private long _userId;
1080            private String _userName;
1081            private Date _createDate;
1082            private Date _modifiedDate;
1083            private boolean _setModifiedDate;
1084            private String _fileEntryTypeKey;
1085            private String _originalFileEntryTypeKey;
1086            private String _name;
1087            private String _nameCurrentLanguageId;
1088            private String _description;
1089            private String _descriptionCurrentLanguageId;
1090            private long _columnBitmask;
1091            private DLFileEntryType _escapedModel;
1092    }