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.model.CacheModel;
020    import com.liferay.portal.kernel.util.HashUtil;
021    import com.liferay.portal.kernel.util.StringBundler;
022    import com.liferay.portal.kernel.util.StringPool;
023    
024    import com.liferay.social.kernel.model.SocialActivityLimit;
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 SocialActivityLimit in entity cache.
033     *
034     * @author Brian Wing Shun Chan
035     * @see SocialActivityLimit
036     * @generated
037     */
038    @ProviderType
039    public class SocialActivityLimitCacheModel implements CacheModel<SocialActivityLimit>,
040            Externalizable {
041            @Override
042            public boolean equals(Object obj) {
043                    if (this == obj) {
044                            return true;
045                    }
046    
047                    if (!(obj instanceof SocialActivityLimitCacheModel)) {
048                            return false;
049                    }
050    
051                    SocialActivityLimitCacheModel socialActivityLimitCacheModel = (SocialActivityLimitCacheModel)obj;
052    
053                    if (activityLimitId == socialActivityLimitCacheModel.activityLimitId) {
054                            return true;
055                    }
056    
057                    return false;
058            }
059    
060            @Override
061            public int hashCode() {
062                    return HashUtil.hash(0, activityLimitId);
063            }
064    
065            @Override
066            public String toString() {
067                    StringBundler sb = new StringBundler(19);
068    
069                    sb.append("{activityLimitId=");
070                    sb.append(activityLimitId);
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(", classNameId=");
078                    sb.append(classNameId);
079                    sb.append(", classPK=");
080                    sb.append(classPK);
081                    sb.append(", activityType=");
082                    sb.append(activityType);
083                    sb.append(", activityCounterName=");
084                    sb.append(activityCounterName);
085                    sb.append(", value=");
086                    sb.append(value);
087                    sb.append("}");
088    
089                    return sb.toString();
090            }
091    
092            @Override
093            public SocialActivityLimit toEntityModel() {
094                    SocialActivityLimitImpl socialActivityLimitImpl = new SocialActivityLimitImpl();
095    
096                    socialActivityLimitImpl.setActivityLimitId(activityLimitId);
097                    socialActivityLimitImpl.setGroupId(groupId);
098                    socialActivityLimitImpl.setCompanyId(companyId);
099                    socialActivityLimitImpl.setUserId(userId);
100                    socialActivityLimitImpl.setClassNameId(classNameId);
101                    socialActivityLimitImpl.setClassPK(classPK);
102                    socialActivityLimitImpl.setActivityType(activityType);
103    
104                    if (activityCounterName == null) {
105                            socialActivityLimitImpl.setActivityCounterName(StringPool.BLANK);
106                    }
107                    else {
108                            socialActivityLimitImpl.setActivityCounterName(activityCounterName);
109                    }
110    
111                    if (value == null) {
112                            socialActivityLimitImpl.setValue(StringPool.BLANK);
113                    }
114                    else {
115                            socialActivityLimitImpl.setValue(value);
116                    }
117    
118                    socialActivityLimitImpl.resetOriginalValues();
119    
120                    return socialActivityLimitImpl;
121            }
122    
123            @Override
124            public void readExternal(ObjectInput objectInput) throws IOException {
125                    activityLimitId = objectInput.readLong();
126    
127                    groupId = objectInput.readLong();
128    
129                    companyId = objectInput.readLong();
130    
131                    userId = objectInput.readLong();
132    
133                    classNameId = objectInput.readLong();
134    
135                    classPK = objectInput.readLong();
136    
137                    activityType = objectInput.readInt();
138                    activityCounterName = objectInput.readUTF();
139                    value = objectInput.readUTF();
140            }
141    
142            @Override
143            public void writeExternal(ObjectOutput objectOutput)
144                    throws IOException {
145                    objectOutput.writeLong(activityLimitId);
146    
147                    objectOutput.writeLong(groupId);
148    
149                    objectOutput.writeLong(companyId);
150    
151                    objectOutput.writeLong(userId);
152    
153                    objectOutput.writeLong(classNameId);
154    
155                    objectOutput.writeLong(classPK);
156    
157                    objectOutput.writeInt(activityType);
158    
159                    if (activityCounterName == null) {
160                            objectOutput.writeUTF(StringPool.BLANK);
161                    }
162                    else {
163                            objectOutput.writeUTF(activityCounterName);
164                    }
165    
166                    if (value == null) {
167                            objectOutput.writeUTF(StringPool.BLANK);
168                    }
169                    else {
170                            objectOutput.writeUTF(value);
171                    }
172            }
173    
174            public long activityLimitId;
175            public long groupId;
176            public long companyId;
177            public long userId;
178            public long classNameId;
179            public long classPK;
180            public int activityType;
181            public String activityCounterName;
182            public String value;
183    }