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.model.CacheModel;
020    import com.liferay.portal.kernel.model.MVCCModel;
021    import com.liferay.portal.kernel.model.UserGroupGroupRole;
022    import com.liferay.portal.kernel.service.persistence.UserGroupGroupRolePK;
023    import com.liferay.portal.kernel.util.HashUtil;
024    import com.liferay.portal.kernel.util.StringBundler;
025    
026    import java.io.Externalizable;
027    import java.io.IOException;
028    import java.io.ObjectInput;
029    import java.io.ObjectOutput;
030    
031    /**
032     * The cache model class for representing UserGroupGroupRole in entity cache.
033     *
034     * @author Brian Wing Shun Chan
035     * @see UserGroupGroupRole
036     * @generated
037     */
038    @ProviderType
039    public class UserGroupGroupRoleCacheModel implements CacheModel<UserGroupGroupRole>,
040            Externalizable, MVCCModel {
041            @Override
042            public boolean equals(Object obj) {
043                    if (this == obj) {
044                            return true;
045                    }
046    
047                    if (!(obj instanceof UserGroupGroupRoleCacheModel)) {
048                            return false;
049                    }
050    
051                    UserGroupGroupRoleCacheModel userGroupGroupRoleCacheModel = (UserGroupGroupRoleCacheModel)obj;
052    
053                    if (userGroupGroupRolePK.equals(
054                                            userGroupGroupRoleCacheModel.userGroupGroupRolePK) &&
055                                    (mvccVersion == userGroupGroupRoleCacheModel.mvccVersion)) {
056                            return true;
057                    }
058    
059                    return false;
060            }
061    
062            @Override
063            public int hashCode() {
064                    int hashCode = HashUtil.hash(0, userGroupGroupRolePK);
065    
066                    return HashUtil.hash(hashCode, mvccVersion);
067            }
068    
069            @Override
070            public long getMvccVersion() {
071                    return mvccVersion;
072            }
073    
074            @Override
075            public void setMvccVersion(long mvccVersion) {
076                    this.mvccVersion = mvccVersion;
077            }
078    
079            @Override
080            public String toString() {
081                    StringBundler sb = new StringBundler(11);
082    
083                    sb.append("{mvccVersion=");
084                    sb.append(mvccVersion);
085                    sb.append(", userGroupId=");
086                    sb.append(userGroupId);
087                    sb.append(", groupId=");
088                    sb.append(groupId);
089                    sb.append(", roleId=");
090                    sb.append(roleId);
091                    sb.append(", companyId=");
092                    sb.append(companyId);
093                    sb.append("}");
094    
095                    return sb.toString();
096            }
097    
098            @Override
099            public UserGroupGroupRole toEntityModel() {
100                    UserGroupGroupRoleImpl userGroupGroupRoleImpl = new UserGroupGroupRoleImpl();
101    
102                    userGroupGroupRoleImpl.setMvccVersion(mvccVersion);
103                    userGroupGroupRoleImpl.setUserGroupId(userGroupId);
104                    userGroupGroupRoleImpl.setGroupId(groupId);
105                    userGroupGroupRoleImpl.setRoleId(roleId);
106                    userGroupGroupRoleImpl.setCompanyId(companyId);
107    
108                    userGroupGroupRoleImpl.resetOriginalValues();
109    
110                    return userGroupGroupRoleImpl;
111            }
112    
113            @Override
114            public void readExternal(ObjectInput objectInput) throws IOException {
115                    mvccVersion = objectInput.readLong();
116    
117                    userGroupId = objectInput.readLong();
118    
119                    groupId = objectInput.readLong();
120    
121                    roleId = objectInput.readLong();
122    
123                    companyId = objectInput.readLong();
124    
125                    userGroupGroupRolePK = new UserGroupGroupRolePK(userGroupId, groupId,
126                                    roleId);
127            }
128    
129            @Override
130            public void writeExternal(ObjectOutput objectOutput)
131                    throws IOException {
132                    objectOutput.writeLong(mvccVersion);
133    
134                    objectOutput.writeLong(userGroupId);
135    
136                    objectOutput.writeLong(groupId);
137    
138                    objectOutput.writeLong(roleId);
139    
140                    objectOutput.writeLong(companyId);
141            }
142    
143            public long mvccVersion;
144            public long userGroupId;
145            public long groupId;
146            public long roleId;
147            public long companyId;
148            public transient UserGroupGroupRolePK userGroupGroupRolePK;
149    }