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.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            public SocialActivitySetting toEntityModel() {
061                    SocialActivitySettingImpl socialActivitySettingImpl = new SocialActivitySettingImpl();
062    
063                    socialActivitySettingImpl.setActivitySettingId(activitySettingId);
064                    socialActivitySettingImpl.setGroupId(groupId);
065                    socialActivitySettingImpl.setCompanyId(companyId);
066                    socialActivitySettingImpl.setClassNameId(classNameId);
067                    socialActivitySettingImpl.setActivityType(activityType);
068    
069                    if (name == null) {
070                            socialActivitySettingImpl.setName(StringPool.BLANK);
071                    }
072                    else {
073                            socialActivitySettingImpl.setName(name);
074                    }
075    
076                    if (value == null) {
077                            socialActivitySettingImpl.setValue(StringPool.BLANK);
078                    }
079                    else {
080                            socialActivitySettingImpl.setValue(value);
081                    }
082    
083                    socialActivitySettingImpl.resetOriginalValues();
084    
085                    return socialActivitySettingImpl;
086            }
087    
088            public void readExternal(ObjectInput objectInput) throws IOException {
089                    activitySettingId = objectInput.readLong();
090                    groupId = objectInput.readLong();
091                    companyId = objectInput.readLong();
092                    classNameId = objectInput.readLong();
093                    activityType = objectInput.readInt();
094                    name = objectInput.readUTF();
095                    value = objectInput.readUTF();
096            }
097    
098            public void writeExternal(ObjectOutput objectOutput)
099                    throws IOException {
100                    objectOutput.writeLong(activitySettingId);
101                    objectOutput.writeLong(groupId);
102                    objectOutput.writeLong(companyId);
103                    objectOutput.writeLong(classNameId);
104                    objectOutput.writeInt(activityType);
105    
106                    if (name == null) {
107                            objectOutput.writeUTF(StringPool.BLANK);
108                    }
109                    else {
110                            objectOutput.writeUTF(name);
111                    }
112    
113                    if (value == null) {
114                            objectOutput.writeUTF(StringPool.BLANK);
115                    }
116                    else {
117                            objectOutput.writeUTF(value);
118                    }
119            }
120    
121            public long activitySettingId;
122            public long groupId;
123            public long companyId;
124            public long classNameId;
125            public int activityType;
126            public String name;
127            public String value;
128    }