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