001    /**
002     * Copyright (c) 2000-2012 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            public PluginSetting toEntityModel() {
058                    PluginSettingImpl pluginSettingImpl = new PluginSettingImpl();
059    
060                    pluginSettingImpl.setPluginSettingId(pluginSettingId);
061                    pluginSettingImpl.setCompanyId(companyId);
062    
063                    if (pluginId == null) {
064                            pluginSettingImpl.setPluginId(StringPool.BLANK);
065                    }
066                    else {
067                            pluginSettingImpl.setPluginId(pluginId);
068                    }
069    
070                    if (pluginType == null) {
071                            pluginSettingImpl.setPluginType(StringPool.BLANK);
072                    }
073                    else {
074                            pluginSettingImpl.setPluginType(pluginType);
075                    }
076    
077                    if (roles == null) {
078                            pluginSettingImpl.setRoles(StringPool.BLANK);
079                    }
080                    else {
081                            pluginSettingImpl.setRoles(roles);
082                    }
083    
084                    pluginSettingImpl.setActive(active);
085    
086                    pluginSettingImpl.resetOriginalValues();
087    
088                    return pluginSettingImpl;
089            }
090    
091            public void readExternal(ObjectInput objectInput) throws IOException {
092                    pluginSettingId = objectInput.readLong();
093                    companyId = objectInput.readLong();
094                    pluginId = objectInput.readUTF();
095                    pluginType = objectInput.readUTF();
096                    roles = objectInput.readUTF();
097                    active = objectInput.readBoolean();
098            }
099    
100            public void writeExternal(ObjectOutput objectOutput)
101                    throws IOException {
102                    objectOutput.writeLong(pluginSettingId);
103                    objectOutput.writeLong(companyId);
104    
105                    if (pluginId == null) {
106                            objectOutput.writeUTF(StringPool.BLANK);
107                    }
108                    else {
109                            objectOutput.writeUTF(pluginId);
110                    }
111    
112                    if (pluginType == null) {
113                            objectOutput.writeUTF(StringPool.BLANK);
114                    }
115                    else {
116                            objectOutput.writeUTF(pluginType);
117                    }
118    
119                    if (roles == null) {
120                            objectOutput.writeUTF(StringPool.BLANK);
121                    }
122                    else {
123                            objectOutput.writeUTF(roles);
124                    }
125    
126                    objectOutput.writeBoolean(active);
127            }
128    
129            public long pluginSettingId;
130            public long companyId;
131            public String pluginId;
132            public String pluginType;
133            public String roles;
134            public boolean active;
135    }