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