001    /**
002     * Copyright (c) 2000-2012 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            public SocialActivityLimit toEntityModel() {
065                    SocialActivityLimitImpl socialActivityLimitImpl = new SocialActivityLimitImpl();
066    
067                    socialActivityLimitImpl.setActivityLimitId(activityLimitId);
068                    socialActivityLimitImpl.setGroupId(groupId);
069                    socialActivityLimitImpl.setCompanyId(companyId);
070                    socialActivityLimitImpl.setUserId(userId);
071                    socialActivityLimitImpl.setClassNameId(classNameId);
072                    socialActivityLimitImpl.setClassPK(classPK);
073                    socialActivityLimitImpl.setActivityType(activityType);
074    
075                    if (activityCounterName == null) {
076                            socialActivityLimitImpl.setActivityCounterName(StringPool.BLANK);
077                    }
078                    else {
079                            socialActivityLimitImpl.setActivityCounterName(activityCounterName);
080                    }
081    
082                    if (value == null) {
083                            socialActivityLimitImpl.setValue(StringPool.BLANK);
084                    }
085                    else {
086                            socialActivityLimitImpl.setValue(value);
087                    }
088    
089                    socialActivityLimitImpl.resetOriginalValues();
090    
091                    return socialActivityLimitImpl;
092            }
093    
094            public void readExternal(ObjectInput objectInput) throws IOException {
095                    activityLimitId = objectInput.readLong();
096                    groupId = objectInput.readLong();
097                    companyId = objectInput.readLong();
098                    userId = objectInput.readLong();
099                    classNameId = objectInput.readLong();
100                    classPK = objectInput.readLong();
101                    activityType = objectInput.readInt();
102                    activityCounterName = objectInput.readUTF();
103                    value = objectInput.readUTF();
104            }
105    
106            public void writeExternal(ObjectOutput objectOutput)
107                    throws IOException {
108                    objectOutput.writeLong(activityLimitId);
109                    objectOutput.writeLong(groupId);
110                    objectOutput.writeLong(companyId);
111                    objectOutput.writeLong(userId);
112                    objectOutput.writeLong(classNameId);
113                    objectOutput.writeLong(classPK);
114                    objectOutput.writeInt(activityType);
115    
116                    if (activityCounterName == null) {
117                            objectOutput.writeUTF(StringPool.BLANK);
118                    }
119                    else {
120                            objectOutput.writeUTF(activityCounterName);
121                    }
122    
123                    if (value == null) {
124                            objectOutput.writeUTF(StringPool.BLANK);
125                    }
126                    else {
127                            objectOutput.writeUTF(value);
128                    }
129            }
130    
131            public long activityLimitId;
132            public long groupId;
133            public long companyId;
134            public long userId;
135            public long classNameId;
136            public long classPK;
137            public int activityType;
138            public String activityCounterName;
139            public String value;
140    }