001
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
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 }