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