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.model.CacheModel;
019    import com.liferay.portal.model.UserGroupRole;
020    
021    import java.io.Externalizable;
022    import java.io.IOException;
023    import java.io.ObjectInput;
024    import java.io.ObjectOutput;
025    
026    /**
027     * The cache model class for representing UserGroupRole in entity cache.
028     *
029     * @author Brian Wing Shun Chan
030     * @see UserGroupRole
031     * @generated
032     */
033    public class UserGroupRoleCacheModel implements CacheModel<UserGroupRole>,
034            Externalizable {
035            @Override
036            public String toString() {
037                    StringBundler sb = new StringBundler(7);
038    
039                    sb.append("{userId=");
040                    sb.append(userId);
041                    sb.append(", groupId=");
042                    sb.append(groupId);
043                    sb.append(", roleId=");
044                    sb.append(roleId);
045                    sb.append("}");
046    
047                    return sb.toString();
048            }
049    
050            public UserGroupRole toEntityModel() {
051                    UserGroupRoleImpl userGroupRoleImpl = new UserGroupRoleImpl();
052    
053                    userGroupRoleImpl.setUserId(userId);
054                    userGroupRoleImpl.setGroupId(groupId);
055                    userGroupRoleImpl.setRoleId(roleId);
056    
057                    userGroupRoleImpl.resetOriginalValues();
058    
059                    return userGroupRoleImpl;
060            }
061    
062            public void readExternal(ObjectInput objectInput) throws IOException {
063                    userId = objectInput.readLong();
064                    groupId = objectInput.readLong();
065                    roleId = objectInput.readLong();
066            }
067    
068            public void writeExternal(ObjectOutput objectOutput)
069                    throws IOException {
070                    objectOutput.writeLong(userId);
071                    objectOutput.writeLong(groupId);
072                    objectOutput.writeLong(roleId);
073            }
074    
075            public long userId;
076            public long groupId;
077            public long roleId;
078    }