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.SocialActivityCounter;
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 SocialActivityCounter in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see SocialActivityCounter
035     * @generated
036     */
037    @ProviderType
038    public class SocialActivityCounterCacheModel implements CacheModel<SocialActivityCounter>,
039            Externalizable {
040            @Override
041            public String toString() {
042                    StringBundler sb = new StringBundler(27);
043    
044                    sb.append("{activityCounterId=");
045                    sb.append(activityCounterId);
046                    sb.append(", groupId=");
047                    sb.append(groupId);
048                    sb.append(", companyId=");
049                    sb.append(companyId);
050                    sb.append(", classNameId=");
051                    sb.append(classNameId);
052                    sb.append(", classPK=");
053                    sb.append(classPK);
054                    sb.append(", name=");
055                    sb.append(name);
056                    sb.append(", ownerType=");
057                    sb.append(ownerType);
058                    sb.append(", currentValue=");
059                    sb.append(currentValue);
060                    sb.append(", totalValue=");
061                    sb.append(totalValue);
062                    sb.append(", graceValue=");
063                    sb.append(graceValue);
064                    sb.append(", startPeriod=");
065                    sb.append(startPeriod);
066                    sb.append(", endPeriod=");
067                    sb.append(endPeriod);
068                    sb.append(", active=");
069                    sb.append(active);
070                    sb.append("}");
071    
072                    return sb.toString();
073            }
074    
075            @Override
076            public SocialActivityCounter toEntityModel() {
077                    SocialActivityCounterImpl socialActivityCounterImpl = new SocialActivityCounterImpl();
078    
079                    socialActivityCounterImpl.setActivityCounterId(activityCounterId);
080                    socialActivityCounterImpl.setGroupId(groupId);
081                    socialActivityCounterImpl.setCompanyId(companyId);
082                    socialActivityCounterImpl.setClassNameId(classNameId);
083                    socialActivityCounterImpl.setClassPK(classPK);
084    
085                    if (name == null) {
086                            socialActivityCounterImpl.setName(StringPool.BLANK);
087                    }
088                    else {
089                            socialActivityCounterImpl.setName(name);
090                    }
091    
092                    socialActivityCounterImpl.setOwnerType(ownerType);
093                    socialActivityCounterImpl.setCurrentValue(currentValue);
094                    socialActivityCounterImpl.setTotalValue(totalValue);
095                    socialActivityCounterImpl.setGraceValue(graceValue);
096                    socialActivityCounterImpl.setStartPeriod(startPeriod);
097                    socialActivityCounterImpl.setEndPeriod(endPeriod);
098                    socialActivityCounterImpl.setActive(active);
099    
100                    socialActivityCounterImpl.resetOriginalValues();
101    
102                    return socialActivityCounterImpl;
103            }
104    
105            @Override
106            public void readExternal(ObjectInput objectInput) throws IOException {
107                    activityCounterId = objectInput.readLong();
108                    groupId = objectInput.readLong();
109                    companyId = objectInput.readLong();
110                    classNameId = objectInput.readLong();
111                    classPK = objectInput.readLong();
112                    name = objectInput.readUTF();
113                    ownerType = objectInput.readInt();
114                    currentValue = objectInput.readInt();
115                    totalValue = objectInput.readInt();
116                    graceValue = objectInput.readInt();
117                    startPeriod = objectInput.readInt();
118                    endPeriod = objectInput.readInt();
119                    active = objectInput.readBoolean();
120            }
121    
122            @Override
123            public void writeExternal(ObjectOutput objectOutput)
124                    throws IOException {
125                    objectOutput.writeLong(activityCounterId);
126                    objectOutput.writeLong(groupId);
127                    objectOutput.writeLong(companyId);
128                    objectOutput.writeLong(classNameId);
129                    objectOutput.writeLong(classPK);
130    
131                    if (name == null) {
132                            objectOutput.writeUTF(StringPool.BLANK);
133                    }
134                    else {
135                            objectOutput.writeUTF(name);
136                    }
137    
138                    objectOutput.writeInt(ownerType);
139                    objectOutput.writeInt(currentValue);
140                    objectOutput.writeInt(totalValue);
141                    objectOutput.writeInt(graceValue);
142                    objectOutput.writeInt(startPeriod);
143                    objectOutput.writeInt(endPeriod);
144                    objectOutput.writeBoolean(active);
145            }
146    
147            public long activityCounterId;
148            public long groupId;
149            public long companyId;
150            public long classNameId;
151            public long classPK;
152            public String name;
153            public int ownerType;
154            public int currentValue;
155            public int totalValue;
156            public int graceValue;
157            public int startPeriod;
158            public int endPeriod;
159            public boolean active;
160    }