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.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                    groupId = objectInput.readLong();
127                    companyId = objectInput.readLong();
128                    userId = objectInput.readLong();
129                    classNameId = objectInput.readLong();
130                    classPK = objectInput.readLong();
131                    activityType = objectInput.readInt();
132                    activityCounterName = objectInput.readUTF();
133                    value = objectInput.readUTF();
134            }
135    
136            @Override
137            public void writeExternal(ObjectOutput objectOutput)
138                    throws IOException {
139                    objectOutput.writeLong(activityLimitId);
140                    objectOutput.writeLong(groupId);
141                    objectOutput.writeLong(companyId);
142                    objectOutput.writeLong(userId);
143                    objectOutput.writeLong(classNameId);
144                    objectOutput.writeLong(classPK);
145                    objectOutput.writeInt(activityType);
146    
147                    if (activityCounterName == null) {
148                            objectOutput.writeUTF(StringPool.BLANK);
149                    }
150                    else {
151                            objectOutput.writeUTF(activityCounterName);
152                    }
153    
154                    if (value == null) {
155                            objectOutput.writeUTF(StringPool.BLANK);
156                    }
157                    else {
158                            objectOutput.writeUTF(value);
159                    }
160            }
161    
162            public long activityLimitId;
163            public long groupId;
164            public long companyId;
165            public long userId;
166            public long classNameId;
167            public long classPK;
168            public int activityType;
169            public String activityCounterName;
170            public String value;
171    }