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(11);
080    
081                    sb.append("{mvccVersion=");
082                    sb.append(mvccVersion);
083                    sb.append(", resourceBlockPermissionId=");
084                    sb.append(resourceBlockPermissionId);
085                    sb.append(", resourceBlockId=");
086                    sb.append(resourceBlockId);
087                    sb.append(", roleId=");
088                    sb.append(roleId);
089                    sb.append(", actionIds=");
090                    sb.append(actionIds);
091                    sb.append("}");
092    
093                    return sb.toString();
094            }
095    
096            @Override
097            public ResourceBlockPermission toEntityModel() {
098                    ResourceBlockPermissionImpl resourceBlockPermissionImpl = new ResourceBlockPermissionImpl();
099    
100                    resourceBlockPermissionImpl.setMvccVersion(mvccVersion);
101                    resourceBlockPermissionImpl.setResourceBlockPermissionId(resourceBlockPermissionId);
102                    resourceBlockPermissionImpl.setResourceBlockId(resourceBlockId);
103                    resourceBlockPermissionImpl.setRoleId(roleId);
104                    resourceBlockPermissionImpl.setActionIds(actionIds);
105    
106                    resourceBlockPermissionImpl.resetOriginalValues();
107    
108                    return resourceBlockPermissionImpl;
109            }
110    
111            @Override
112            public void readExternal(ObjectInput objectInput) throws IOException {
113                    mvccVersion = objectInput.readLong();
114                    resourceBlockPermissionId = objectInput.readLong();
115                    resourceBlockId = objectInput.readLong();
116                    roleId = objectInput.readLong();
117                    actionIds = objectInput.readLong();
118            }
119    
120            @Override
121            public void writeExternal(ObjectOutput objectOutput)
122                    throws IOException {
123                    objectOutput.writeLong(mvccVersion);
124                    objectOutput.writeLong(resourceBlockPermissionId);
125                    objectOutput.writeLong(resourceBlockId);
126                    objectOutput.writeLong(roleId);
127                    objectOutput.writeLong(actionIds);
128            }
129    
130            public long mvccVersion;
131            public long resourceBlockPermissionId;
132            public long resourceBlockId;
133            public long roleId;
134            public long actionIds;
135    }