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.SocialActivity;
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 SocialActivity in entity cache.
030     *
031     * @author Brian Wing Shun Chan
032     * @see SocialActivity
033     * @generated
034     */
035    public class SocialActivityCacheModel implements CacheModel<SocialActivity>,
036            Externalizable {
037            @Override
038            public String toString() {
039                    StringBundler sb = new StringBundler(23);
040    
041                    sb.append("{activityId=");
042                    sb.append(activityId);
043                    sb.append(", groupId=");
044                    sb.append(groupId);
045                    sb.append(", companyId=");
046                    sb.append(companyId);
047                    sb.append(", userId=");
048                    sb.append(userId);
049                    sb.append(", createDate=");
050                    sb.append(createDate);
051                    sb.append(", mirrorActivityId=");
052                    sb.append(mirrorActivityId);
053                    sb.append(", classNameId=");
054                    sb.append(classNameId);
055                    sb.append(", classPK=");
056                    sb.append(classPK);
057                    sb.append(", type=");
058                    sb.append(type);
059                    sb.append(", extraData=");
060                    sb.append(extraData);
061                    sb.append(", receiverUserId=");
062                    sb.append(receiverUserId);
063                    sb.append("}");
064    
065                    return sb.toString();
066            }
067    
068            public SocialActivity toEntityModel() {
069                    SocialActivityImpl socialActivityImpl = new SocialActivityImpl();
070    
071                    socialActivityImpl.setActivityId(activityId);
072                    socialActivityImpl.setGroupId(groupId);
073                    socialActivityImpl.setCompanyId(companyId);
074                    socialActivityImpl.setUserId(userId);
075                    socialActivityImpl.setCreateDate(createDate);
076                    socialActivityImpl.setMirrorActivityId(mirrorActivityId);
077                    socialActivityImpl.setClassNameId(classNameId);
078                    socialActivityImpl.setClassPK(classPK);
079                    socialActivityImpl.setType(type);
080    
081                    if (extraData == null) {
082                            socialActivityImpl.setExtraData(StringPool.BLANK);
083                    }
084                    else {
085                            socialActivityImpl.setExtraData(extraData);
086                    }
087    
088                    socialActivityImpl.setReceiverUserId(receiverUserId);
089    
090                    socialActivityImpl.resetOriginalValues();
091    
092                    return socialActivityImpl;
093            }
094    
095            public void readExternal(ObjectInput objectInput) throws IOException {
096                    activityId = objectInput.readLong();
097                    groupId = objectInput.readLong();
098                    companyId = objectInput.readLong();
099                    userId = objectInput.readLong();
100                    createDate = objectInput.readLong();
101                    mirrorActivityId = objectInput.readLong();
102                    classNameId = objectInput.readLong();
103                    classPK = objectInput.readLong();
104                    type = objectInput.readInt();
105                    extraData = objectInput.readUTF();
106                    receiverUserId = objectInput.readLong();
107            }
108    
109            public void writeExternal(ObjectOutput objectOutput)
110                    throws IOException {
111                    objectOutput.writeLong(activityId);
112                    objectOutput.writeLong(groupId);
113                    objectOutput.writeLong(companyId);
114                    objectOutput.writeLong(userId);
115                    objectOutput.writeLong(createDate);
116                    objectOutput.writeLong(mirrorActivityId);
117                    objectOutput.writeLong(classNameId);
118                    objectOutput.writeLong(classPK);
119                    objectOutput.writeInt(type);
120    
121                    if (extraData == null) {
122                            objectOutput.writeUTF(StringPool.BLANK);
123                    }
124                    else {
125                            objectOutput.writeUTF(extraData);
126                    }
127    
128                    objectOutput.writeLong(receiverUserId);
129            }
130    
131            public long activityId;
132            public long groupId;
133            public long companyId;
134            public long userId;
135            public long createDate;
136            public long mirrorActivityId;
137            public long classNameId;
138            public long classPK;
139            public int type;
140            public String extraData;
141            public long receiverUserId;
142    }