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(25);
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(", activitySetId=");
052                    sb.append(activitySetId);
053                    sb.append(", mirrorActivityId=");
054                    sb.append(mirrorActivityId);
055                    sb.append(", classNameId=");
056                    sb.append(classNameId);
057                    sb.append(", classPK=");
058                    sb.append(classPK);
059                    sb.append(", type=");
060                    sb.append(type);
061                    sb.append(", extraData=");
062                    sb.append(extraData);
063                    sb.append(", receiverUserId=");
064                    sb.append(receiverUserId);
065                    sb.append("}");
066    
067                    return sb.toString();
068            }
069    
070            public SocialActivity toEntityModel() {
071                    SocialActivityImpl socialActivityImpl = new SocialActivityImpl();
072    
073                    socialActivityImpl.setActivityId(activityId);
074                    socialActivityImpl.setGroupId(groupId);
075                    socialActivityImpl.setCompanyId(companyId);
076                    socialActivityImpl.setUserId(userId);
077                    socialActivityImpl.setCreateDate(createDate);
078                    socialActivityImpl.setActivitySetId(activitySetId);
079                    socialActivityImpl.setMirrorActivityId(mirrorActivityId);
080                    socialActivityImpl.setClassNameId(classNameId);
081                    socialActivityImpl.setClassPK(classPK);
082                    socialActivityImpl.setType(type);
083    
084                    if (extraData == null) {
085                            socialActivityImpl.setExtraData(StringPool.BLANK);
086                    }
087                    else {
088                            socialActivityImpl.setExtraData(extraData);
089                    }
090    
091                    socialActivityImpl.setReceiverUserId(receiverUserId);
092    
093                    socialActivityImpl.resetOriginalValues();
094    
095                    return socialActivityImpl;
096            }
097    
098            public void readExternal(ObjectInput objectInput) throws IOException {
099                    activityId = objectInput.readLong();
100                    groupId = objectInput.readLong();
101                    companyId = objectInput.readLong();
102                    userId = objectInput.readLong();
103                    createDate = objectInput.readLong();
104                    activitySetId = objectInput.readLong();
105                    mirrorActivityId = objectInput.readLong();
106                    classNameId = objectInput.readLong();
107                    classPK = objectInput.readLong();
108                    type = objectInput.readInt();
109                    extraData = objectInput.readUTF();
110                    receiverUserId = objectInput.readLong();
111            }
112    
113            public void writeExternal(ObjectOutput objectOutput)
114                    throws IOException {
115                    objectOutput.writeLong(activityId);
116                    objectOutput.writeLong(groupId);
117                    objectOutput.writeLong(companyId);
118                    objectOutput.writeLong(userId);
119                    objectOutput.writeLong(createDate);
120                    objectOutput.writeLong(activitySetId);
121                    objectOutput.writeLong(mirrorActivityId);
122                    objectOutput.writeLong(classNameId);
123                    objectOutput.writeLong(classPK);
124                    objectOutput.writeInt(type);
125    
126                    if (extraData == null) {
127                            objectOutput.writeUTF(StringPool.BLANK);
128                    }
129                    else {
130                            objectOutput.writeUTF(extraData);
131                    }
132    
133                    objectOutput.writeLong(receiverUserId);
134            }
135    
136            public long activityId;
137            public long groupId;
138            public long companyId;
139            public long userId;
140            public long createDate;
141            public long activitySetId;
142            public long mirrorActivityId;
143            public long classNameId;
144            public long classPK;
145            public int type;
146            public String extraData;
147            public long receiverUserId;
148    }