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