001    /**
002     * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.CacheModel;
022    
023    import com.liferay.portlet.social.model.SocialActivityAchievement;
024    
025    import java.io.Externalizable;
026    import java.io.IOException;
027    import java.io.ObjectInput;
028    import java.io.ObjectOutput;
029    
030    /**
031     * The cache model class for representing SocialActivityAchievement in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see SocialActivityAchievement
035     * @generated
036     */
037    @ProviderType
038    public class SocialActivityAchievementCacheModel implements CacheModel<SocialActivityAchievement>,
039            Externalizable {
040            @Override
041            public String toString() {
042                    StringBundler sb = new StringBundler(15);
043    
044                    sb.append("{activityAchievementId=");
045                    sb.append(activityAchievementId);
046                    sb.append(", groupId=");
047                    sb.append(groupId);
048                    sb.append(", companyId=");
049                    sb.append(companyId);
050                    sb.append(", userId=");
051                    sb.append(userId);
052                    sb.append(", createDate=");
053                    sb.append(createDate);
054                    sb.append(", name=");
055                    sb.append(name);
056                    sb.append(", firstInGroup=");
057                    sb.append(firstInGroup);
058                    sb.append("}");
059    
060                    return sb.toString();
061            }
062    
063            @Override
064            public SocialActivityAchievement toEntityModel() {
065                    SocialActivityAchievementImpl socialActivityAchievementImpl = new SocialActivityAchievementImpl();
066    
067                    socialActivityAchievementImpl.setActivityAchievementId(activityAchievementId);
068                    socialActivityAchievementImpl.setGroupId(groupId);
069                    socialActivityAchievementImpl.setCompanyId(companyId);
070                    socialActivityAchievementImpl.setUserId(userId);
071                    socialActivityAchievementImpl.setCreateDate(createDate);
072    
073                    if (name == null) {
074                            socialActivityAchievementImpl.setName(StringPool.BLANK);
075                    }
076                    else {
077                            socialActivityAchievementImpl.setName(name);
078                    }
079    
080                    socialActivityAchievementImpl.setFirstInGroup(firstInGroup);
081    
082                    socialActivityAchievementImpl.resetOriginalValues();
083    
084                    return socialActivityAchievementImpl;
085            }
086    
087            @Override
088            public void readExternal(ObjectInput objectInput) throws IOException {
089                    activityAchievementId = objectInput.readLong();
090                    groupId = objectInput.readLong();
091                    companyId = objectInput.readLong();
092                    userId = objectInput.readLong();
093                    createDate = objectInput.readLong();
094                    name = objectInput.readUTF();
095                    firstInGroup = objectInput.readBoolean();
096            }
097    
098            @Override
099            public void writeExternal(ObjectOutput objectOutput)
100                    throws IOException {
101                    objectOutput.writeLong(activityAchievementId);
102                    objectOutput.writeLong(groupId);
103                    objectOutput.writeLong(companyId);
104                    objectOutput.writeLong(userId);
105                    objectOutput.writeLong(createDate);
106    
107                    if (name == null) {
108                            objectOutput.writeUTF(StringPool.BLANK);
109                    }
110                    else {
111                            objectOutput.writeUTF(name);
112                    }
113    
114                    objectOutput.writeBoolean(firstInGroup);
115            }
116    
117            public long activityAchievementId;
118            public long groupId;
119            public long companyId;
120            public long userId;
121            public long createDate;
122            public String name;
123            public boolean firstInGroup;
124    }