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.messageboards.model.impl;
016    
017    import com.liferay.portal.kernel.util.StringBundler;
018    import com.liferay.portal.model.CacheModel;
019    
020    import com.liferay.portlet.messageboards.model.MBStatsUser;
021    
022    import java.io.Serializable;
023    
024    import java.util.Date;
025    
026    /**
027     * The cache model class for representing MBStatsUser in entity cache.
028     *
029     * @author Brian Wing Shun Chan
030     * @see MBStatsUser
031     * @generated
032     */
033    public class MBStatsUserCacheModel implements CacheModel<MBStatsUser>,
034            Serializable {
035            @Override
036            public String toString() {
037                    StringBundler sb = new StringBundler(11);
038    
039                    sb.append("{statsUserId=");
040                    sb.append(statsUserId);
041                    sb.append(", groupId=");
042                    sb.append(groupId);
043                    sb.append(", userId=");
044                    sb.append(userId);
045                    sb.append(", messageCount=");
046                    sb.append(messageCount);
047                    sb.append(", lastPostDate=");
048                    sb.append(lastPostDate);
049                    sb.append("}");
050    
051                    return sb.toString();
052            }
053    
054            public MBStatsUser toEntityModel() {
055                    MBStatsUserImpl mbStatsUserImpl = new MBStatsUserImpl();
056    
057                    mbStatsUserImpl.setStatsUserId(statsUserId);
058                    mbStatsUserImpl.setGroupId(groupId);
059                    mbStatsUserImpl.setUserId(userId);
060                    mbStatsUserImpl.setMessageCount(messageCount);
061    
062                    if (lastPostDate == Long.MIN_VALUE) {
063                            mbStatsUserImpl.setLastPostDate(null);
064                    }
065                    else {
066                            mbStatsUserImpl.setLastPostDate(new Date(lastPostDate));
067                    }
068    
069                    mbStatsUserImpl.resetOriginalValues();
070    
071                    return mbStatsUserImpl;
072            }
073    
074            public long statsUserId;
075            public long groupId;
076            public long userId;
077            public int messageCount;
078            public long lastPostDate;
079    }