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