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.kernel.util.StringPool;
022    import com.liferay.portal.model.CacheModel;
023    import com.liferay.portal.model.MVCCModel;
024    import com.liferay.portal.model.PluginSetting;
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 PluginSetting in entity cache.
033     *
034     * @author Brian Wing Shun Chan
035     * @see PluginSetting
036     * @generated
037     */
038    @ProviderType
039    public class PluginSettingCacheModel implements CacheModel<PluginSetting>,
040            Externalizable, MVCCModel {
041            @Override
042            public boolean equals(Object obj) {
043                    if (this == obj) {
044                            return true;
045                    }
046    
047                    if (!(obj instanceof PluginSettingCacheModel)) {
048                            return false;
049                    }
050    
051                    PluginSettingCacheModel pluginSettingCacheModel = (PluginSettingCacheModel)obj;
052    
053                    if ((pluginSettingId == pluginSettingCacheModel.pluginSettingId) &&
054                                    (mvccVersion == pluginSettingCacheModel.mvccVersion)) {
055                            return true;
056                    }
057    
058                    return false;
059            }
060    
061            @Override
062            public int hashCode() {
063                    int hashCode = HashUtil.hash(0, pluginSettingId);
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(15);
081    
082                    sb.append("{mvccVersion=");
083                    sb.append(mvccVersion);
084                    sb.append(", pluginSettingId=");
085                    sb.append(pluginSettingId);
086                    sb.append(", companyId=");
087                    sb.append(companyId);
088                    sb.append(", pluginId=");
089                    sb.append(pluginId);
090                    sb.append(", pluginType=");
091                    sb.append(pluginType);
092                    sb.append(", roles=");
093                    sb.append(roles);
094                    sb.append(", active=");
095                    sb.append(active);
096                    sb.append("}");
097    
098                    return sb.toString();
099            }
100    
101            @Override
102            public PluginSetting toEntityModel() {
103                    PluginSettingImpl pluginSettingImpl = new PluginSettingImpl();
104    
105                    pluginSettingImpl.setMvccVersion(mvccVersion);
106                    pluginSettingImpl.setPluginSettingId(pluginSettingId);
107                    pluginSettingImpl.setCompanyId(companyId);
108    
109                    if (pluginId == null) {
110                            pluginSettingImpl.setPluginId(StringPool.BLANK);
111                    }
112                    else {
113                            pluginSettingImpl.setPluginId(pluginId);
114                    }
115    
116                    if (pluginType == null) {
117                            pluginSettingImpl.setPluginType(StringPool.BLANK);
118                    }
119                    else {
120                            pluginSettingImpl.setPluginType(pluginType);
121                    }
122    
123                    if (roles == null) {
124                            pluginSettingImpl.setRoles(StringPool.BLANK);
125                    }
126                    else {
127                            pluginSettingImpl.setRoles(roles);
128                    }
129    
130                    pluginSettingImpl.setActive(active);
131    
132                    pluginSettingImpl.resetOriginalValues();
133    
134                    return pluginSettingImpl;
135            }
136    
137            @Override
138            public void readExternal(ObjectInput objectInput) throws IOException {
139                    mvccVersion = objectInput.readLong();
140                    pluginSettingId = objectInput.readLong();
141                    companyId = objectInput.readLong();
142                    pluginId = objectInput.readUTF();
143                    pluginType = objectInput.readUTF();
144                    roles = objectInput.readUTF();
145                    active = objectInput.readBoolean();
146            }
147    
148            @Override
149            public void writeExternal(ObjectOutput objectOutput)
150                    throws IOException {
151                    objectOutput.writeLong(mvccVersion);
152                    objectOutput.writeLong(pluginSettingId);
153                    objectOutput.writeLong(companyId);
154    
155                    if (pluginId == null) {
156                            objectOutput.writeUTF(StringPool.BLANK);
157                    }
158                    else {
159                            objectOutput.writeUTF(pluginId);
160                    }
161    
162                    if (pluginType == null) {
163                            objectOutput.writeUTF(StringPool.BLANK);
164                    }
165                    else {
166                            objectOutput.writeUTF(pluginType);
167                    }
168    
169                    if (roles == null) {
170                            objectOutput.writeUTF(StringPool.BLANK);
171                    }
172                    else {
173                            objectOutput.writeUTF(roles);
174                    }
175    
176                    objectOutput.writeBoolean(active);
177            }
178    
179            public long mvccVersion;
180            public long pluginSettingId;
181            public long companyId;
182            public String pluginId;
183            public String pluginType;
184            public String roles;
185            public boolean active;
186    }