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