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.SocialActivitySet;
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 SocialActivitySet in entity cache.
033     *
034     * @author Brian Wing Shun Chan
035     * @see SocialActivitySet
036     * @generated
037     */
038    @ProviderType
039    public class SocialActivitySetCacheModel implements CacheModel<SocialActivitySet>,
040            Externalizable {
041            @Override
042            public boolean equals(Object obj) {
043                    if (this == obj) {
044                            return true;
045                    }
046    
047                    if (!(obj instanceof SocialActivitySetCacheModel)) {
048                            return false;
049                    }
050    
051                    SocialActivitySetCacheModel socialActivitySetCacheModel = (SocialActivitySetCacheModel)obj;
052    
053                    if (activitySetId == socialActivitySetCacheModel.activitySetId) {
054                            return true;
055                    }
056    
057                    return false;
058            }
059    
060            @Override
061            public int hashCode() {
062                    return HashUtil.hash(0, activitySetId);
063            }
064    
065            @Override
066            public String toString() {
067                    StringBundler sb = new StringBundler(23);
068    
069                    sb.append("{activitySetId=");
070                    sb.append(activitySetId);
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(", modifiedDate=");
080                    sb.append(modifiedDate);
081                    sb.append(", classNameId=");
082                    sb.append(classNameId);
083                    sb.append(", classPK=");
084                    sb.append(classPK);
085                    sb.append(", type=");
086                    sb.append(type);
087                    sb.append(", extraData=");
088                    sb.append(extraData);
089                    sb.append(", activityCount=");
090                    sb.append(activityCount);
091                    sb.append("}");
092    
093                    return sb.toString();
094            }
095    
096            @Override
097            public SocialActivitySet toEntityModel() {
098                    SocialActivitySetImpl socialActivitySetImpl = new SocialActivitySetImpl();
099    
100                    socialActivitySetImpl.setActivitySetId(activitySetId);
101                    socialActivitySetImpl.setGroupId(groupId);
102                    socialActivitySetImpl.setCompanyId(companyId);
103                    socialActivitySetImpl.setUserId(userId);
104                    socialActivitySetImpl.setCreateDate(createDate);
105                    socialActivitySetImpl.setModifiedDate(modifiedDate);
106                    socialActivitySetImpl.setClassNameId(classNameId);
107                    socialActivitySetImpl.setClassPK(classPK);
108                    socialActivitySetImpl.setType(type);
109    
110                    if (extraData == null) {
111                            socialActivitySetImpl.setExtraData(StringPool.BLANK);
112                    }
113                    else {
114                            socialActivitySetImpl.setExtraData(extraData);
115                    }
116    
117                    socialActivitySetImpl.setActivityCount(activityCount);
118    
119                    socialActivitySetImpl.resetOriginalValues();
120    
121                    return socialActivitySetImpl;
122            }
123    
124            @Override
125            public void readExternal(ObjectInput objectInput) throws IOException {
126                    activitySetId = objectInput.readLong();
127                    groupId = objectInput.readLong();
128                    companyId = objectInput.readLong();
129                    userId = objectInput.readLong();
130                    createDate = objectInput.readLong();
131                    modifiedDate = objectInput.readLong();
132                    classNameId = objectInput.readLong();
133                    classPK = objectInput.readLong();
134                    type = objectInput.readInt();
135                    extraData = objectInput.readUTF();
136                    activityCount = objectInput.readInt();
137            }
138    
139            @Override
140            public void writeExternal(ObjectOutput objectOutput)
141                    throws IOException {
142                    objectOutput.writeLong(activitySetId);
143                    objectOutput.writeLong(groupId);
144                    objectOutput.writeLong(companyId);
145                    objectOutput.writeLong(userId);
146                    objectOutput.writeLong(createDate);
147                    objectOutput.writeLong(modifiedDate);
148                    objectOutput.writeLong(classNameId);
149                    objectOutput.writeLong(classPK);
150                    objectOutput.writeInt(type);
151    
152                    if (extraData == null) {
153                            objectOutput.writeUTF(StringPool.BLANK);
154                    }
155                    else {
156                            objectOutput.writeUTF(extraData);
157                    }
158    
159                    objectOutput.writeInt(activityCount);
160            }
161    
162            public long activitySetId;
163            public long groupId;
164            public long companyId;
165            public long userId;
166            public long createDate;
167            public long modifiedDate;
168            public long classNameId;
169            public long classPK;
170            public int type;
171            public String extraData;
172            public int activityCount;
173    }