001
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.SocialActivityAchievement;
022
023 import java.io.Externalizable;
024 import java.io.IOException;
025 import java.io.ObjectInput;
026 import java.io.ObjectOutput;
027
028
035 public class SocialActivityAchievementCacheModel implements CacheModel<SocialActivityAchievement>,
036 Externalizable {
037 @Override
038 public String toString() {
039 StringBundler sb = new StringBundler(15);
040
041 sb.append("{activityAchievementId=");
042 sb.append(activityAchievementId);
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(", name=");
052 sb.append(name);
053 sb.append(", firstInGroup=");
054 sb.append(firstInGroup);
055 sb.append("}");
056
057 return sb.toString();
058 }
059
060 @Override
061 public SocialActivityAchievement toEntityModel() {
062 SocialActivityAchievementImpl socialActivityAchievementImpl = new SocialActivityAchievementImpl();
063
064 socialActivityAchievementImpl.setActivityAchievementId(activityAchievementId);
065 socialActivityAchievementImpl.setGroupId(groupId);
066 socialActivityAchievementImpl.setCompanyId(companyId);
067 socialActivityAchievementImpl.setUserId(userId);
068 socialActivityAchievementImpl.setCreateDate(createDate);
069
070 if (name == null) {
071 socialActivityAchievementImpl.setName(StringPool.BLANK);
072 }
073 else {
074 socialActivityAchievementImpl.setName(name);
075 }
076
077 socialActivityAchievementImpl.setFirstInGroup(firstInGroup);
078
079 socialActivityAchievementImpl.resetOriginalValues();
080
081 return socialActivityAchievementImpl;
082 }
083
084 @Override
085 public void readExternal(ObjectInput objectInput) throws IOException {
086 activityAchievementId = objectInput.readLong();
087 groupId = objectInput.readLong();
088 companyId = objectInput.readLong();
089 userId = objectInput.readLong();
090 createDate = objectInput.readLong();
091 name = objectInput.readUTF();
092 firstInGroup = objectInput.readBoolean();
093 }
094
095 @Override
096 public void writeExternal(ObjectOutput objectOutput)
097 throws IOException {
098 objectOutput.writeLong(activityAchievementId);
099 objectOutput.writeLong(groupId);
100 objectOutput.writeLong(companyId);
101 objectOutput.writeLong(userId);
102 objectOutput.writeLong(createDate);
103
104 if (name == null) {
105 objectOutput.writeUTF(StringPool.BLANK);
106 }
107 else {
108 objectOutput.writeUTF(name);
109 }
110
111 objectOutput.writeBoolean(firstInGroup);
112 }
113
114 public long activityAchievementId;
115 public long groupId;
116 public long companyId;
117 public long userId;
118 public long createDate;
119 public String name;
120 public boolean firstInGroup;
121 }