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