001    /**
002     * Copyright (c) 2000-2013 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.kernel.util.StringBundler;
018    import com.liferay.portal.kernel.util.StringPool;
019    import com.liferay.portal.model.CacheModel;
020    import com.liferay.portal.model.Role;
021    
022    import java.io.Serializable;
023    
024    /**
025     * The cache model class for representing Role in entity cache.
026     *
027     * @author Brian Wing Shun Chan
028     * @see Role
029     * @generated
030     */
031    public class RoleCacheModel implements CacheModel<Role>, Serializable {
032            @Override
033            public String toString() {
034                    StringBundler sb = new StringBundler(19);
035    
036                    sb.append("{roleId=");
037                    sb.append(roleId);
038                    sb.append(", companyId=");
039                    sb.append(companyId);
040                    sb.append(", classNameId=");
041                    sb.append(classNameId);
042                    sb.append(", classPK=");
043                    sb.append(classPK);
044                    sb.append(", name=");
045                    sb.append(name);
046                    sb.append(", title=");
047                    sb.append(title);
048                    sb.append(", description=");
049                    sb.append(description);
050                    sb.append(", type=");
051                    sb.append(type);
052                    sb.append(", subtype=");
053                    sb.append(subtype);
054                    sb.append("}");
055    
056                    return sb.toString();
057            }
058    
059            public Role toEntityModel() {
060                    RoleImpl roleImpl = new RoleImpl();
061    
062                    roleImpl.setRoleId(roleId);
063                    roleImpl.setCompanyId(companyId);
064                    roleImpl.setClassNameId(classNameId);
065                    roleImpl.setClassPK(classPK);
066    
067                    if (name == null) {
068                            roleImpl.setName(StringPool.BLANK);
069                    }
070                    else {
071                            roleImpl.setName(name);
072                    }
073    
074                    if (title == null) {
075                            roleImpl.setTitle(StringPool.BLANK);
076                    }
077                    else {
078                            roleImpl.setTitle(title);
079                    }
080    
081                    if (description == null) {
082                            roleImpl.setDescription(StringPool.BLANK);
083                    }
084                    else {
085                            roleImpl.setDescription(description);
086                    }
087    
088                    roleImpl.setType(type);
089    
090                    if (subtype == null) {
091                            roleImpl.setSubtype(StringPool.BLANK);
092                    }
093                    else {
094                            roleImpl.setSubtype(subtype);
095                    }
096    
097                    roleImpl.resetOriginalValues();
098    
099                    return roleImpl;
100            }
101    
102            public long roleId;
103            public long companyId;
104            public long classNameId;
105            public long classPK;
106            public String name;
107            public String title;
108            public String description;
109            public int type;
110            public String subtype;
111    }