001    /**
002     * Copyright (c) 2000-2012 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 com.liferay.portal.LocaleException;
018    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
019    import com.liferay.portal.kernel.json.JSON;
020    import com.liferay.portal.kernel.util.GetterUtil;
021    import com.liferay.portal.kernel.util.LocaleUtil;
022    import com.liferay.portal.kernel.util.LocalizationUtil;
023    import com.liferay.portal.kernel.util.ProxyUtil;
024    import com.liferay.portal.kernel.util.StringBundler;
025    import com.liferay.portal.kernel.util.StringPool;
026    import com.liferay.portal.kernel.util.Validator;
027    import com.liferay.portal.model.CacheModel;
028    import com.liferay.portal.model.Role;
029    import com.liferay.portal.model.RoleModel;
030    import com.liferay.portal.model.RoleSoap;
031    import com.liferay.portal.service.ServiceContext;
032    import com.liferay.portal.util.PortalUtil;
033    
034    import com.liferay.portlet.expando.model.ExpandoBridge;
035    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
036    
037    import java.io.Serializable;
038    
039    import java.sql.Types;
040    
041    import java.util.ArrayList;
042    import java.util.HashMap;
043    import java.util.List;
044    import java.util.Locale;
045    import java.util.Map;
046    
047    /**
048     * The base model implementation for the Role service. Represents a row in the "Role_" database table, with each column mapped to a property of this class.
049     *
050     * <p>
051     * This implementation and its corresponding interface {@link com.liferay.portal.model.RoleModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link RoleImpl}.
052     * </p>
053     *
054     * @author Brian Wing Shun Chan
055     * @see RoleImpl
056     * @see com.liferay.portal.model.Role
057     * @see com.liferay.portal.model.RoleModel
058     * @generated
059     */
060    @JSON(strict = true)
061    public class RoleModelImpl extends BaseModelImpl<Role> implements RoleModel {
062            /*
063             * NOTE FOR DEVELOPERS:
064             *
065             * Never modify or reference this class directly. All methods that expect a role model instance should use the {@link com.liferay.portal.model.Role} interface instead.
066             */
067            public static final String TABLE_NAME = "Role_";
068            public static final Object[][] TABLE_COLUMNS = {
069                            { "roleId", Types.BIGINT },
070                            { "companyId", Types.BIGINT },
071                            { "classNameId", Types.BIGINT },
072                            { "classPK", Types.BIGINT },
073                            { "name", Types.VARCHAR },
074                            { "title", Types.VARCHAR },
075                            { "description", Types.VARCHAR },
076                            { "type_", Types.INTEGER },
077                            { "subtype", Types.VARCHAR }
078                    };
079            public static final String TABLE_SQL_CREATE = "create table Role_ (roleId LONG not null primary key,companyId LONG,classNameId LONG,classPK LONG,name VARCHAR(75) null,title STRING null,description STRING null,type_ INTEGER,subtype VARCHAR(75) null)";
080            public static final String TABLE_SQL_DROP = "drop table Role_";
081            public static final String ORDER_BY_JPQL = " ORDER BY role.name ASC";
082            public static final String ORDER_BY_SQL = " ORDER BY Role_.name ASC";
083            public static final String DATA_SOURCE = "liferayDataSource";
084            public static final String SESSION_FACTORY = "liferaySessionFactory";
085            public static final String TX_MANAGER = "liferayTransactionManager";
086            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
087                                    "value.object.entity.cache.enabled.com.liferay.portal.model.Role"),
088                            true);
089            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
090                                    "value.object.finder.cache.enabled.com.liferay.portal.model.Role"),
091                            true);
092            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
093                                    "value.object.column.bitmask.enabled.com.liferay.portal.model.Role"),
094                            true);
095            public static long CLASSNAMEID_COLUMN_BITMASK = 1L;
096            public static long CLASSPK_COLUMN_BITMASK = 2L;
097            public static long COMPANYID_COLUMN_BITMASK = 4L;
098            public static long NAME_COLUMN_BITMASK = 8L;
099            public static long SUBTYPE_COLUMN_BITMASK = 16L;
100            public static long TYPE_COLUMN_BITMASK = 32L;
101    
102            /**
103             * Converts the soap model instance into a normal model instance.
104             *
105             * @param soapModel the soap model instance to convert
106             * @return the normal model instance
107             */
108            public static Role toModel(RoleSoap soapModel) {
109                    if (soapModel == null) {
110                            return null;
111                    }
112    
113                    Role model = new RoleImpl();
114    
115                    model.setRoleId(soapModel.getRoleId());
116                    model.setCompanyId(soapModel.getCompanyId());
117                    model.setClassNameId(soapModel.getClassNameId());
118                    model.setClassPK(soapModel.getClassPK());
119                    model.setName(soapModel.getName());
120                    model.setTitle(soapModel.getTitle());
121                    model.setDescription(soapModel.getDescription());
122                    model.setType(soapModel.getType());
123                    model.setSubtype(soapModel.getSubtype());
124    
125                    return model;
126            }
127    
128            /**
129             * Converts the soap model instances into normal model instances.
130             *
131             * @param soapModels the soap model instances to convert
132             * @return the normal model instances
133             */
134            public static List<Role> toModels(RoleSoap[] soapModels) {
135                    if (soapModels == null) {
136                            return null;
137                    }
138    
139                    List<Role> models = new ArrayList<Role>(soapModels.length);
140    
141                    for (RoleSoap soapModel : soapModels) {
142                            models.add(toModel(soapModel));
143                    }
144    
145                    return models;
146            }
147    
148            public static final String MAPPING_TABLE_GROUPS_ROLES_NAME = "Groups_Roles";
149            public static final Object[][] MAPPING_TABLE_GROUPS_ROLES_COLUMNS = {
150                            { "groupId", Types.BIGINT },
151                            { "roleId", Types.BIGINT }
152                    };
153            public static final String MAPPING_TABLE_GROUPS_ROLES_SQL_CREATE = "create table Groups_Roles (groupId LONG not null,roleId LONG not null,primary key (groupId, roleId))";
154            public static final boolean FINDER_CACHE_ENABLED_GROUPS_ROLES = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
155                                    "value.object.finder.cache.enabled.Groups_Roles"), true);
156            public static final String MAPPING_TABLE_USERS_ROLES_NAME = "Users_Roles";
157            public static final Object[][] MAPPING_TABLE_USERS_ROLES_COLUMNS = {
158                            { "userId", Types.BIGINT },
159                            { "roleId", Types.BIGINT }
160                    };
161            public static final String MAPPING_TABLE_USERS_ROLES_SQL_CREATE = "create table Users_Roles (userId LONG not null,roleId LONG not null,primary key (userId, roleId))";
162            public static final boolean FINDER_CACHE_ENABLED_USERS_ROLES = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
163                                    "value.object.finder.cache.enabled.Users_Roles"), true);
164            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
165                                    "lock.expiration.time.com.liferay.portal.model.Role"));
166    
167            public RoleModelImpl() {
168            }
169    
170            public long getPrimaryKey() {
171                    return _roleId;
172            }
173    
174            public void setPrimaryKey(long primaryKey) {
175                    setRoleId(primaryKey);
176            }
177    
178            public Serializable getPrimaryKeyObj() {
179                    return new Long(_roleId);
180            }
181    
182            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
183                    setPrimaryKey(((Long)primaryKeyObj).longValue());
184            }
185    
186            public Class<?> getModelClass() {
187                    return Role.class;
188            }
189    
190            public String getModelClassName() {
191                    return Role.class.getName();
192            }
193    
194            @Override
195            public Map<String, Object> getModelAttributes() {
196                    Map<String, Object> attributes = new HashMap<String, Object>();
197    
198                    attributes.put("roleId", getRoleId());
199                    attributes.put("companyId", getCompanyId());
200                    attributes.put("classNameId", getClassNameId());
201                    attributes.put("classPK", getClassPK());
202                    attributes.put("name", getName());
203                    attributes.put("title", getTitle());
204                    attributes.put("description", getDescription());
205                    attributes.put("type", getType());
206                    attributes.put("subtype", getSubtype());
207    
208                    return attributes;
209            }
210    
211            @Override
212            public void setModelAttributes(Map<String, Object> attributes) {
213                    Long roleId = (Long)attributes.get("roleId");
214    
215                    if (roleId != null) {
216                            setRoleId(roleId);
217                    }
218    
219                    Long companyId = (Long)attributes.get("companyId");
220    
221                    if (companyId != null) {
222                            setCompanyId(companyId);
223                    }
224    
225                    Long classNameId = (Long)attributes.get("classNameId");
226    
227                    if (classNameId != null) {
228                            setClassNameId(classNameId);
229                    }
230    
231                    Long classPK = (Long)attributes.get("classPK");
232    
233                    if (classPK != null) {
234                            setClassPK(classPK);
235                    }
236    
237                    String name = (String)attributes.get("name");
238    
239                    if (name != null) {
240                            setName(name);
241                    }
242    
243                    String title = (String)attributes.get("title");
244    
245                    if (title != null) {
246                            setTitle(title);
247                    }
248    
249                    String description = (String)attributes.get("description");
250    
251                    if (description != null) {
252                            setDescription(description);
253                    }
254    
255                    Integer type = (Integer)attributes.get("type");
256    
257                    if (type != null) {
258                            setType(type);
259                    }
260    
261                    String subtype = (String)attributes.get("subtype");
262    
263                    if (subtype != null) {
264                            setSubtype(subtype);
265                    }
266            }
267    
268            @JSON
269            public long getRoleId() {
270                    return _roleId;
271            }
272    
273            public void setRoleId(long roleId) {
274                    _roleId = roleId;
275            }
276    
277            @JSON
278            public long getCompanyId() {
279                    return _companyId;
280            }
281    
282            public void setCompanyId(long companyId) {
283                    _columnBitmask |= COMPANYID_COLUMN_BITMASK;
284    
285                    if (!_setOriginalCompanyId) {
286                            _setOriginalCompanyId = true;
287    
288                            _originalCompanyId = _companyId;
289                    }
290    
291                    _companyId = companyId;
292            }
293    
294            public long getOriginalCompanyId() {
295                    return _originalCompanyId;
296            }
297    
298            public String getClassName() {
299                    if (getClassNameId() <= 0) {
300                            return StringPool.BLANK;
301                    }
302    
303                    return PortalUtil.getClassName(getClassNameId());
304            }
305    
306            public void setClassName(String className) {
307                    long classNameId = 0;
308    
309                    if (Validator.isNotNull(className)) {
310                            classNameId = PortalUtil.getClassNameId(className);
311                    }
312    
313                    setClassNameId(classNameId);
314            }
315    
316            @JSON
317            public long getClassNameId() {
318                    return _classNameId;
319            }
320    
321            public void setClassNameId(long classNameId) {
322                    _columnBitmask |= CLASSNAMEID_COLUMN_BITMASK;
323    
324                    if (!_setOriginalClassNameId) {
325                            _setOriginalClassNameId = true;
326    
327                            _originalClassNameId = _classNameId;
328                    }
329    
330                    _classNameId = classNameId;
331            }
332    
333            public long getOriginalClassNameId() {
334                    return _originalClassNameId;
335            }
336    
337            @JSON
338            public long getClassPK() {
339                    return _classPK;
340            }
341    
342            public void setClassPK(long classPK) {
343                    _columnBitmask |= CLASSPK_COLUMN_BITMASK;
344    
345                    if (!_setOriginalClassPK) {
346                            _setOriginalClassPK = true;
347    
348                            _originalClassPK = _classPK;
349                    }
350    
351                    _classPK = classPK;
352            }
353    
354            public long getOriginalClassPK() {
355                    return _originalClassPK;
356            }
357    
358            @JSON
359            public String getName() {
360                    if (_name == null) {
361                            return StringPool.BLANK;
362                    }
363                    else {
364                            return _name;
365                    }
366            }
367    
368            public void setName(String name) {
369                    _columnBitmask = -1L;
370    
371                    if (_originalName == null) {
372                            _originalName = _name;
373                    }
374    
375                    _name = name;
376            }
377    
378            public String getOriginalName() {
379                    return GetterUtil.getString(_originalName);
380            }
381    
382            @JSON
383            public String getTitle() {
384                    if (_title == null) {
385                            return StringPool.BLANK;
386                    }
387                    else {
388                            return _title;
389                    }
390            }
391    
392            public String getTitle(Locale locale) {
393                    String languageId = LocaleUtil.toLanguageId(locale);
394    
395                    return getTitle(languageId);
396            }
397    
398            public String getTitle(Locale locale, boolean useDefault) {
399                    String languageId = LocaleUtil.toLanguageId(locale);
400    
401                    return getTitle(languageId, useDefault);
402            }
403    
404            public String getTitle(String languageId) {
405                    return LocalizationUtil.getLocalization(getTitle(), languageId);
406            }
407    
408            public String getTitle(String languageId, boolean useDefault) {
409                    return LocalizationUtil.getLocalization(getTitle(), languageId,
410                            useDefault);
411            }
412    
413            public String getTitleCurrentLanguageId() {
414                    return _titleCurrentLanguageId;
415            }
416    
417            @JSON
418            public String getTitleCurrentValue() {
419                    Locale locale = getLocale(_titleCurrentLanguageId);
420    
421                    return getTitle(locale);
422            }
423    
424            public Map<Locale, String> getTitleMap() {
425                    return LocalizationUtil.getLocalizationMap(getTitle());
426            }
427    
428            public void setTitle(String title) {
429                    _title = title;
430            }
431    
432            public void setTitle(String title, Locale locale) {
433                    setTitle(title, locale, LocaleUtil.getDefault());
434            }
435    
436            public void setTitle(String title, Locale locale, Locale defaultLocale) {
437                    String languageId = LocaleUtil.toLanguageId(locale);
438                    String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
439    
440                    if (Validator.isNotNull(title)) {
441                            setTitle(LocalizationUtil.updateLocalization(getTitle(), "Title",
442                                            title, languageId, defaultLanguageId));
443                    }
444                    else {
445                            setTitle(LocalizationUtil.removeLocalization(getTitle(), "Title",
446                                            languageId));
447                    }
448            }
449    
450            public void setTitleCurrentLanguageId(String languageId) {
451                    _titleCurrentLanguageId = languageId;
452            }
453    
454            public void setTitleMap(Map<Locale, String> titleMap) {
455                    setTitleMap(titleMap, LocaleUtil.getDefault());
456            }
457    
458            public void setTitleMap(Map<Locale, String> titleMap, Locale defaultLocale) {
459                    if (titleMap == null) {
460                            return;
461                    }
462    
463                    setTitle(LocalizationUtil.updateLocalization(titleMap, getTitle(),
464                                    "Title", LocaleUtil.toLanguageId(defaultLocale)));
465            }
466    
467            @JSON
468            public String getDescription() {
469                    if (_description == null) {
470                            return StringPool.BLANK;
471                    }
472                    else {
473                            return _description;
474                    }
475            }
476    
477            public String getDescription(Locale locale) {
478                    String languageId = LocaleUtil.toLanguageId(locale);
479    
480                    return getDescription(languageId);
481            }
482    
483            public String getDescription(Locale locale, boolean useDefault) {
484                    String languageId = LocaleUtil.toLanguageId(locale);
485    
486                    return getDescription(languageId, useDefault);
487            }
488    
489            public String getDescription(String languageId) {
490                    return LocalizationUtil.getLocalization(getDescription(), languageId);
491            }
492    
493            public String getDescription(String languageId, boolean useDefault) {
494                    return LocalizationUtil.getLocalization(getDescription(), languageId,
495                            useDefault);
496            }
497    
498            public String getDescriptionCurrentLanguageId() {
499                    return _descriptionCurrentLanguageId;
500            }
501    
502            @JSON
503            public String getDescriptionCurrentValue() {
504                    Locale locale = getLocale(_descriptionCurrentLanguageId);
505    
506                    return getDescription(locale);
507            }
508    
509            public Map<Locale, String> getDescriptionMap() {
510                    return LocalizationUtil.getLocalizationMap(getDescription());
511            }
512    
513            public void setDescription(String description) {
514                    _description = description;
515            }
516    
517            public void setDescription(String description, Locale locale) {
518                    setDescription(description, locale, LocaleUtil.getDefault());
519            }
520    
521            public void setDescription(String description, Locale locale,
522                    Locale defaultLocale) {
523                    String languageId = LocaleUtil.toLanguageId(locale);
524                    String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
525    
526                    if (Validator.isNotNull(description)) {
527                            setDescription(LocalizationUtil.updateLocalization(
528                                            getDescription(), "Description", description, languageId,
529                                            defaultLanguageId));
530                    }
531                    else {
532                            setDescription(LocalizationUtil.removeLocalization(
533                                            getDescription(), "Description", languageId));
534                    }
535            }
536    
537            public void setDescriptionCurrentLanguageId(String languageId) {
538                    _descriptionCurrentLanguageId = languageId;
539            }
540    
541            public void setDescriptionMap(Map<Locale, String> descriptionMap) {
542                    setDescriptionMap(descriptionMap, LocaleUtil.getDefault());
543            }
544    
545            public void setDescriptionMap(Map<Locale, String> descriptionMap,
546                    Locale defaultLocale) {
547                    if (descriptionMap == null) {
548                            return;
549                    }
550    
551                    setDescription(LocalizationUtil.updateLocalization(descriptionMap,
552                                    getDescription(), "Description",
553                                    LocaleUtil.toLanguageId(defaultLocale)));
554            }
555    
556            @JSON
557            public int getType() {
558                    return _type;
559            }
560    
561            public void setType(int type) {
562                    _columnBitmask |= TYPE_COLUMN_BITMASK;
563    
564                    if (!_setOriginalType) {
565                            _setOriginalType = true;
566    
567                            _originalType = _type;
568                    }
569    
570                    _type = type;
571            }
572    
573            public int getOriginalType() {
574                    return _originalType;
575            }
576    
577            @JSON
578            public String getSubtype() {
579                    if (_subtype == null) {
580                            return StringPool.BLANK;
581                    }
582                    else {
583                            return _subtype;
584                    }
585            }
586    
587            public void setSubtype(String subtype) {
588                    _columnBitmask |= SUBTYPE_COLUMN_BITMASK;
589    
590                    if (_originalSubtype == null) {
591                            _originalSubtype = _subtype;
592                    }
593    
594                    _subtype = subtype;
595            }
596    
597            public String getOriginalSubtype() {
598                    return GetterUtil.getString(_originalSubtype);
599            }
600    
601            public long getColumnBitmask() {
602                    return _columnBitmask;
603            }
604    
605            @Override
606            public ExpandoBridge getExpandoBridge() {
607                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
608                            Role.class.getName(), getPrimaryKey());
609            }
610    
611            @Override
612            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
613                    ExpandoBridge expandoBridge = getExpandoBridge();
614    
615                    expandoBridge.setAttributes(serviceContext);
616            }
617    
618            @SuppressWarnings("unused")
619            public void prepareLocalizedFieldsForImport(Locale defaultImportLocale)
620                    throws LocaleException {
621                    setTitle(getTitle(defaultImportLocale), defaultImportLocale,
622                            defaultImportLocale);
623                    setDescription(getDescription(defaultImportLocale),
624                            defaultImportLocale, defaultImportLocale);
625            }
626    
627            @Override
628            public Role toEscapedModel() {
629                    if (_escapedModel == null) {
630                            _escapedModel = (Role)ProxyUtil.newProxyInstance(_classLoader,
631                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
632                    }
633    
634                    return _escapedModel;
635            }
636    
637            @Override
638            public Object clone() {
639                    RoleImpl roleImpl = new RoleImpl();
640    
641                    roleImpl.setRoleId(getRoleId());
642                    roleImpl.setCompanyId(getCompanyId());
643                    roleImpl.setClassNameId(getClassNameId());
644                    roleImpl.setClassPK(getClassPK());
645                    roleImpl.setName(getName());
646                    roleImpl.setTitle(getTitle());
647                    roleImpl.setDescription(getDescription());
648                    roleImpl.setType(getType());
649                    roleImpl.setSubtype(getSubtype());
650    
651                    roleImpl.resetOriginalValues();
652    
653                    return roleImpl;
654            }
655    
656            public int compareTo(Role role) {
657                    int value = 0;
658    
659                    value = getName().compareTo(role.getName());
660    
661                    if (value != 0) {
662                            return value;
663                    }
664    
665                    return 0;
666            }
667    
668            @Override
669            public boolean equals(Object obj) {
670                    if (obj == null) {
671                            return false;
672                    }
673    
674                    Role role = null;
675    
676                    try {
677                            role = (Role)obj;
678                    }
679                    catch (ClassCastException cce) {
680                            return false;
681                    }
682    
683                    long primaryKey = role.getPrimaryKey();
684    
685                    if (getPrimaryKey() == primaryKey) {
686                            return true;
687                    }
688                    else {
689                            return false;
690                    }
691            }
692    
693            @Override
694            public int hashCode() {
695                    return (int)getPrimaryKey();
696            }
697    
698            @Override
699            public void resetOriginalValues() {
700                    RoleModelImpl roleModelImpl = this;
701    
702                    roleModelImpl._originalCompanyId = roleModelImpl._companyId;
703    
704                    roleModelImpl._setOriginalCompanyId = false;
705    
706                    roleModelImpl._originalClassNameId = roleModelImpl._classNameId;
707    
708                    roleModelImpl._setOriginalClassNameId = false;
709    
710                    roleModelImpl._originalClassPK = roleModelImpl._classPK;
711    
712                    roleModelImpl._setOriginalClassPK = false;
713    
714                    roleModelImpl._originalName = roleModelImpl._name;
715    
716                    roleModelImpl._originalType = roleModelImpl._type;
717    
718                    roleModelImpl._setOriginalType = false;
719    
720                    roleModelImpl._originalSubtype = roleModelImpl._subtype;
721    
722                    roleModelImpl._columnBitmask = 0;
723            }
724    
725            @Override
726            public CacheModel<Role> toCacheModel() {
727                    RoleCacheModel roleCacheModel = new RoleCacheModel();
728    
729                    roleCacheModel.roleId = getRoleId();
730    
731                    roleCacheModel.companyId = getCompanyId();
732    
733                    roleCacheModel.classNameId = getClassNameId();
734    
735                    roleCacheModel.classPK = getClassPK();
736    
737                    roleCacheModel.name = getName();
738    
739                    String name = roleCacheModel.name;
740    
741                    if ((name != null) && (name.length() == 0)) {
742                            roleCacheModel.name = null;
743                    }
744    
745                    roleCacheModel.title = getTitle();
746    
747                    String title = roleCacheModel.title;
748    
749                    if ((title != null) && (title.length() == 0)) {
750                            roleCacheModel.title = null;
751                    }
752    
753                    roleCacheModel.description = getDescription();
754    
755                    String description = roleCacheModel.description;
756    
757                    if ((description != null) && (description.length() == 0)) {
758                            roleCacheModel.description = null;
759                    }
760    
761                    roleCacheModel.type = getType();
762    
763                    roleCacheModel.subtype = getSubtype();
764    
765                    String subtype = roleCacheModel.subtype;
766    
767                    if ((subtype != null) && (subtype.length() == 0)) {
768                            roleCacheModel.subtype = null;
769                    }
770    
771                    return roleCacheModel;
772            }
773    
774            @Override
775            public String toString() {
776                    StringBundler sb = new StringBundler(19);
777    
778                    sb.append("{roleId=");
779                    sb.append(getRoleId());
780                    sb.append(", companyId=");
781                    sb.append(getCompanyId());
782                    sb.append(", classNameId=");
783                    sb.append(getClassNameId());
784                    sb.append(", classPK=");
785                    sb.append(getClassPK());
786                    sb.append(", name=");
787                    sb.append(getName());
788                    sb.append(", title=");
789                    sb.append(getTitle());
790                    sb.append(", description=");
791                    sb.append(getDescription());
792                    sb.append(", type=");
793                    sb.append(getType());
794                    sb.append(", subtype=");
795                    sb.append(getSubtype());
796                    sb.append("}");
797    
798                    return sb.toString();
799            }
800    
801            public String toXmlString() {
802                    StringBundler sb = new StringBundler(31);
803    
804                    sb.append("<model><model-name>");
805                    sb.append("com.liferay.portal.model.Role");
806                    sb.append("</model-name>");
807    
808                    sb.append(
809                            "<column><column-name>roleId</column-name><column-value><![CDATA[");
810                    sb.append(getRoleId());
811                    sb.append("]]></column-value></column>");
812                    sb.append(
813                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
814                    sb.append(getCompanyId());
815                    sb.append("]]></column-value></column>");
816                    sb.append(
817                            "<column><column-name>classNameId</column-name><column-value><![CDATA[");
818                    sb.append(getClassNameId());
819                    sb.append("]]></column-value></column>");
820                    sb.append(
821                            "<column><column-name>classPK</column-name><column-value><![CDATA[");
822                    sb.append(getClassPK());
823                    sb.append("]]></column-value></column>");
824                    sb.append(
825                            "<column><column-name>name</column-name><column-value><![CDATA[");
826                    sb.append(getName());
827                    sb.append("]]></column-value></column>");
828                    sb.append(
829                            "<column><column-name>title</column-name><column-value><![CDATA[");
830                    sb.append(getTitle());
831                    sb.append("]]></column-value></column>");
832                    sb.append(
833                            "<column><column-name>description</column-name><column-value><![CDATA[");
834                    sb.append(getDescription());
835                    sb.append("]]></column-value></column>");
836                    sb.append(
837                            "<column><column-name>type</column-name><column-value><![CDATA[");
838                    sb.append(getType());
839                    sb.append("]]></column-value></column>");
840                    sb.append(
841                            "<column><column-name>subtype</column-name><column-value><![CDATA[");
842                    sb.append(getSubtype());
843                    sb.append("]]></column-value></column>");
844    
845                    sb.append("</model>");
846    
847                    return sb.toString();
848            }
849    
850            private static ClassLoader _classLoader = Role.class.getClassLoader();
851            private static Class<?>[] _escapedModelInterfaces = new Class[] { Role.class };
852            private long _roleId;
853            private long _companyId;
854            private long _originalCompanyId;
855            private boolean _setOriginalCompanyId;
856            private long _classNameId;
857            private long _originalClassNameId;
858            private boolean _setOriginalClassNameId;
859            private long _classPK;
860            private long _originalClassPK;
861            private boolean _setOriginalClassPK;
862            private String _name;
863            private String _originalName;
864            private String _title;
865            private String _titleCurrentLanguageId;
866            private String _description;
867            private String _descriptionCurrentLanguageId;
868            private int _type;
869            private int _originalType;
870            private boolean _setOriginalType;
871            private String _subtype;
872            private String _originalSubtype;
873            private long _columnBitmask;
874            private Role _escapedModel;
875    }