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