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