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