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