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.polls.model.PollsQuestion;
29 import com.liferay.portlet.polls.model.PollsQuestionSoap;
30
31 import java.io.Serializable;
32
33 import java.lang.reflect.Proxy;
34
35 import java.sql.Types;
36
37 import java.util.ArrayList;
38 import java.util.Date;
39 import java.util.List;
40
41
61 public class PollsQuestionModelImpl extends BaseModelImpl {
62 public static final String TABLE_NAME = "PollsQuestion";
63 public static final Object[][] TABLE_COLUMNS = {
64 { "uuid_", new Integer(Types.VARCHAR) },
65
66
67 { "questionId", new Integer(Types.BIGINT) },
68
69
70 { "groupId", new Integer(Types.BIGINT) },
71
72
73 { "companyId", new Integer(Types.BIGINT) },
74
75
76 { "userId", new Integer(Types.BIGINT) },
77
78
79 { "userName", new Integer(Types.VARCHAR) },
80
81
82 { "createDate", new Integer(Types.TIMESTAMP) },
83
84
85 { "modifiedDate", new Integer(Types.TIMESTAMP) },
86
87
88 { "title", new Integer(Types.VARCHAR) },
89
90
91 { "description", new Integer(Types.VARCHAR) },
92
93
94 { "expirationDate", new Integer(Types.TIMESTAMP) },
95
96
97 { "lastVoteDate", new Integer(Types.TIMESTAMP) }
98 };
99 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)";
100 public static final String TABLE_SQL_DROP = "drop table PollsQuestion";
101 public static final String DATA_SOURCE = "liferayDataSource";
102 public static final String SESSION_FACTORY = "liferaySessionFactory";
103 public static final String TX_MANAGER = "liferayTransactionManager";
104 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
105 "value.object.finder.cache.enabled.com.liferay.portlet.polls.model.PollsQuestion"),
106 true);
107
108 public static PollsQuestion toModel(PollsQuestionSoap soapModel) {
109 PollsQuestion model = new PollsQuestionImpl();
110
111 model.setUuid(soapModel.getUuid());
112 model.setQuestionId(soapModel.getQuestionId());
113 model.setGroupId(soapModel.getGroupId());
114 model.setCompanyId(soapModel.getCompanyId());
115 model.setUserId(soapModel.getUserId());
116 model.setUserName(soapModel.getUserName());
117 model.setCreateDate(soapModel.getCreateDate());
118 model.setModifiedDate(soapModel.getModifiedDate());
119 model.setTitle(soapModel.getTitle());
120 model.setDescription(soapModel.getDescription());
121 model.setExpirationDate(soapModel.getExpirationDate());
122 model.setLastVoteDate(soapModel.getLastVoteDate());
123
124 return model;
125 }
126
127 public static List<PollsQuestion> toModels(PollsQuestionSoap[] soapModels) {
128 List<PollsQuestion> models = new ArrayList<PollsQuestion>(soapModels.length);
129
130 for (PollsQuestionSoap soapModel : soapModels) {
131 models.add(toModel(soapModel));
132 }
133
134 return models;
135 }
136
137 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
138 "lock.expiration.time.com.liferay.portlet.polls.model.PollsQuestion"));
139
140 public PollsQuestionModelImpl() {
141 }
142
143 public long getPrimaryKey() {
144 return _questionId;
145 }
146
147 public void setPrimaryKey(long pk) {
148 setQuestionId(pk);
149 }
150
151 public Serializable getPrimaryKeyObj() {
152 return new Long(_questionId);
153 }
154
155 public String getUuid() {
156 return GetterUtil.getString(_uuid);
157 }
158
159 public void setUuid(String uuid) {
160 if ((uuid != null) && (uuid != _uuid)) {
161 _uuid = uuid;
162 }
163 }
164
165 public long getQuestionId() {
166 return _questionId;
167 }
168
169 public void setQuestionId(long questionId) {
170 if (questionId != _questionId) {
171 _questionId = questionId;
172 }
173 }
174
175 public long getGroupId() {
176 return _groupId;
177 }
178
179 public void setGroupId(long groupId) {
180 if (groupId != _groupId) {
181 _groupId = groupId;
182 }
183 }
184
185 public long getCompanyId() {
186 return _companyId;
187 }
188
189 public void setCompanyId(long companyId) {
190 if (companyId != _companyId) {
191 _companyId = companyId;
192 }
193 }
194
195 public long getUserId() {
196 return _userId;
197 }
198
199 public void setUserId(long userId) {
200 if (userId != _userId) {
201 _userId = userId;
202 }
203 }
204
205 public String getUserName() {
206 return GetterUtil.getString(_userName);
207 }
208
209 public void setUserName(String userName) {
210 if (((userName == null) && (_userName != null)) ||
211 ((userName != null) && (_userName == null)) ||
212 ((userName != null) && (_userName != null) &&
213 !userName.equals(_userName))) {
214 _userName = userName;
215 }
216 }
217
218 public Date getCreateDate() {
219 return _createDate;
220 }
221
222 public void setCreateDate(Date createDate) {
223 if (((createDate == null) && (_createDate != null)) ||
224 ((createDate != null) && (_createDate == null)) ||
225 ((createDate != null) && (_createDate != null) &&
226 !createDate.equals(_createDate))) {
227 _createDate = createDate;
228 }
229 }
230
231 public Date getModifiedDate() {
232 return _modifiedDate;
233 }
234
235 public void setModifiedDate(Date modifiedDate) {
236 if (((modifiedDate == null) && (_modifiedDate != null)) ||
237 ((modifiedDate != null) && (_modifiedDate == null)) ||
238 ((modifiedDate != null) && (_modifiedDate != null) &&
239 !modifiedDate.equals(_modifiedDate))) {
240 _modifiedDate = modifiedDate;
241 }
242 }
243
244 public String getTitle() {
245 return GetterUtil.getString(_title);
246 }
247
248 public void setTitle(String title) {
249 if (((title == null) && (_title != null)) ||
250 ((title != null) && (_title == null)) ||
251 ((title != null) && (_title != null) && !title.equals(_title))) {
252 _title = title;
253 }
254 }
255
256 public String getDescription() {
257 return GetterUtil.getString(_description);
258 }
259
260 public void setDescription(String description) {
261 if (((description == null) && (_description != null)) ||
262 ((description != null) && (_description == null)) ||
263 ((description != null) && (_description != null) &&
264 !description.equals(_description))) {
265 _description = description;
266 }
267 }
268
269 public Date getExpirationDate() {
270 return _expirationDate;
271 }
272
273 public void setExpirationDate(Date expirationDate) {
274 if (((expirationDate == null) && (_expirationDate != null)) ||
275 ((expirationDate != null) && (_expirationDate == null)) ||
276 ((expirationDate != null) && (_expirationDate != null) &&
277 !expirationDate.equals(_expirationDate))) {
278 _expirationDate = expirationDate;
279 }
280 }
281
282 public Date getLastVoteDate() {
283 return _lastVoteDate;
284 }
285
286 public void setLastVoteDate(Date lastVoteDate) {
287 if (((lastVoteDate == null) && (_lastVoteDate != null)) ||
288 ((lastVoteDate != null) && (_lastVoteDate == null)) ||
289 ((lastVoteDate != null) && (_lastVoteDate != null) &&
290 !lastVoteDate.equals(_lastVoteDate))) {
291 _lastVoteDate = lastVoteDate;
292 }
293 }
294
295 public PollsQuestion toEscapedModel() {
296 if (isEscapedModel()) {
297 return (PollsQuestion)this;
298 }
299 else {
300 PollsQuestion model = new PollsQuestionImpl();
301
302 model.setNew(isNew());
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 }