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.ratings.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.model.CacheModel;
021    
022    import com.liferay.portlet.ratings.model.RatingsStats;
023    
024    import java.io.Externalizable;
025    import java.io.IOException;
026    import java.io.ObjectInput;
027    import java.io.ObjectOutput;
028    
029    /**
030     * The cache model class for representing RatingsStats in entity cache.
031     *
032     * @author Brian Wing Shun Chan
033     * @see RatingsStats
034     * @generated
035     */
036    @ProviderType
037    public class RatingsStatsCacheModel implements CacheModel<RatingsStats>,
038            Externalizable {
039            @Override
040            public String toString() {
041                    StringBundler sb = new StringBundler(13);
042    
043                    sb.append("{statsId=");
044                    sb.append(statsId);
045                    sb.append(", classNameId=");
046                    sb.append(classNameId);
047                    sb.append(", classPK=");
048                    sb.append(classPK);
049                    sb.append(", totalEntries=");
050                    sb.append(totalEntries);
051                    sb.append(", totalScore=");
052                    sb.append(totalScore);
053                    sb.append(", averageScore=");
054                    sb.append(averageScore);
055                    sb.append("}");
056    
057                    return sb.toString();
058            }
059    
060            @Override
061            public RatingsStats toEntityModel() {
062                    RatingsStatsImpl ratingsStatsImpl = new RatingsStatsImpl();
063    
064                    ratingsStatsImpl.setStatsId(statsId);
065                    ratingsStatsImpl.setClassNameId(classNameId);
066                    ratingsStatsImpl.setClassPK(classPK);
067                    ratingsStatsImpl.setTotalEntries(totalEntries);
068                    ratingsStatsImpl.setTotalScore(totalScore);
069                    ratingsStatsImpl.setAverageScore(averageScore);
070    
071                    ratingsStatsImpl.resetOriginalValues();
072    
073                    return ratingsStatsImpl;
074            }
075    
076            @Override
077            public void readExternal(ObjectInput objectInput) throws IOException {
078                    statsId = objectInput.readLong();
079                    classNameId = objectInput.readLong();
080                    classPK = objectInput.readLong();
081                    totalEntries = objectInput.readInt();
082                    totalScore = objectInput.readDouble();
083                    averageScore = objectInput.readDouble();
084            }
085    
086            @Override
087            public void writeExternal(ObjectOutput objectOutput)
088                    throws IOException {
089                    objectOutput.writeLong(statsId);
090                    objectOutput.writeLong(classNameId);
091                    objectOutput.writeLong(classPK);
092                    objectOutput.writeInt(totalEntries);
093                    objectOutput.writeDouble(totalScore);
094                    objectOutput.writeDouble(averageScore);
095            }
096    
097            public long statsId;
098            public long classNameId;
099            public long classPK;
100            public int totalEntries;
101            public double totalScore;
102            public double averageScore;
103    }