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.blogs.model.impl;
016    
017    import com.liferay.portal.kernel.util.StringBundler;
018    import com.liferay.portal.model.CacheModel;
019    
020    import com.liferay.portlet.blogs.model.BlogsStatsUser;
021    
022    import java.io.Serializable;
023    
024    import java.util.Date;
025    
026    /**
027     * The cache model class for representing BlogsStatsUser in entity cache.
028     *
029     * @author Brian Wing Shun Chan
030     * @see BlogsStatsUser
031     * @generated
032     */
033    public class BlogsStatsUserCacheModel implements CacheModel<BlogsStatsUser>,
034            Serializable {
035            @Override
036            public String toString() {
037                    StringBundler sb = new StringBundler(19);
038    
039                    sb.append("{statsUserId=");
040                    sb.append(statsUserId);
041                    sb.append(", groupId=");
042                    sb.append(groupId);
043                    sb.append(", companyId=");
044                    sb.append(companyId);
045                    sb.append(", userId=");
046                    sb.append(userId);
047                    sb.append(", entryCount=");
048                    sb.append(entryCount);
049                    sb.append(", lastPostDate=");
050                    sb.append(lastPostDate);
051                    sb.append(", ratingsTotalEntries=");
052                    sb.append(ratingsTotalEntries);
053                    sb.append(", ratingsTotalScore=");
054                    sb.append(ratingsTotalScore);
055                    sb.append(", ratingsAverageScore=");
056                    sb.append(ratingsAverageScore);
057                    sb.append("}");
058    
059                    return sb.toString();
060            }
061    
062            public BlogsStatsUser toEntityModel() {
063                    BlogsStatsUserImpl blogsStatsUserImpl = new BlogsStatsUserImpl();
064    
065                    blogsStatsUserImpl.setStatsUserId(statsUserId);
066                    blogsStatsUserImpl.setGroupId(groupId);
067                    blogsStatsUserImpl.setCompanyId(companyId);
068                    blogsStatsUserImpl.setUserId(userId);
069                    blogsStatsUserImpl.setEntryCount(entryCount);
070    
071                    if (lastPostDate == Long.MIN_VALUE) {
072                            blogsStatsUserImpl.setLastPostDate(null);
073                    }
074                    else {
075                            blogsStatsUserImpl.setLastPostDate(new Date(lastPostDate));
076                    }
077    
078                    blogsStatsUserImpl.setRatingsTotalEntries(ratingsTotalEntries);
079                    blogsStatsUserImpl.setRatingsTotalScore(ratingsTotalScore);
080                    blogsStatsUserImpl.setRatingsAverageScore(ratingsAverageScore);
081    
082                    blogsStatsUserImpl.resetOriginalValues();
083    
084                    return blogsStatsUserImpl;
085            }
086    
087            public long statsUserId;
088            public long groupId;
089            public long companyId;
090            public long userId;
091            public int entryCount;
092            public long lastPostDate;
093            public int ratingsTotalEntries;
094            public double ratingsTotalScore;
095            public double ratingsAverageScore;
096    }