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