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.lar.StagedModelType;
024    import com.liferay.portal.kernel.util.GetterUtil;
025    import com.liferay.portal.kernel.util.LocaleUtil;
026    import com.liferay.portal.kernel.util.LocalizationUtil;
027    import com.liferay.portal.kernel.util.ProxyUtil;
028    import com.liferay.portal.kernel.util.StringBundler;
029    import com.liferay.portal.kernel.util.StringPool;
030    import com.liferay.portal.kernel.util.Validator;
031    import com.liferay.portal.model.CacheModel;
032    import com.liferay.portal.model.LayoutPrototype;
033    import com.liferay.portal.model.LayoutPrototypeModel;
034    import com.liferay.portal.model.LayoutPrototypeSoap;
035    import com.liferay.portal.model.User;
036    import com.liferay.portal.service.ServiceContext;
037    import com.liferay.portal.service.UserLocalServiceUtil;
038    import com.liferay.portal.util.PortalUtil;
039    
040    import com.liferay.portlet.expando.model.ExpandoBridge;
041    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
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 com.liferay.portal.model.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 com.liferay.portal.model.LayoutPrototype
066     * @see com.liferay.portal.model.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 com.liferay.portal.model.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            @Override
428            public void setModifiedDate(Date modifiedDate) {
429                    _modifiedDate = modifiedDate;
430            }
431    
432            @JSON
433            @Override
434            public String getName() {
435                    if (_name == null) {
436                            return StringPool.BLANK;
437                    }
438                    else {
439                            return _name;
440                    }
441            }
442    
443            @Override
444            public String getName(Locale locale) {
445                    String languageId = LocaleUtil.toLanguageId(locale);
446    
447                    return getName(languageId);
448            }
449    
450            @Override
451            public String getName(Locale locale, boolean useDefault) {
452                    String languageId = LocaleUtil.toLanguageId(locale);
453    
454                    return getName(languageId, useDefault);
455            }
456    
457            @Override
458            public String getName(String languageId) {
459                    return LocalizationUtil.getLocalization(getName(), languageId);
460            }
461    
462            @Override
463            public String getName(String languageId, boolean useDefault) {
464                    return LocalizationUtil.getLocalization(getName(), languageId,
465                            useDefault);
466            }
467    
468            @Override
469            public String getNameCurrentLanguageId() {
470                    return _nameCurrentLanguageId;
471            }
472    
473            @JSON
474            @Override
475            public String getNameCurrentValue() {
476                    Locale locale = getLocale(_nameCurrentLanguageId);
477    
478                    return getName(locale);
479            }
480    
481            @Override
482            public Map<Locale, String> getNameMap() {
483                    return LocalizationUtil.getLocalizationMap(getName());
484            }
485    
486            @Override
487            public void setName(String name) {
488                    _name = name;
489            }
490    
491            @Override
492            public void setName(String name, Locale locale) {
493                    setName(name, locale, LocaleUtil.getDefault());
494            }
495    
496            @Override
497            public void setName(String name, Locale locale, Locale defaultLocale) {
498                    String languageId = LocaleUtil.toLanguageId(locale);
499                    String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
500    
501                    if (Validator.isNotNull(name)) {
502                            setName(LocalizationUtil.updateLocalization(getName(), "Name",
503                                            name, languageId, defaultLanguageId));
504                    }
505                    else {
506                            setName(LocalizationUtil.removeLocalization(getName(), "Name",
507                                            languageId));
508                    }
509            }
510    
511            @Override
512            public void setNameCurrentLanguageId(String languageId) {
513                    _nameCurrentLanguageId = languageId;
514            }
515    
516            @Override
517            public void setNameMap(Map<Locale, String> nameMap) {
518                    setNameMap(nameMap, LocaleUtil.getDefault());
519            }
520    
521            @Override
522            public void setNameMap(Map<Locale, String> nameMap, Locale defaultLocale) {
523                    if (nameMap == null) {
524                            return;
525                    }
526    
527                    setName(LocalizationUtil.updateLocalization(nameMap, getName(), "Name",
528                                    LocaleUtil.toLanguageId(defaultLocale)));
529            }
530    
531            @JSON
532            @Override
533            public String getDescription() {
534                    if (_description == null) {
535                            return StringPool.BLANK;
536                    }
537                    else {
538                            return _description;
539                    }
540            }
541    
542            @Override
543            public String getDescription(Locale locale) {
544                    String languageId = LocaleUtil.toLanguageId(locale);
545    
546                    return getDescription(languageId);
547            }
548    
549            @Override
550            public String getDescription(Locale locale, boolean useDefault) {
551                    String languageId = LocaleUtil.toLanguageId(locale);
552    
553                    return getDescription(languageId, useDefault);
554            }
555    
556            @Override
557            public String getDescription(String languageId) {
558                    return LocalizationUtil.getLocalization(getDescription(), languageId);
559            }
560    
561            @Override
562            public String getDescription(String languageId, boolean useDefault) {
563                    return LocalizationUtil.getLocalization(getDescription(), languageId,
564                            useDefault);
565            }
566    
567            @Override
568            public String getDescriptionCurrentLanguageId() {
569                    return _descriptionCurrentLanguageId;
570            }
571    
572            @JSON
573            @Override
574            public String getDescriptionCurrentValue() {
575                    Locale locale = getLocale(_descriptionCurrentLanguageId);
576    
577                    return getDescription(locale);
578            }
579    
580            @Override
581            public Map<Locale, String> getDescriptionMap() {
582                    return LocalizationUtil.getLocalizationMap(getDescription());
583            }
584    
585            @Override
586            public void setDescription(String description) {
587                    _description = description;
588            }
589    
590            @Override
591            public void setDescription(String description, Locale locale) {
592                    setDescription(description, locale, LocaleUtil.getDefault());
593            }
594    
595            @Override
596            public void setDescription(String description, Locale locale,
597                    Locale defaultLocale) {
598                    String languageId = LocaleUtil.toLanguageId(locale);
599                    String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
600    
601                    if (Validator.isNotNull(description)) {
602                            setDescription(LocalizationUtil.updateLocalization(
603                                            getDescription(), "Description", description, languageId,
604                                            defaultLanguageId));
605                    }
606                    else {
607                            setDescription(LocalizationUtil.removeLocalization(
608                                            getDescription(), "Description", languageId));
609                    }
610            }
611    
612            @Override
613            public void setDescriptionCurrentLanguageId(String languageId) {
614                    _descriptionCurrentLanguageId = languageId;
615            }
616    
617            @Override
618            public void setDescriptionMap(Map<Locale, String> descriptionMap) {
619                    setDescriptionMap(descriptionMap, LocaleUtil.getDefault());
620            }
621    
622            @Override
623            public void setDescriptionMap(Map<Locale, String> descriptionMap,
624                    Locale defaultLocale) {
625                    if (descriptionMap == null) {
626                            return;
627                    }
628    
629                    setDescription(LocalizationUtil.updateLocalization(descriptionMap,
630                                    getDescription(), "Description",
631                                    LocaleUtil.toLanguageId(defaultLocale)));
632            }
633    
634            @JSON
635            @Override
636            public String getSettings() {
637                    if (_settings == null) {
638                            return StringPool.BLANK;
639                    }
640                    else {
641                            return _settings;
642                    }
643            }
644    
645            @Override
646            public void setSettings(String settings) {
647                    _settings = settings;
648            }
649    
650            @JSON
651            @Override
652            public boolean getActive() {
653                    return _active;
654            }
655    
656            @Override
657            public boolean isActive() {
658                    return _active;
659            }
660    
661            @Override
662            public void setActive(boolean active) {
663                    _columnBitmask |= ACTIVE_COLUMN_BITMASK;
664    
665                    if (!_setOriginalActive) {
666                            _setOriginalActive = true;
667    
668                            _originalActive = _active;
669                    }
670    
671                    _active = active;
672            }
673    
674            public boolean getOriginalActive() {
675                    return _originalActive;
676            }
677    
678            @Override
679            public StagedModelType getStagedModelType() {
680                    return new StagedModelType(PortalUtil.getClassNameId(
681                                    LayoutPrototype.class.getName()));
682            }
683    
684            public long getColumnBitmask() {
685                    return _columnBitmask;
686            }
687    
688            @Override
689            public ExpandoBridge getExpandoBridge() {
690                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
691                            LayoutPrototype.class.getName(), getPrimaryKey());
692            }
693    
694            @Override
695            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
696                    ExpandoBridge expandoBridge = getExpandoBridge();
697    
698                    expandoBridge.setAttributes(serviceContext);
699            }
700    
701            @Override
702            public String[] getAvailableLanguageIds() {
703                    Set<String> availableLanguageIds = new TreeSet<String>();
704    
705                    Map<Locale, String> nameMap = getNameMap();
706    
707                    for (Map.Entry<Locale, String> entry : nameMap.entrySet()) {
708                            Locale locale = entry.getKey();
709                            String value = entry.getValue();
710    
711                            if (Validator.isNotNull(value)) {
712                                    availableLanguageIds.add(LocaleUtil.toLanguageId(locale));
713                            }
714                    }
715    
716                    Map<Locale, String> descriptionMap = getDescriptionMap();
717    
718                    for (Map.Entry<Locale, String> entry : descriptionMap.entrySet()) {
719                            Locale locale = entry.getKey();
720                            String value = entry.getValue();
721    
722                            if (Validator.isNotNull(value)) {
723                                    availableLanguageIds.add(LocaleUtil.toLanguageId(locale));
724                            }
725                    }
726    
727                    return availableLanguageIds.toArray(new String[availableLanguageIds.size()]);
728            }
729    
730            @Override
731            public String getDefaultLanguageId() {
732                    String xml = getName();
733    
734                    if (xml == null) {
735                            return StringPool.BLANK;
736                    }
737    
738                    Locale defaultLocale = LocaleUtil.getDefault();
739    
740                    return LocalizationUtil.getDefaultLanguageId(xml, defaultLocale);
741            }
742    
743            @Override
744            public void prepareLocalizedFieldsForImport() throws LocaleException {
745                    Locale defaultLocale = LocaleUtil.fromLanguageId(getDefaultLanguageId());
746    
747                    Locale[] availableLocales = LocaleUtil.fromLanguageIds(getAvailableLanguageIds());
748    
749                    Locale defaultImportLocale = LocalizationUtil.getDefaultImportLocale(LayoutPrototype.class.getName(),
750                                    getPrimaryKey(), defaultLocale, availableLocales);
751    
752                    prepareLocalizedFieldsForImport(defaultImportLocale);
753            }
754    
755            @Override
756            @SuppressWarnings("unused")
757            public void prepareLocalizedFieldsForImport(Locale defaultImportLocale)
758                    throws LocaleException {
759                    Locale defaultLocale = LocaleUtil.getDefault();
760    
761                    String modelDefaultLanguageId = getDefaultLanguageId();
762    
763                    String name = getName(defaultLocale);
764    
765                    if (Validator.isNull(name)) {
766                            setName(getName(modelDefaultLanguageId), defaultLocale);
767                    }
768                    else {
769                            setName(getName(defaultLocale), defaultLocale, defaultLocale);
770                    }
771    
772                    String description = getDescription(defaultLocale);
773    
774                    if (Validator.isNull(description)) {
775                            setDescription(getDescription(modelDefaultLanguageId), defaultLocale);
776                    }
777                    else {
778                            setDescription(getDescription(defaultLocale), defaultLocale,
779                                    defaultLocale);
780                    }
781            }
782    
783            @Override
784            public LayoutPrototype toEscapedModel() {
785                    if (_escapedModel == null) {
786                            _escapedModel = (LayoutPrototype)ProxyUtil.newProxyInstance(_classLoader,
787                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
788                    }
789    
790                    return _escapedModel;
791            }
792    
793            @Override
794            public Object clone() {
795                    LayoutPrototypeImpl layoutPrototypeImpl = new LayoutPrototypeImpl();
796    
797                    layoutPrototypeImpl.setMvccVersion(getMvccVersion());
798                    layoutPrototypeImpl.setUuid(getUuid());
799                    layoutPrototypeImpl.setLayoutPrototypeId(getLayoutPrototypeId());
800                    layoutPrototypeImpl.setCompanyId(getCompanyId());
801                    layoutPrototypeImpl.setUserId(getUserId());
802                    layoutPrototypeImpl.setUserName(getUserName());
803                    layoutPrototypeImpl.setCreateDate(getCreateDate());
804                    layoutPrototypeImpl.setModifiedDate(getModifiedDate());
805                    layoutPrototypeImpl.setName(getName());
806                    layoutPrototypeImpl.setDescription(getDescription());
807                    layoutPrototypeImpl.setSettings(getSettings());
808                    layoutPrototypeImpl.setActive(getActive());
809    
810                    layoutPrototypeImpl.resetOriginalValues();
811    
812                    return layoutPrototypeImpl;
813            }
814    
815            @Override
816            public int compareTo(LayoutPrototype layoutPrototype) {
817                    long primaryKey = layoutPrototype.getPrimaryKey();
818    
819                    if (getPrimaryKey() < primaryKey) {
820                            return -1;
821                    }
822                    else if (getPrimaryKey() > primaryKey) {
823                            return 1;
824                    }
825                    else {
826                            return 0;
827                    }
828            }
829    
830            @Override
831            public boolean equals(Object obj) {
832                    if (this == obj) {
833                            return true;
834                    }
835    
836                    if (!(obj instanceof LayoutPrototype)) {
837                            return false;
838                    }
839    
840                    LayoutPrototype layoutPrototype = (LayoutPrototype)obj;
841    
842                    long primaryKey = layoutPrototype.getPrimaryKey();
843    
844                    if (getPrimaryKey() == primaryKey) {
845                            return true;
846                    }
847                    else {
848                            return false;
849                    }
850            }
851    
852            @Override
853            public int hashCode() {
854                    return (int)getPrimaryKey();
855            }
856    
857            @Override
858            public boolean isEntityCacheEnabled() {
859                    return ENTITY_CACHE_ENABLED;
860            }
861    
862            @Override
863            public boolean isFinderCacheEnabled() {
864                    return FINDER_CACHE_ENABLED;
865            }
866    
867            @Override
868            public void resetOriginalValues() {
869                    LayoutPrototypeModelImpl layoutPrototypeModelImpl = this;
870    
871                    layoutPrototypeModelImpl._originalUuid = layoutPrototypeModelImpl._uuid;
872    
873                    layoutPrototypeModelImpl._originalCompanyId = layoutPrototypeModelImpl._companyId;
874    
875                    layoutPrototypeModelImpl._setOriginalCompanyId = false;
876    
877                    layoutPrototypeModelImpl._originalActive = layoutPrototypeModelImpl._active;
878    
879                    layoutPrototypeModelImpl._setOriginalActive = false;
880    
881                    layoutPrototypeModelImpl._columnBitmask = 0;
882            }
883    
884            @Override
885            public CacheModel<LayoutPrototype> toCacheModel() {
886                    LayoutPrototypeCacheModel layoutPrototypeCacheModel = new LayoutPrototypeCacheModel();
887    
888                    layoutPrototypeCacheModel.mvccVersion = getMvccVersion();
889    
890                    layoutPrototypeCacheModel.uuid = getUuid();
891    
892                    String uuid = layoutPrototypeCacheModel.uuid;
893    
894                    if ((uuid != null) && (uuid.length() == 0)) {
895                            layoutPrototypeCacheModel.uuid = null;
896                    }
897    
898                    layoutPrototypeCacheModel.layoutPrototypeId = getLayoutPrototypeId();
899    
900                    layoutPrototypeCacheModel.companyId = getCompanyId();
901    
902                    layoutPrototypeCacheModel.userId = getUserId();
903    
904                    layoutPrototypeCacheModel.userName = getUserName();
905    
906                    String userName = layoutPrototypeCacheModel.userName;
907    
908                    if ((userName != null) && (userName.length() == 0)) {
909                            layoutPrototypeCacheModel.userName = null;
910                    }
911    
912                    Date createDate = getCreateDate();
913    
914                    if (createDate != null) {
915                            layoutPrototypeCacheModel.createDate = createDate.getTime();
916                    }
917                    else {
918                            layoutPrototypeCacheModel.createDate = Long.MIN_VALUE;
919                    }
920    
921                    Date modifiedDate = getModifiedDate();
922    
923                    if (modifiedDate != null) {
924                            layoutPrototypeCacheModel.modifiedDate = modifiedDate.getTime();
925                    }
926                    else {
927                            layoutPrototypeCacheModel.modifiedDate = Long.MIN_VALUE;
928                    }
929    
930                    layoutPrototypeCacheModel.name = getName();
931    
932                    String name = layoutPrototypeCacheModel.name;
933    
934                    if ((name != null) && (name.length() == 0)) {
935                            layoutPrototypeCacheModel.name = null;
936                    }
937    
938                    layoutPrototypeCacheModel.description = getDescription();
939    
940                    String description = layoutPrototypeCacheModel.description;
941    
942                    if ((description != null) && (description.length() == 0)) {
943                            layoutPrototypeCacheModel.description = null;
944                    }
945    
946                    layoutPrototypeCacheModel.settings = getSettings();
947    
948                    String settings = layoutPrototypeCacheModel.settings;
949    
950                    if ((settings != null) && (settings.length() == 0)) {
951                            layoutPrototypeCacheModel.settings = null;
952                    }
953    
954                    layoutPrototypeCacheModel.active = getActive();
955    
956                    return layoutPrototypeCacheModel;
957            }
958    
959            @Override
960            public String toString() {
961                    StringBundler sb = new StringBundler(25);
962    
963                    sb.append("{mvccVersion=");
964                    sb.append(getMvccVersion());
965                    sb.append(", uuid=");
966                    sb.append(getUuid());
967                    sb.append(", layoutPrototypeId=");
968                    sb.append(getLayoutPrototypeId());
969                    sb.append(", companyId=");
970                    sb.append(getCompanyId());
971                    sb.append(", userId=");
972                    sb.append(getUserId());
973                    sb.append(", userName=");
974                    sb.append(getUserName());
975                    sb.append(", createDate=");
976                    sb.append(getCreateDate());
977                    sb.append(", modifiedDate=");
978                    sb.append(getModifiedDate());
979                    sb.append(", name=");
980                    sb.append(getName());
981                    sb.append(", description=");
982                    sb.append(getDescription());
983                    sb.append(", settings=");
984                    sb.append(getSettings());
985                    sb.append(", active=");
986                    sb.append(getActive());
987                    sb.append("}");
988    
989                    return sb.toString();
990            }
991    
992            @Override
993            public String toXmlString() {
994                    StringBundler sb = new StringBundler(40);
995    
996                    sb.append("<model><model-name>");
997                    sb.append("com.liferay.portal.model.LayoutPrototype");
998                    sb.append("</model-name>");
999    
1000                    sb.append(
1001                            "<column><column-name>mvccVersion</column-name><column-value><![CDATA[");
1002                    sb.append(getMvccVersion());
1003                    sb.append("]]></column-value></column>");
1004                    sb.append(
1005                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
1006                    sb.append(getUuid());
1007                    sb.append("]]></column-value></column>");
1008                    sb.append(
1009                            "<column><column-name>layoutPrototypeId</column-name><column-value><![CDATA[");
1010                    sb.append(getLayoutPrototypeId());
1011                    sb.append("]]></column-value></column>");
1012                    sb.append(
1013                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
1014                    sb.append(getCompanyId());
1015                    sb.append("]]></column-value></column>");
1016                    sb.append(
1017                            "<column><column-name>userId</column-name><column-value><![CDATA[");
1018                    sb.append(getUserId());
1019                    sb.append("]]></column-value></column>");
1020                    sb.append(
1021                            "<column><column-name>userName</column-name><column-value><![CDATA[");
1022                    sb.append(getUserName());
1023                    sb.append("]]></column-value></column>");
1024                    sb.append(
1025                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
1026                    sb.append(getCreateDate());
1027                    sb.append("]]></column-value></column>");
1028                    sb.append(
1029                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
1030                    sb.append(getModifiedDate());
1031                    sb.append("]]></column-value></column>");
1032                    sb.append(
1033                            "<column><column-name>name</column-name><column-value><![CDATA[");
1034                    sb.append(getName());
1035                    sb.append("]]></column-value></column>");
1036                    sb.append(
1037                            "<column><column-name>description</column-name><column-value><![CDATA[");
1038                    sb.append(getDescription());
1039                    sb.append("]]></column-value></column>");
1040                    sb.append(
1041                            "<column><column-name>settings</column-name><column-value><![CDATA[");
1042                    sb.append(getSettings());
1043                    sb.append("]]></column-value></column>");
1044                    sb.append(
1045                            "<column><column-name>active</column-name><column-value><![CDATA[");
1046                    sb.append(getActive());
1047                    sb.append("]]></column-value></column>");
1048    
1049                    sb.append("</model>");
1050    
1051                    return sb.toString();
1052            }
1053    
1054            private static final ClassLoader _classLoader = LayoutPrototype.class.getClassLoader();
1055            private static final Class<?>[] _escapedModelInterfaces = new Class[] {
1056                            LayoutPrototype.class
1057                    };
1058            private long _mvccVersion;
1059            private String _uuid;
1060            private String _originalUuid;
1061            private long _layoutPrototypeId;
1062            private long _companyId;
1063            private long _originalCompanyId;
1064            private boolean _setOriginalCompanyId;
1065            private long _userId;
1066            private String _userName;
1067            private Date _createDate;
1068            private Date _modifiedDate;
1069            private String _name;
1070            private String _nameCurrentLanguageId;
1071            private String _description;
1072            private String _descriptionCurrentLanguageId;
1073            private String _settings;
1074            private boolean _active;
1075            private boolean _originalActive;
1076            private boolean _setOriginalActive;
1077            private long _columnBitmask;
1078            private LayoutPrototype _escapedModel;
1079    }