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