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