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