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.portlet.social.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    
023    import com.liferay.portlet.social.model.SocialActivitySetting;
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 SocialActivitySetting in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see SocialActivitySetting
035     * @generated
036     */
037    @ProviderType
038    public class SocialActivitySettingCacheModel implements CacheModel<SocialActivitySetting>,
039            Externalizable {
040            @Override
041            public String toString() {
042                    StringBundler sb = new StringBundler(15);
043    
044                    sb.append("{activitySettingId=");
045                    sb.append(activitySettingId);
046                    sb.append(", groupId=");
047                    sb.append(groupId);
048                    sb.append(", companyId=");
049                    sb.append(companyId);
050                    sb.append(", classNameId=");
051                    sb.append(classNameId);
052                    sb.append(", activityType=");
053                    sb.append(activityType);
054                    sb.append(", name=");
055                    sb.append(name);
056                    sb.append(", value=");
057                    sb.append(value);
058                    sb.append("}");
059    
060                    return sb.toString();
061            }
062    
063            @Override
064            public SocialActivitySetting toEntityModel() {
065                    SocialActivitySettingImpl socialActivitySettingImpl = new SocialActivitySettingImpl();
066    
067                    socialActivitySettingImpl.setActivitySettingId(activitySettingId);
068                    socialActivitySettingImpl.setGroupId(groupId);
069                    socialActivitySettingImpl.setCompanyId(companyId);
070                    socialActivitySettingImpl.setClassNameId(classNameId);
071                    socialActivitySettingImpl.setActivityType(activityType);
072    
073                    if (name == null) {
074                            socialActivitySettingImpl.setName(StringPool.BLANK);
075                    }
076                    else {
077                            socialActivitySettingImpl.setName(name);
078                    }
079    
080                    if (value == null) {
081                            socialActivitySettingImpl.setValue(StringPool.BLANK);
082                    }
083                    else {
084                            socialActivitySettingImpl.setValue(value);
085                    }
086    
087                    socialActivitySettingImpl.resetOriginalValues();
088    
089                    return socialActivitySettingImpl;
090            }
091    
092            @Override
093            public void readExternal(ObjectInput objectInput) throws IOException {
094                    activitySettingId = objectInput.readLong();
095                    groupId = objectInput.readLong();
096                    companyId = objectInput.readLong();
097                    classNameId = objectInput.readLong();
098                    activityType = objectInput.readInt();
099                    name = objectInput.readUTF();
100                    value = objectInput.readUTF();
101            }
102    
103            @Override
104            public void writeExternal(ObjectOutput objectOutput)
105                    throws IOException {
106                    objectOutput.writeLong(activitySettingId);
107                    objectOutput.writeLong(groupId);
108                    objectOutput.writeLong(companyId);
109                    objectOutput.writeLong(classNameId);
110                    objectOutput.writeInt(activityType);
111    
112                    if (name == null) {
113                            objectOutput.writeUTF(StringPool.BLANK);
114                    }
115                    else {
116                            objectOutput.writeUTF(name);
117                    }
118    
119                    if (value == null) {
120                            objectOutput.writeUTF(StringPool.BLANK);
121                    }
122                    else {
123                            objectOutput.writeUTF(value);
124                    }
125            }
126    
127            public long activitySettingId;
128            public long groupId;
129            public long companyId;
130            public long classNameId;
131            public int activityType;
132            public String name;
133            public String value;
134    }