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.kernel.util.StringPool;
019    import com.liferay.portal.model.CacheModel;
020    
021    import com.liferay.portlet.ratings.model.RatingsEntry;
022    
023    import java.io.Serializable;
024    
025    import java.util.Date;
026    
027    /**
028     * The cache model class for representing RatingsEntry in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see RatingsEntry
032     * @generated
033     */
034    public class RatingsEntryCacheModel implements CacheModel<RatingsEntry>,
035            Serializable {
036            @Override
037            public String toString() {
038                    StringBundler sb = new StringBundler(19);
039    
040                    sb.append("{entryId=");
041                    sb.append(entryId);
042                    sb.append(", companyId=");
043                    sb.append(companyId);
044                    sb.append(", userId=");
045                    sb.append(userId);
046                    sb.append(", userName=");
047                    sb.append(userName);
048                    sb.append(", createDate=");
049                    sb.append(createDate);
050                    sb.append(", modifiedDate=");
051                    sb.append(modifiedDate);
052                    sb.append(", classNameId=");
053                    sb.append(classNameId);
054                    sb.append(", classPK=");
055                    sb.append(classPK);
056                    sb.append(", score=");
057                    sb.append(score);
058                    sb.append("}");
059    
060                    return sb.toString();
061            }
062    
063            public RatingsEntry toEntityModel() {
064                    RatingsEntryImpl ratingsEntryImpl = new RatingsEntryImpl();
065    
066                    ratingsEntryImpl.setEntryId(entryId);
067                    ratingsEntryImpl.setCompanyId(companyId);
068                    ratingsEntryImpl.setUserId(userId);
069    
070                    if (userName == null) {
071                            ratingsEntryImpl.setUserName(StringPool.BLANK);
072                    }
073                    else {
074                            ratingsEntryImpl.setUserName(userName);
075                    }
076    
077                    if (createDate == Long.MIN_VALUE) {
078                            ratingsEntryImpl.setCreateDate(null);
079                    }
080                    else {
081                            ratingsEntryImpl.setCreateDate(new Date(createDate));
082                    }
083    
084                    if (modifiedDate == Long.MIN_VALUE) {
085                            ratingsEntryImpl.setModifiedDate(null);
086                    }
087                    else {
088                            ratingsEntryImpl.setModifiedDate(new Date(modifiedDate));
089                    }
090    
091                    ratingsEntryImpl.setClassNameId(classNameId);
092                    ratingsEntryImpl.setClassPK(classPK);
093                    ratingsEntryImpl.setScore(score);
094    
095                    ratingsEntryImpl.resetOriginalValues();
096    
097                    return ratingsEntryImpl;
098            }
099    
100            public long entryId;
101            public long companyId;
102            public long userId;
103            public String userName;
104            public long createDate;
105            public long modifiedDate;
106            public long classNameId;
107            public long classPK;
108            public double score;
109    }