1
22
23 package com.liferay.portlet.polls.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.DateUtil;
27 import com.liferay.portal.kernel.util.GetterUtil;
28 import com.liferay.portal.kernel.util.HtmlUtil;
29 import com.liferay.portal.model.impl.BaseModelImpl;
30 import com.liferay.portal.util.PropsUtil;
31
32 import com.liferay.portlet.polls.model.PollsQuestion;
33 import com.liferay.portlet.polls.model.PollsQuestionSoap;
34
35 import java.io.Serializable;
36
37 import java.lang.reflect.Proxy;
38
39 import java.sql.Types;
40
41 import java.util.ArrayList;
42 import java.util.Date;
43 import java.util.List;
44
45
65 public class PollsQuestionModelImpl extends BaseModelImpl {
66 public static final String TABLE_NAME = "PollsQuestion";
67 public static final Object[][] TABLE_COLUMNS = {
68 { "uuid_", new Integer(Types.VARCHAR) },
69
70
71 { "questionId", new Integer(Types.BIGINT) },
72
73
74 { "groupId", new Integer(Types.BIGINT) },
75
76
77 { "companyId", new Integer(Types.BIGINT) },
78
79
80 { "userId", new Integer(Types.BIGINT) },
81
82
83 { "userName", new Integer(Types.VARCHAR) },
84
85
86 { "createDate", new Integer(Types.TIMESTAMP) },
87
88
89 { "modifiedDate", new Integer(Types.TIMESTAMP) },
90
91
92 { "title", new Integer(Types.VARCHAR) },
93
94
95 { "description", new Integer(Types.VARCHAR) },
96
97
98 { "expirationDate", new Integer(Types.TIMESTAMP) },
99
100
101 { "lastVoteDate", new Integer(Types.TIMESTAMP) }
102 };
103 public static final String TABLE_SQL_CREATE = "create table PollsQuestion (uuid_ VARCHAR(75) null,questionId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,title VARCHAR(500) null,description STRING null,expirationDate DATE null,lastVoteDate DATE null)";
104 public static final String TABLE_SQL_DROP = "drop table PollsQuestion";
105 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
106 "value.object.finder.cache.enabled.com.liferay.portlet.polls.model.PollsQuestion"),
107 true);
108
109 public static PollsQuestion toModel(PollsQuestionSoap soapModel) {
110 PollsQuestion model = new PollsQuestionImpl();
111
112 model.setUuid(soapModel.getUuid());
113 model.setQuestionId(soapModel.getQuestionId());
114 model.setGroupId(soapModel.getGroupId());
115 model.setCompanyId(soapModel.getCompanyId());
116 model.setUserId(soapModel.getUserId());
117 model.setUserName(soapModel.getUserName());
118 model.setCreateDate(soapModel.getCreateDate());
119 model.setModifiedDate(soapModel.getModifiedDate());
120 model.setTitle(soapModel.getTitle());
121 model.setDescription(soapModel.getDescription());
122 model.setExpirationDate(soapModel.getExpirationDate());
123 model.setLastVoteDate(soapModel.getLastVoteDate());
124
125 return model;
126 }
127
128 public static List<PollsQuestion> toModels(PollsQuestionSoap[] soapModels) {
129 List<PollsQuestion> models = new ArrayList<PollsQuestion>(soapModels.length);
130
131 for (PollsQuestionSoap soapModel : soapModels) {
132 models.add(toModel(soapModel));
133 }
134
135 return models;
136 }
137
138 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
139 "lock.expiration.time.com.liferay.portlet.polls.model.PollsQuestion"));
140
141 public PollsQuestionModelImpl() {
142 }
143
144 public long getPrimaryKey() {
145 return _questionId;
146 }
147
148 public void setPrimaryKey(long pk) {
149 setQuestionId(pk);
150 }
151
152 public Serializable getPrimaryKeyObj() {
153 return new Long(_questionId);
154 }
155
156 public String getUuid() {
157 return GetterUtil.getString(_uuid);
158 }
159
160 public void setUuid(String uuid) {
161 if ((uuid != null) && (uuid != _uuid)) {
162 _uuid = uuid;
163 }
164 }
165
166 public long getQuestionId() {
167 return _questionId;
168 }
169
170 public void setQuestionId(long questionId) {
171 if (questionId != _questionId) {
172 _questionId = questionId;
173 }
174 }
175
176 public long getGroupId() {
177 return _groupId;
178 }
179
180 public void setGroupId(long groupId) {
181 if (groupId != _groupId) {
182 _groupId = groupId;
183 }
184 }
185
186 public long getCompanyId() {
187 return _companyId;
188 }
189
190 public void setCompanyId(long companyId) {
191 if (companyId != _companyId) {
192 _companyId = companyId;
193 }
194 }
195
196 public long getUserId() {
197 return _userId;
198 }
199
200 public void setUserId(long userId) {
201 if (userId != _userId) {
202 _userId = userId;
203 }
204 }
205
206 public String getUserName() {
207 return GetterUtil.getString(_userName);
208 }
209
210 public void setUserName(String userName) {
211 if (((userName == null) && (_userName != null)) ||
212 ((userName != null) && (_userName == null)) ||
213 ((userName != null) && (_userName != null) &&
214 !userName.equals(_userName))) {
215 _userName = userName;
216 }
217 }
218
219 public Date getCreateDate() {
220 return _createDate;
221 }
222
223 public void setCreateDate(Date createDate) {
224 if (((createDate == null) && (_createDate != null)) ||
225 ((createDate != null) && (_createDate == null)) ||
226 ((createDate != null) && (_createDate != null) &&
227 !createDate.equals(_createDate))) {
228 _createDate = createDate;
229 }
230 }
231
232 public Date getModifiedDate() {
233 return _modifiedDate;
234 }
235
236 public void setModifiedDate(Date modifiedDate) {
237 if (((modifiedDate == null) && (_modifiedDate != null)) ||
238 ((modifiedDate != null) && (_modifiedDate == null)) ||
239 ((modifiedDate != null) && (_modifiedDate != null) &&
240 !modifiedDate.equals(_modifiedDate))) {
241 _modifiedDate = modifiedDate;
242 }
243 }
244
245 public String getTitle() {
246 return GetterUtil.getString(_title);
247 }
248
249 public void setTitle(String title) {
250 if (((title == null) && (_title != null)) ||
251 ((title != null) && (_title == null)) ||
252 ((title != null) && (_title != null) && !title.equals(_title))) {
253 _title = title;
254 }
255 }
256
257 public String getDescription() {
258 return GetterUtil.getString(_description);
259 }
260
261 public void setDescription(String description) {
262 if (((description == null) && (_description != null)) ||
263 ((description != null) && (_description == null)) ||
264 ((description != null) && (_description != null) &&
265 !description.equals(_description))) {
266 _description = description;
267 }
268 }
269
270 public Date getExpirationDate() {
271 return _expirationDate;
272 }
273
274 public void setExpirationDate(Date expirationDate) {
275 if (((expirationDate == null) && (_expirationDate != null)) ||
276 ((expirationDate != null) && (_expirationDate == null)) ||
277 ((expirationDate != null) && (_expirationDate != null) &&
278 !expirationDate.equals(_expirationDate))) {
279 _expirationDate = expirationDate;
280 }
281 }
282
283 public Date getLastVoteDate() {
284 return _lastVoteDate;
285 }
286
287 public void setLastVoteDate(Date lastVoteDate) {
288 if (((lastVoteDate == null) && (_lastVoteDate != null)) ||
289 ((lastVoteDate != null) && (_lastVoteDate == null)) ||
290 ((lastVoteDate != null) && (_lastVoteDate != null) &&
291 !lastVoteDate.equals(_lastVoteDate))) {
292 _lastVoteDate = lastVoteDate;
293 }
294 }
295
296 public PollsQuestion toEscapedModel() {
297 if (isEscapedModel()) {
298 return (PollsQuestion)this;
299 }
300 else {
301 PollsQuestion model = new PollsQuestionImpl();
302
303 model.setEscapedModel(true);
304
305 model.setUuid(HtmlUtil.escape(getUuid()));
306 model.setQuestionId(getQuestionId());
307 model.setGroupId(getGroupId());
308 model.setCompanyId(getCompanyId());
309 model.setUserId(getUserId());
310 model.setUserName(HtmlUtil.escape(getUserName()));
311 model.setCreateDate(getCreateDate());
312 model.setModifiedDate(getModifiedDate());
313 model.setTitle(HtmlUtil.escape(getTitle()));
314 model.setDescription(HtmlUtil.escape(getDescription()));
315 model.setExpirationDate(getExpirationDate());
316 model.setLastVoteDate(getLastVoteDate());
317
318 model = (PollsQuestion)Proxy.newProxyInstance(PollsQuestion.class.getClassLoader(),
319 new Class[] { PollsQuestion.class },
320 new ReadOnlyBeanHandler(model));
321
322 return model;
323 }
324 }
325
326 public Object clone() {
327 PollsQuestionImpl clone = new PollsQuestionImpl();
328
329 clone.setUuid(getUuid());
330 clone.setQuestionId(getQuestionId());
331 clone.setGroupId(getGroupId());
332 clone.setCompanyId(getCompanyId());
333 clone.setUserId(getUserId());
334 clone.setUserName(getUserName());
335 clone.setCreateDate(getCreateDate());
336 clone.setModifiedDate(getModifiedDate());
337 clone.setTitle(getTitle());
338 clone.setDescription(getDescription());
339 clone.setExpirationDate(getExpirationDate());
340 clone.setLastVoteDate(getLastVoteDate());
341
342 return clone;
343 }
344
345 public int compareTo(Object obj) {
346 if (obj == null) {
347 return -1;
348 }
349
350 PollsQuestionImpl pollsQuestion = (PollsQuestionImpl)obj;
351
352 int value = 0;
353
354 value = DateUtil.compareTo(getCreateDate(),
355 pollsQuestion.getCreateDate());
356
357 value = value * -1;
358
359 if (value != 0) {
360 return value;
361 }
362
363 return 0;
364 }
365
366 public boolean equals(Object obj) {
367 if (obj == null) {
368 return false;
369 }
370
371 PollsQuestionImpl pollsQuestion = null;
372
373 try {
374 pollsQuestion = (PollsQuestionImpl)obj;
375 }
376 catch (ClassCastException cce) {
377 return false;
378 }
379
380 long pk = pollsQuestion.getPrimaryKey();
381
382 if (getPrimaryKey() == pk) {
383 return true;
384 }
385 else {
386 return false;
387 }
388 }
389
390 public int hashCode() {
391 return (int)getPrimaryKey();
392 }
393
394 private String _uuid;
395 private long _questionId;
396 private long _groupId;
397 private long _companyId;
398 private long _userId;
399 private String _userName;
400 private Date _createDate;
401 private Date _modifiedDate;
402 private String _title;
403 private String _description;
404 private Date _expirationDate;
405 private Date _lastVoteDate;
406 }