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.util.HashUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.model.CacheModel;
022    import com.liferay.portal.model.MVCCModel;
023    import com.liferay.portal.model.UserGroupGroupRole;
024    import com.liferay.portal.service.persistence.UserGroupGroupRolePK;
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                    userGroupId = objectInput.readLong();
117                    groupId = objectInput.readLong();
118                    roleId = objectInput.readLong();
119                    companyId = objectInput.readLong();
120    
121                    userGroupGroupRolePK = new UserGroupGroupRolePK(userGroupId, groupId,
122                                    roleId);
123            }
124    
125            @Override
126            public void writeExternal(ObjectOutput objectOutput)
127                    throws IOException {
128                    objectOutput.writeLong(mvccVersion);
129                    objectOutput.writeLong(userGroupId);
130                    objectOutput.writeLong(groupId);
131                    objectOutput.writeLong(roleId);
132                    objectOutput.writeLong(companyId);
133            }
134    
135            public long mvccVersion;
136            public long userGroupId;
137            public long groupId;
138            public long roleId;
139            public long companyId;
140            public transient UserGroupGroupRolePK userGroupGroupRolePK;
141    }