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.OrgGroupRole;
024    import com.liferay.portal.service.persistence.OrgGroupRolePK;
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 OrgGroupRole in entity cache.
033     *
034     * @author Brian Wing Shun Chan
035     * @see OrgGroupRole
036     * @generated
037     */
038    @ProviderType
039    public class OrgGroupRoleCacheModel implements CacheModel<OrgGroupRole>,
040            Externalizable, MVCCModel {
041            @Override
042            public boolean equals(Object obj) {
043                    if (this == obj) {
044                            return true;
045                    }
046    
047                    if (!(obj instanceof OrgGroupRoleCacheModel)) {
048                            return false;
049                    }
050    
051                    OrgGroupRoleCacheModel orgGroupRoleCacheModel = (OrgGroupRoleCacheModel)obj;
052    
053                    if (orgGroupRolePK.equals(orgGroupRoleCacheModel.orgGroupRolePK) &&
054                                    (mvccVersion == orgGroupRoleCacheModel.mvccVersion)) {
055                            return true;
056                    }
057    
058                    return false;
059            }
060    
061            @Override
062            public int hashCode() {
063                    int hashCode = HashUtil.hash(0, orgGroupRolePK);
064    
065                    return HashUtil.hash(hashCode, mvccVersion);
066            }
067    
068            @Override
069            public long getMvccVersion() {
070                    return mvccVersion;
071            }
072    
073            @Override
074            public void setMvccVersion(long mvccVersion) {
075                    this.mvccVersion = mvccVersion;
076            }
077    
078            @Override
079            public String toString() {
080                    StringBundler sb = new StringBundler(9);
081    
082                    sb.append("{mvccVersion=");
083                    sb.append(mvccVersion);
084                    sb.append(", organizationId=");
085                    sb.append(organizationId);
086                    sb.append(", groupId=");
087                    sb.append(groupId);
088                    sb.append(", roleId=");
089                    sb.append(roleId);
090                    sb.append("}");
091    
092                    return sb.toString();
093            }
094    
095            @Override
096            public OrgGroupRole toEntityModel() {
097                    OrgGroupRoleImpl orgGroupRoleImpl = new OrgGroupRoleImpl();
098    
099                    orgGroupRoleImpl.setMvccVersion(mvccVersion);
100                    orgGroupRoleImpl.setOrganizationId(organizationId);
101                    orgGroupRoleImpl.setGroupId(groupId);
102                    orgGroupRoleImpl.setRoleId(roleId);
103    
104                    orgGroupRoleImpl.resetOriginalValues();
105    
106                    return orgGroupRoleImpl;
107            }
108    
109            @Override
110            public void readExternal(ObjectInput objectInput) throws IOException {
111                    mvccVersion = objectInput.readLong();
112                    organizationId = objectInput.readLong();
113                    groupId = objectInput.readLong();
114                    roleId = objectInput.readLong();
115    
116                    orgGroupRolePK = new OrgGroupRolePK(organizationId, groupId, roleId);
117            }
118    
119            @Override
120            public void writeExternal(ObjectOutput objectOutput)
121                    throws IOException {
122                    objectOutput.writeLong(mvccVersion);
123                    objectOutput.writeLong(organizationId);
124                    objectOutput.writeLong(groupId);
125                    objectOutput.writeLong(roleId);
126            }
127    
128            public long mvccVersion;
129            public long organizationId;
130            public long groupId;
131            public long roleId;
132            public transient OrgGroupRolePK orgGroupRolePK;
133    }