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.PollsQuestion;
022
023 import java.io.Serializable;
024
025 import java.util.Date;
026
027
034 public class PollsQuestionCacheModel implements CacheModel<PollsQuestion>,
035 Serializable {
036 @Override
037 public String toString() {
038 StringBundler sb = new StringBundler(25);
039
040 sb.append("{uuid=");
041 sb.append(uuid);
042 sb.append(", questionId=");
043 sb.append(questionId);
044 sb.append(", groupId=");
045 sb.append(groupId);
046 sb.append(", companyId=");
047 sb.append(companyId);
048 sb.append(", userId=");
049 sb.append(userId);
050 sb.append(", userName=");
051 sb.append(userName);
052 sb.append(", createDate=");
053 sb.append(createDate);
054 sb.append(", modifiedDate=");
055 sb.append(modifiedDate);
056 sb.append(", title=");
057 sb.append(title);
058 sb.append(", description=");
059 sb.append(description);
060 sb.append(", expirationDate=");
061 sb.append(expirationDate);
062 sb.append(", lastVoteDate=");
063 sb.append(lastVoteDate);
064 sb.append("}");
065
066 return sb.toString();
067 }
068
069 public PollsQuestion toEntityModel() {
070 PollsQuestionImpl pollsQuestionImpl = new PollsQuestionImpl();
071
072 if (uuid == null) {
073 pollsQuestionImpl.setUuid(StringPool.BLANK);
074 }
075 else {
076 pollsQuestionImpl.setUuid(uuid);
077 }
078
079 pollsQuestionImpl.setQuestionId(questionId);
080 pollsQuestionImpl.setGroupId(groupId);
081 pollsQuestionImpl.setCompanyId(companyId);
082 pollsQuestionImpl.setUserId(userId);
083
084 if (userName == null) {
085 pollsQuestionImpl.setUserName(StringPool.BLANK);
086 }
087 else {
088 pollsQuestionImpl.setUserName(userName);
089 }
090
091 if (createDate == Long.MIN_VALUE) {
092 pollsQuestionImpl.setCreateDate(null);
093 }
094 else {
095 pollsQuestionImpl.setCreateDate(new Date(createDate));
096 }
097
098 if (modifiedDate == Long.MIN_VALUE) {
099 pollsQuestionImpl.setModifiedDate(null);
100 }
101 else {
102 pollsQuestionImpl.setModifiedDate(new Date(modifiedDate));
103 }
104
105 if (title == null) {
106 pollsQuestionImpl.setTitle(StringPool.BLANK);
107 }
108 else {
109 pollsQuestionImpl.setTitle(title);
110 }
111
112 if (description == null) {
113 pollsQuestionImpl.setDescription(StringPool.BLANK);
114 }
115 else {
116 pollsQuestionImpl.setDescription(description);
117 }
118
119 if (expirationDate == Long.MIN_VALUE) {
120 pollsQuestionImpl.setExpirationDate(null);
121 }
122 else {
123 pollsQuestionImpl.setExpirationDate(new Date(expirationDate));
124 }
125
126 if (lastVoteDate == Long.MIN_VALUE) {
127 pollsQuestionImpl.setLastVoteDate(null);
128 }
129 else {
130 pollsQuestionImpl.setLastVoteDate(new Date(lastVoteDate));
131 }
132
133 pollsQuestionImpl.resetOriginalValues();
134
135 return pollsQuestionImpl;
136 }
137
138 public String uuid;
139 public long questionId;
140 public long groupId;
141 public long companyId;
142 public long userId;
143 public String userName;
144 public long createDate;
145 public long modifiedDate;
146 public String title;
147 public String description;
148 public long expirationDate;
149 public long lastVoteDate;
150 }