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