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.SocialActivityAchievement;
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 SocialActivityAchievement in entity cache.
030     *
031     * @author Brian Wing Shun Chan
032     * @see SocialActivityAchievement
033     * @generated
034     */
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            public SocialActivityAchievement toEntityModel() {
061                    SocialActivityAchievementImpl socialActivityAchievementImpl = new SocialActivityAchievementImpl();
062    
063                    socialActivityAchievementImpl.setActivityAchievementId(activityAchievementId);
064                    socialActivityAchievementImpl.setGroupId(groupId);
065                    socialActivityAchievementImpl.setCompanyId(companyId);
066                    socialActivityAchievementImpl.setUserId(userId);
067                    socialActivityAchievementImpl.setCreateDate(createDate);
068    
069                    if (name == null) {
070                            socialActivityAchievementImpl.setName(StringPool.BLANK);
071                    }
072                    else {
073                            socialActivityAchievementImpl.setName(name);
074                    }
075    
076                    socialActivityAchievementImpl.setFirstInGroup(firstInGroup);
077    
078                    socialActivityAchievementImpl.resetOriginalValues();
079    
080                    return socialActivityAchievementImpl;
081            }
082    
083            public void readExternal(ObjectInput objectInput) throws IOException {
084                    activityAchievementId = objectInput.readLong();
085                    groupId = objectInput.readLong();
086                    companyId = objectInput.readLong();
087                    userId = objectInput.readLong();
088                    createDate = objectInput.readLong();
089                    name = objectInput.readUTF();
090                    firstInGroup = objectInput.readBoolean();
091            }
092    
093            public void writeExternal(ObjectOutput objectOutput)
094                    throws IOException {
095                    objectOutput.writeLong(activityAchievementId);
096                    objectOutput.writeLong(groupId);
097                    objectOutput.writeLong(companyId);
098                    objectOutput.writeLong(userId);
099                    objectOutput.writeLong(createDate);
100    
101                    if (name == null) {
102                            objectOutput.writeUTF(StringPool.BLANK);
103                    }
104                    else {
105                            objectOutput.writeUTF(name);
106                    }
107    
108                    objectOutput.writeBoolean(firstInGroup);
109            }
110    
111            public long activityAchievementId;
112            public long groupId;
113            public long companyId;
114            public long userId;
115            public long createDate;
116            public String name;
117            public boolean firstInGroup;
118    }