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.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.CacheModel;
022    import com.liferay.portal.model.MVCCModel;
023    import com.liferay.portal.model.PluginSetting;
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 PluginSetting in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see PluginSetting
035     * @generated
036     */
037    @ProviderType
038    public class PluginSettingCacheModel implements CacheModel<PluginSetting>,
039            Externalizable, MVCCModel {
040            @Override
041            public long getMvccVersion() {
042                    return mvccVersion;
043            }
044    
045            @Override
046            public void setMvccVersion(long mvccVersion) {
047                    this.mvccVersion = mvccVersion;
048            }
049    
050            @Override
051            public String toString() {
052                    StringBundler sb = new StringBundler(15);
053    
054                    sb.append("{mvccVersion=");
055                    sb.append(mvccVersion);
056                    sb.append(", pluginSettingId=");
057                    sb.append(pluginSettingId);
058                    sb.append(", companyId=");
059                    sb.append(companyId);
060                    sb.append(", pluginId=");
061                    sb.append(pluginId);
062                    sb.append(", pluginType=");
063                    sb.append(pluginType);
064                    sb.append(", roles=");
065                    sb.append(roles);
066                    sb.append(", active=");
067                    sb.append(active);
068                    sb.append("}");
069    
070                    return sb.toString();
071            }
072    
073            @Override
074            public PluginSetting toEntityModel() {
075                    PluginSettingImpl pluginSettingImpl = new PluginSettingImpl();
076    
077                    pluginSettingImpl.setMvccVersion(mvccVersion);
078                    pluginSettingImpl.setPluginSettingId(pluginSettingId);
079                    pluginSettingImpl.setCompanyId(companyId);
080    
081                    if (pluginId == null) {
082                            pluginSettingImpl.setPluginId(StringPool.BLANK);
083                    }
084                    else {
085                            pluginSettingImpl.setPluginId(pluginId);
086                    }
087    
088                    if (pluginType == null) {
089                            pluginSettingImpl.setPluginType(StringPool.BLANK);
090                    }
091                    else {
092                            pluginSettingImpl.setPluginType(pluginType);
093                    }
094    
095                    if (roles == null) {
096                            pluginSettingImpl.setRoles(StringPool.BLANK);
097                    }
098                    else {
099                            pluginSettingImpl.setRoles(roles);
100                    }
101    
102                    pluginSettingImpl.setActive(active);
103    
104                    pluginSettingImpl.resetOriginalValues();
105    
106                    return pluginSettingImpl;
107            }
108    
109            @Override
110            public void readExternal(ObjectInput objectInput) throws IOException {
111                    mvccVersion = objectInput.readLong();
112                    pluginSettingId = objectInput.readLong();
113                    companyId = objectInput.readLong();
114                    pluginId = objectInput.readUTF();
115                    pluginType = objectInput.readUTF();
116                    roles = objectInput.readUTF();
117                    active = objectInput.readBoolean();
118            }
119    
120            @Override
121            public void writeExternal(ObjectOutput objectOutput)
122                    throws IOException {
123                    objectOutput.writeLong(mvccVersion);
124                    objectOutput.writeLong(pluginSettingId);
125                    objectOutput.writeLong(companyId);
126    
127                    if (pluginId == null) {
128                            objectOutput.writeUTF(StringPool.BLANK);
129                    }
130                    else {
131                            objectOutput.writeUTF(pluginId);
132                    }
133    
134                    if (pluginType == null) {
135                            objectOutput.writeUTF(StringPool.BLANK);
136                    }
137                    else {
138                            objectOutput.writeUTF(pluginType);
139                    }
140    
141                    if (roles == null) {
142                            objectOutput.writeUTF(StringPool.BLANK);
143                    }
144                    else {
145                            objectOutput.writeUTF(roles);
146                    }
147    
148                    objectOutput.writeBoolean(active);
149            }
150    
151            public long mvccVersion;
152            public long pluginSettingId;
153            public long companyId;
154            public String pluginId;
155            public String pluginType;
156            public String roles;
157            public boolean active;
158    }