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