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            public ResourceTypePermission toEntityModel() {
058                    ResourceTypePermissionImpl resourceTypePermissionImpl = new ResourceTypePermissionImpl();
059    
060                    resourceTypePermissionImpl.setResourceTypePermissionId(resourceTypePermissionId);
061                    resourceTypePermissionImpl.setCompanyId(companyId);
062                    resourceTypePermissionImpl.setGroupId(groupId);
063    
064                    if (name == null) {
065                            resourceTypePermissionImpl.setName(StringPool.BLANK);
066                    }
067                    else {
068                            resourceTypePermissionImpl.setName(name);
069                    }
070    
071                    resourceTypePermissionImpl.setRoleId(roleId);
072                    resourceTypePermissionImpl.setActionIds(actionIds);
073    
074                    resourceTypePermissionImpl.resetOriginalValues();
075    
076                    return resourceTypePermissionImpl;
077            }
078    
079            public void readExternal(ObjectInput objectInput) throws IOException {
080                    resourceTypePermissionId = objectInput.readLong();
081                    companyId = objectInput.readLong();
082                    groupId = objectInput.readLong();
083                    name = objectInput.readUTF();
084                    roleId = objectInput.readLong();
085                    actionIds = objectInput.readLong();
086            }
087    
088            public void writeExternal(ObjectOutput objectOutput)
089                    throws IOException {
090                    objectOutput.writeLong(resourceTypePermissionId);
091                    objectOutput.writeLong(companyId);
092                    objectOutput.writeLong(groupId);
093    
094                    if (name == null) {
095                            objectOutput.writeUTF(StringPool.BLANK);
096                    }
097                    else {
098                            objectOutput.writeUTF(name);
099                    }
100    
101                    objectOutput.writeLong(roleId);
102                    objectOutput.writeLong(actionIds);
103            }
104    
105            public long resourceTypePermissionId;
106            public long companyId;
107            public long groupId;
108            public String name;
109            public long roleId;
110            public long actionIds;
111    }