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.kernel.util.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.CacheModel;
022    import com.liferay.portal.model.MVCCModel;
023    import com.liferay.portal.model.ResourceTypePermission;
024    
025    import java.io.Externalizable;
026    import java.io.IOException;
027    import java.io.ObjectInput;
028    import java.io.ObjectOutput;
029    
030    /**
031     * The cache model class for representing ResourceTypePermission in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see ResourceTypePermission
035     * @generated
036     */
037    @ProviderType
038    public class ResourceTypePermissionCacheModel implements CacheModel<ResourceTypePermission>,
039            Externalizable, MVCCModel {
040            @Override
041            public long getMvccVersion() {
042                    return mvccVersion;
043            }
044    
045            @Override
046            public void setMvccVersion(long mvccVersion) {
047                    this.mvccVersion = mvccVersion;
048            }
049    
050            @Override
051            public String toString() {
052                    StringBundler sb = new StringBundler(15);
053    
054                    sb.append("{mvccVersion=");
055                    sb.append(mvccVersion);
056                    sb.append(", resourceTypePermissionId=");
057                    sb.append(resourceTypePermissionId);
058                    sb.append(", companyId=");
059                    sb.append(companyId);
060                    sb.append(", groupId=");
061                    sb.append(groupId);
062                    sb.append(", name=");
063                    sb.append(name);
064                    sb.append(", roleId=");
065                    sb.append(roleId);
066                    sb.append(", actionIds=");
067                    sb.append(actionIds);
068                    sb.append("}");
069    
070                    return sb.toString();
071            }
072    
073            @Override
074            public ResourceTypePermission toEntityModel() {
075                    ResourceTypePermissionImpl resourceTypePermissionImpl = new ResourceTypePermissionImpl();
076    
077                    resourceTypePermissionImpl.setMvccVersion(mvccVersion);
078                    resourceTypePermissionImpl.setResourceTypePermissionId(resourceTypePermissionId);
079                    resourceTypePermissionImpl.setCompanyId(companyId);
080                    resourceTypePermissionImpl.setGroupId(groupId);
081    
082                    if (name == null) {
083                            resourceTypePermissionImpl.setName(StringPool.BLANK);
084                    }
085                    else {
086                            resourceTypePermissionImpl.setName(name);
087                    }
088    
089                    resourceTypePermissionImpl.setRoleId(roleId);
090                    resourceTypePermissionImpl.setActionIds(actionIds);
091    
092                    resourceTypePermissionImpl.resetOriginalValues();
093    
094                    return resourceTypePermissionImpl;
095            }
096    
097            @Override
098            public void readExternal(ObjectInput objectInput) throws IOException {
099                    mvccVersion = objectInput.readLong();
100                    resourceTypePermissionId = objectInput.readLong();
101                    companyId = objectInput.readLong();
102                    groupId = objectInput.readLong();
103                    name = objectInput.readUTF();
104                    roleId = objectInput.readLong();
105                    actionIds = objectInput.readLong();
106            }
107    
108            @Override
109            public void writeExternal(ObjectOutput objectOutput)
110                    throws IOException {
111                    objectOutput.writeLong(mvccVersion);
112                    objectOutput.writeLong(resourceTypePermissionId);
113                    objectOutput.writeLong(companyId);
114                    objectOutput.writeLong(groupId);
115    
116                    if (name == null) {
117                            objectOutput.writeUTF(StringPool.BLANK);
118                    }
119                    else {
120                            objectOutput.writeUTF(name);
121                    }
122    
123                    objectOutput.writeLong(roleId);
124                    objectOutput.writeLong(actionIds);
125            }
126    
127            public long mvccVersion;
128            public long resourceTypePermissionId;
129            public long companyId;
130            public long groupId;
131            public String name;
132            public long roleId;
133            public long actionIds;
134    }