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            @Override
051            public UserGroupRole toEntityModel() {
052                    UserGroupRoleImpl userGroupRoleImpl = new UserGroupRoleImpl();
053    
054                    userGroupRoleImpl.setUserId(userId);
055                    userGroupRoleImpl.setGroupId(groupId);
056                    userGroupRoleImpl.setRoleId(roleId);
057    
058                    userGroupRoleImpl.resetOriginalValues();
059    
060                    return userGroupRoleImpl;
061            }
062    
063            @Override
064            public void readExternal(ObjectInput objectInput) throws IOException {
065                    userId = objectInput.readLong();
066                    groupId = objectInput.readLong();
067                    roleId = objectInput.readLong();
068            }
069    
070            @Override
071            public void writeExternal(ObjectOutput objectOutput)
072                    throws IOException {
073                    objectOutput.writeLong(userId);
074                    objectOutput.writeLong(groupId);
075                    objectOutput.writeLong(roleId);
076            }
077    
078            public long userId;
079            public long groupId;
080            public long roleId;
081    }