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            public SocialActivityCounter toEntityModel() {
073                    SocialActivityCounterImpl socialActivityCounterImpl = new SocialActivityCounterImpl();
074    
075                    socialActivityCounterImpl.setActivityCounterId(activityCounterId);
076                    socialActivityCounterImpl.setGroupId(groupId);
077                    socialActivityCounterImpl.setCompanyId(companyId);
078                    socialActivityCounterImpl.setClassNameId(classNameId);
079                    socialActivityCounterImpl.setClassPK(classPK);
080    
081                    if (name == null) {
082                            socialActivityCounterImpl.setName(StringPool.BLANK);
083                    }
084                    else {
085                            socialActivityCounterImpl.setName(name);
086                    }
087    
088                    socialActivityCounterImpl.setOwnerType(ownerType);
089                    socialActivityCounterImpl.setCurrentValue(currentValue);
090                    socialActivityCounterImpl.setTotalValue(totalValue);
091                    socialActivityCounterImpl.setGraceValue(graceValue);
092                    socialActivityCounterImpl.setStartPeriod(startPeriod);
093                    socialActivityCounterImpl.setEndPeriod(endPeriod);
094                    socialActivityCounterImpl.setActive(active);
095    
096                    socialActivityCounterImpl.resetOriginalValues();
097    
098                    return socialActivityCounterImpl;
099            }
100    
101            public void readExternal(ObjectInput objectInput) throws IOException {
102                    activityCounterId = objectInput.readLong();
103                    groupId = objectInput.readLong();
104                    companyId = objectInput.readLong();
105                    classNameId = objectInput.readLong();
106                    classPK = objectInput.readLong();
107                    name = objectInput.readUTF();
108                    ownerType = objectInput.readInt();
109                    currentValue = objectInput.readInt();
110                    totalValue = objectInput.readInt();
111                    graceValue = objectInput.readInt();
112                    startPeriod = objectInput.readInt();
113                    endPeriod = objectInput.readInt();
114                    active = objectInput.readBoolean();
115            }
116    
117            public void writeExternal(ObjectOutput objectOutput)
118                    throws IOException {
119                    objectOutput.writeLong(activityCounterId);
120                    objectOutput.writeLong(groupId);
121                    objectOutput.writeLong(companyId);
122                    objectOutput.writeLong(classNameId);
123                    objectOutput.writeLong(classPK);
124    
125                    if (name == null) {
126                            objectOutput.writeUTF(StringPool.BLANK);
127                    }
128                    else {
129                            objectOutput.writeUTF(name);
130                    }
131    
132                    objectOutput.writeInt(ownerType);
133                    objectOutput.writeInt(currentValue);
134                    objectOutput.writeInt(totalValue);
135                    objectOutput.writeInt(graceValue);
136                    objectOutput.writeInt(startPeriod);
137                    objectOutput.writeInt(endPeriod);
138                    objectOutput.writeBoolean(active);
139            }
140    
141            public long activityCounterId;
142            public long groupId;
143            public long companyId;
144            public long classNameId;
145            public long classPK;
146            public String name;
147            public int ownerType;
148            public int currentValue;
149            public int totalValue;
150            public int graceValue;
151            public int startPeriod;
152            public int endPeriod;
153            public boolean active;
154    }