001
014
015 package com.liferay.portlet.polls.model.impl;
016
017 import com.liferay.portal.LocaleException;
018 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
019 import com.liferay.portal.kernel.exception.SystemException;
020 import com.liferay.portal.kernel.json.JSON;
021 import com.liferay.portal.kernel.lar.StagedModelType;
022 import com.liferay.portal.kernel.util.DateUtil;
023 import com.liferay.portal.kernel.util.GetterUtil;
024 import com.liferay.portal.kernel.util.LocaleUtil;
025 import com.liferay.portal.kernel.util.LocalizationUtil;
026 import com.liferay.portal.kernel.util.ProxyUtil;
027 import com.liferay.portal.kernel.util.StringBundler;
028 import com.liferay.portal.kernel.util.StringPool;
029 import com.liferay.portal.kernel.util.Validator;
030 import com.liferay.portal.model.CacheModel;
031 import com.liferay.portal.model.impl.BaseModelImpl;
032 import com.liferay.portal.service.ServiceContext;
033 import com.liferay.portal.util.PortalUtil;
034
035 import com.liferay.portlet.expando.model.ExpandoBridge;
036 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
037 import com.liferay.portlet.polls.model.PollsQuestion;
038 import com.liferay.portlet.polls.model.PollsQuestionModel;
039 import com.liferay.portlet.polls.model.PollsQuestionSoap;
040
041 import java.io.Serializable;
042
043 import java.sql.Types;
044
045 import java.util.ArrayList;
046 import java.util.Date;
047 import java.util.HashMap;
048 import java.util.List;
049 import java.util.Locale;
050 import java.util.Map;
051 import java.util.Set;
052 import java.util.TreeSet;
053
054
067 @JSON(strict = true)
068 public class PollsQuestionModelImpl extends BaseModelImpl<PollsQuestion>
069 implements PollsQuestionModel {
070
075 public static final String TABLE_NAME = "PollsQuestion";
076 public static final Object[][] TABLE_COLUMNS = {
077 { "uuid_", Types.VARCHAR },
078 { "questionId", Types.BIGINT },
079 { "groupId", Types.BIGINT },
080 { "companyId", Types.BIGINT },
081 { "userId", Types.BIGINT },
082 { "userName", Types.VARCHAR },
083 { "createDate", Types.TIMESTAMP },
084 { "modifiedDate", Types.TIMESTAMP },
085 { "title", Types.VARCHAR },
086 { "description", Types.VARCHAR },
087 { "expirationDate", Types.TIMESTAMP },
088 { "lastVoteDate", Types.TIMESTAMP }
089 };
090 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 STRING null,description STRING null,expirationDate DATE null,lastVoteDate DATE null)";
091 public static final String TABLE_SQL_DROP = "drop table PollsQuestion";
092 public static final String ORDER_BY_JPQL = " ORDER BY pollsQuestion.createDate DESC";
093 public static final String ORDER_BY_SQL = " ORDER BY PollsQuestion.createDate DESC";
094 public static final String DATA_SOURCE = "liferayDataSource";
095 public static final String SESSION_FACTORY = "liferaySessionFactory";
096 public static final String TX_MANAGER = "liferayTransactionManager";
097 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
098 "value.object.entity.cache.enabled.com.liferay.portlet.polls.model.PollsQuestion"),
099 true);
100 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
101 "value.object.finder.cache.enabled.com.liferay.portlet.polls.model.PollsQuestion"),
102 true);
103 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
104 "value.object.column.bitmask.enabled.com.liferay.portlet.polls.model.PollsQuestion"),
105 true);
106 public static long COMPANYID_COLUMN_BITMASK = 1L;
107 public static long GROUPID_COLUMN_BITMASK = 2L;
108 public static long UUID_COLUMN_BITMASK = 4L;
109 public static long CREATEDATE_COLUMN_BITMASK = 8L;
110
111
117 public static PollsQuestion toModel(PollsQuestionSoap soapModel) {
118 if (soapModel == null) {
119 return null;
120 }
121
122 PollsQuestion model = new PollsQuestionImpl();
123
124 model.setUuid(soapModel.getUuid());
125 model.setQuestionId(soapModel.getQuestionId());
126 model.setGroupId(soapModel.getGroupId());
127 model.setCompanyId(soapModel.getCompanyId());
128 model.setUserId(soapModel.getUserId());
129 model.setUserName(soapModel.getUserName());
130 model.setCreateDate(soapModel.getCreateDate());
131 model.setModifiedDate(soapModel.getModifiedDate());
132 model.setTitle(soapModel.getTitle());
133 model.setDescription(soapModel.getDescription());
134 model.setExpirationDate(soapModel.getExpirationDate());
135 model.setLastVoteDate(soapModel.getLastVoteDate());
136
137 return model;
138 }
139
140
146 public static List<PollsQuestion> toModels(PollsQuestionSoap[] soapModels) {
147 if (soapModels == null) {
148 return null;
149 }
150
151 List<PollsQuestion> models = new ArrayList<PollsQuestion>(soapModels.length);
152
153 for (PollsQuestionSoap soapModel : soapModels) {
154 models.add(toModel(soapModel));
155 }
156
157 return models;
158 }
159
160 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
161 "lock.expiration.time.com.liferay.portlet.polls.model.PollsQuestion"));
162
163 public PollsQuestionModelImpl() {
164 }
165
166 @Override
167 public long getPrimaryKey() {
168 return _questionId;
169 }
170
171 @Override
172 public void setPrimaryKey(long primaryKey) {
173 setQuestionId(primaryKey);
174 }
175
176 @Override
177 public Serializable getPrimaryKeyObj() {
178 return _questionId;
179 }
180
181 @Override
182 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
183 setPrimaryKey(((Long)primaryKeyObj).longValue());
184 }
185
186 @Override
187 public Class<?> getModelClass() {
188 return PollsQuestion.class;
189 }
190
191 @Override
192 public String getModelClassName() {
193 return PollsQuestion.class.getName();
194 }
195
196 @Override
197 public Map<String, Object> getModelAttributes() {
198 Map<String, Object> attributes = new HashMap<String, Object>();
199
200 attributes.put("uuid", getUuid());
201 attributes.put("questionId", getQuestionId());
202 attributes.put("groupId", getGroupId());
203 attributes.put("companyId", getCompanyId());
204 attributes.put("userId", getUserId());
205 attributes.put("userName", getUserName());
206 attributes.put("createDate", getCreateDate());
207 attributes.put("modifiedDate", getModifiedDate());
208 attributes.put("title", getTitle());
209 attributes.put("description", getDescription());
210 attributes.put("expirationDate", getExpirationDate());
211 attributes.put("lastVoteDate", getLastVoteDate());
212
213 return attributes;
214 }
215
216 @Override
217 public void setModelAttributes(Map<String, Object> attributes) {
218 String uuid = (String)attributes.get("uuid");
219
220 if (uuid != null) {
221 setUuid(uuid);
222 }
223
224 Long questionId = (Long)attributes.get("questionId");
225
226 if (questionId != null) {
227 setQuestionId(questionId);
228 }
229
230 Long groupId = (Long)attributes.get("groupId");
231
232 if (groupId != null) {
233 setGroupId(groupId);
234 }
235
236 Long companyId = (Long)attributes.get("companyId");
237
238 if (companyId != null) {
239 setCompanyId(companyId);
240 }
241
242 Long userId = (Long)attributes.get("userId");
243
244 if (userId != null) {
245 setUserId(userId);
246 }
247
248 String userName = (String)attributes.get("userName");
249
250 if (userName != null) {
251 setUserName(userName);
252 }
253
254 Date createDate = (Date)attributes.get("createDate");
255
256 if (createDate != null) {
257 setCreateDate(createDate);
258 }
259
260 Date modifiedDate = (Date)attributes.get("modifiedDate");
261
262 if (modifiedDate != null) {
263 setModifiedDate(modifiedDate);
264 }
265
266 String title = (String)attributes.get("title");
267
268 if (title != null) {
269 setTitle(title);
270 }
271
272 String description = (String)attributes.get("description");
273
274 if (description != null) {
275 setDescription(description);
276 }
277
278 Date expirationDate = (Date)attributes.get("expirationDate");
279
280 if (expirationDate != null) {
281 setExpirationDate(expirationDate);
282 }
283
284 Date lastVoteDate = (Date)attributes.get("lastVoteDate");
285
286 if (lastVoteDate != null) {
287 setLastVoteDate(lastVoteDate);
288 }
289 }
290
291 @JSON
292 @Override
293 public String getUuid() {
294 if (_uuid == null) {
295 return StringPool.BLANK;
296 }
297 else {
298 return _uuid;
299 }
300 }
301
302 @Override
303 public void setUuid(String uuid) {
304 if (_originalUuid == null) {
305 _originalUuid = _uuid;
306 }
307
308 _uuid = uuid;
309 }
310
311 public String getOriginalUuid() {
312 return GetterUtil.getString(_originalUuid);
313 }
314
315 @JSON
316 @Override
317 public long getQuestionId() {
318 return _questionId;
319 }
320
321 @Override
322 public void setQuestionId(long questionId) {
323 _questionId = questionId;
324 }
325
326 @JSON
327 @Override
328 public long getGroupId() {
329 return _groupId;
330 }
331
332 @Override
333 public void setGroupId(long groupId) {
334 _columnBitmask |= GROUPID_COLUMN_BITMASK;
335
336 if (!_setOriginalGroupId) {
337 _setOriginalGroupId = true;
338
339 _originalGroupId = _groupId;
340 }
341
342 _groupId = groupId;
343 }
344
345 public long getOriginalGroupId() {
346 return _originalGroupId;
347 }
348
349 @JSON
350 @Override
351 public long getCompanyId() {
352 return _companyId;
353 }
354
355 @Override
356 public void setCompanyId(long companyId) {
357 _columnBitmask |= COMPANYID_COLUMN_BITMASK;
358
359 if (!_setOriginalCompanyId) {
360 _setOriginalCompanyId = true;
361
362 _originalCompanyId = _companyId;
363 }
364
365 _companyId = companyId;
366 }
367
368 public long getOriginalCompanyId() {
369 return _originalCompanyId;
370 }
371
372 @JSON
373 @Override
374 public long getUserId() {
375 return _userId;
376 }
377
378 @Override
379 public void setUserId(long userId) {
380 _userId = userId;
381 }
382
383 @Override
384 public String getUserUuid() throws SystemException {
385 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
386 }
387
388 @Override
389 public void setUserUuid(String userUuid) {
390 _userUuid = userUuid;
391 }
392
393 @JSON
394 @Override
395 public String getUserName() {
396 if (_userName == null) {
397 return StringPool.BLANK;
398 }
399 else {
400 return _userName;
401 }
402 }
403
404 @Override
405 public void setUserName(String userName) {
406 _userName = userName;
407 }
408
409 @JSON
410 @Override
411 public Date getCreateDate() {
412 return _createDate;
413 }
414
415 @Override
416 public void setCreateDate(Date createDate) {
417 _columnBitmask = -1L;
418
419 _createDate = createDate;
420 }
421
422 @JSON
423 @Override
424 public Date getModifiedDate() {
425 return _modifiedDate;
426 }
427
428 @Override
429 public void setModifiedDate(Date modifiedDate) {
430 _modifiedDate = modifiedDate;
431 }
432
433 @JSON
434 @Override
435 public String getTitle() {
436 if (_title == null) {
437 return StringPool.BLANK;
438 }
439 else {
440 return _title;
441 }
442 }
443
444 @Override
445 public String getTitle(Locale locale) {
446 String languageId = LocaleUtil.toLanguageId(locale);
447
448 return getTitle(languageId);
449 }
450
451 @Override
452 public String getTitle(Locale locale, boolean useDefault) {
453 String languageId = LocaleUtil.toLanguageId(locale);
454
455 return getTitle(languageId, useDefault);
456 }
457
458 @Override
459 public String getTitle(String languageId) {
460 return LocalizationUtil.getLocalization(getTitle(), languageId);
461 }
462
463 @Override
464 public String getTitle(String languageId, boolean useDefault) {
465 return LocalizationUtil.getLocalization(getTitle(), languageId,
466 useDefault);
467 }
468
469 @Override
470 public String getTitleCurrentLanguageId() {
471 return _titleCurrentLanguageId;
472 }
473
474 @JSON
475 @Override
476 public String getTitleCurrentValue() {
477 Locale locale = getLocale(_titleCurrentLanguageId);
478
479 return getTitle(locale);
480 }
481
482 @Override
483 public Map<Locale, String> getTitleMap() {
484 return LocalizationUtil.getLocalizationMap(getTitle());
485 }
486
487 @Override
488 public void setTitle(String title) {
489 _title = title;
490 }
491
492 @Override
493 public void setTitle(String title, Locale locale) {
494 setTitle(title, locale, LocaleUtil.getSiteDefault());
495 }
496
497 @Override
498 public void setTitle(String title, Locale locale, Locale defaultLocale) {
499 String languageId = LocaleUtil.toLanguageId(locale);
500 String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
501
502 if (Validator.isNotNull(title)) {
503 setTitle(LocalizationUtil.updateLocalization(getTitle(), "Title",
504 title, languageId, defaultLanguageId));
505 }
506 else {
507 setTitle(LocalizationUtil.removeLocalization(getTitle(), "Title",
508 languageId));
509 }
510 }
511
512 @Override
513 public void setTitleCurrentLanguageId(String languageId) {
514 _titleCurrentLanguageId = languageId;
515 }
516
517 @Override
518 public void setTitleMap(Map<Locale, String> titleMap) {
519 setTitleMap(titleMap, LocaleUtil.getSiteDefault());
520 }
521
522 @Override
523 public void setTitleMap(Map<Locale, String> titleMap, Locale defaultLocale) {
524 if (titleMap == null) {
525 return;
526 }
527
528 setTitle(LocalizationUtil.updateLocalization(titleMap, getTitle(),
529 "Title", LocaleUtil.toLanguageId(defaultLocale)));
530 }
531
532 @JSON
533 @Override
534 public String getDescription() {
535 if (_description == null) {
536 return StringPool.BLANK;
537 }
538 else {
539 return _description;
540 }
541 }
542
543 @Override
544 public String getDescription(Locale locale) {
545 String languageId = LocaleUtil.toLanguageId(locale);
546
547 return getDescription(languageId);
548 }
549
550 @Override
551 public String getDescription(Locale locale, boolean useDefault) {
552 String languageId = LocaleUtil.toLanguageId(locale);
553
554 return getDescription(languageId, useDefault);
555 }
556
557 @Override
558 public String getDescription(String languageId) {
559 return LocalizationUtil.getLocalization(getDescription(), languageId);
560 }
561
562 @Override
563 public String getDescription(String languageId, boolean useDefault) {
564 return LocalizationUtil.getLocalization(getDescription(), languageId,
565 useDefault);
566 }
567
568 @Override
569 public String getDescriptionCurrentLanguageId() {
570 return _descriptionCurrentLanguageId;
571 }
572
573 @JSON
574 @Override
575 public String getDescriptionCurrentValue() {
576 Locale locale = getLocale(_descriptionCurrentLanguageId);
577
578 return getDescription(locale);
579 }
580
581 @Override
582 public Map<Locale, String> getDescriptionMap() {
583 return LocalizationUtil.getLocalizationMap(getDescription());
584 }
585
586 @Override
587 public void setDescription(String description) {
588 _description = description;
589 }
590
591 @Override
592 public void setDescription(String description, Locale locale) {
593 setDescription(description, locale, LocaleUtil.getSiteDefault());
594 }
595
596 @Override
597 public void setDescription(String description, Locale locale,
598 Locale defaultLocale) {
599 String languageId = LocaleUtil.toLanguageId(locale);
600 String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
601
602 if (Validator.isNotNull(description)) {
603 setDescription(LocalizationUtil.updateLocalization(
604 getDescription(), "Description", description, languageId,
605 defaultLanguageId));
606 }
607 else {
608 setDescription(LocalizationUtil.removeLocalization(
609 getDescription(), "Description", languageId));
610 }
611 }
612
613 @Override
614 public void setDescriptionCurrentLanguageId(String languageId) {
615 _descriptionCurrentLanguageId = languageId;
616 }
617
618 @Override
619 public void setDescriptionMap(Map<Locale, String> descriptionMap) {
620 setDescriptionMap(descriptionMap, LocaleUtil.getSiteDefault());
621 }
622
623 @Override
624 public void setDescriptionMap(Map<Locale, String> descriptionMap,
625 Locale defaultLocale) {
626 if (descriptionMap == null) {
627 return;
628 }
629
630 setDescription(LocalizationUtil.updateLocalization(descriptionMap,
631 getDescription(), "Description",
632 LocaleUtil.toLanguageId(defaultLocale)));
633 }
634
635 @JSON
636 @Override
637 public Date getExpirationDate() {
638 return _expirationDate;
639 }
640
641 @Override
642 public void setExpirationDate(Date expirationDate) {
643 _expirationDate = expirationDate;
644 }
645
646 @JSON
647 @Override
648 public Date getLastVoteDate() {
649 return _lastVoteDate;
650 }
651
652 @Override
653 public void setLastVoteDate(Date lastVoteDate) {
654 _lastVoteDate = lastVoteDate;
655 }
656
657 @Override
658 public StagedModelType getStagedModelType() {
659 return new StagedModelType(PortalUtil.getClassNameId(
660 PollsQuestion.class.getName()));
661 }
662
663 public long getColumnBitmask() {
664 return _columnBitmask;
665 }
666
667 @Override
668 public ExpandoBridge getExpandoBridge() {
669 return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
670 PollsQuestion.class.getName(), getPrimaryKey());
671 }
672
673 @Override
674 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
675 ExpandoBridge expandoBridge = getExpandoBridge();
676
677 expandoBridge.setAttributes(serviceContext);
678 }
679
680 @Override
681 public String[] getAvailableLanguageIds() {
682 Set<String> availableLanguageIds = new TreeSet<String>();
683
684 Map<Locale, String> titleMap = getTitleMap();
685
686 for (Map.Entry<Locale, String> entry : titleMap.entrySet()) {
687 Locale locale = entry.getKey();
688 String value = entry.getValue();
689
690 if (Validator.isNotNull(value)) {
691 availableLanguageIds.add(LocaleUtil.toLanguageId(locale));
692 }
693 }
694
695 Map<Locale, String> descriptionMap = getDescriptionMap();
696
697 for (Map.Entry<Locale, String> entry : descriptionMap.entrySet()) {
698 Locale locale = entry.getKey();
699 String value = entry.getValue();
700
701 if (Validator.isNotNull(value)) {
702 availableLanguageIds.add(LocaleUtil.toLanguageId(locale));
703 }
704 }
705
706 return availableLanguageIds.toArray(new String[availableLanguageIds.size()]);
707 }
708
709 @Override
710 public String getDefaultLanguageId() {
711 String xml = getTitle();
712
713 if (xml == null) {
714 return StringPool.BLANK;
715 }
716
717 Locale defaultLocale = LocaleUtil.getSiteDefault();
718
719 return LocalizationUtil.getDefaultLanguageId(xml, defaultLocale);
720 }
721
722 @Override
723 public void prepareLocalizedFieldsForImport() throws LocaleException {
724 prepareLocalizedFieldsForImport(null);
725 }
726
727 @Override
728 @SuppressWarnings("unused")
729 public void prepareLocalizedFieldsForImport(Locale defaultImportLocale)
730 throws LocaleException {
731 Locale defaultLocale = LocaleUtil.getSiteDefault();
732
733 String modelDefaultLanguageId = getDefaultLanguageId();
734
735 String title = getTitle(defaultLocale);
736
737 if (Validator.isNull(title)) {
738 setTitle(getTitle(modelDefaultLanguageId), defaultLocale);
739 }
740 else {
741 setTitle(getTitle(defaultLocale), defaultLocale, defaultLocale);
742 }
743
744 String description = getDescription(defaultLocale);
745
746 if (Validator.isNull(description)) {
747 setDescription(getDescription(modelDefaultLanguageId), defaultLocale);
748 }
749 else {
750 setDescription(getDescription(defaultLocale), defaultLocale,
751 defaultLocale);
752 }
753 }
754
755 @Override
756 public PollsQuestion toEscapedModel() {
757 if (_escapedModel == null) {
758 _escapedModel = (PollsQuestion)ProxyUtil.newProxyInstance(_classLoader,
759 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
760 }
761
762 return _escapedModel;
763 }
764
765 @Override
766 public Object clone() {
767 PollsQuestionImpl pollsQuestionImpl = new PollsQuestionImpl();
768
769 pollsQuestionImpl.setUuid(getUuid());
770 pollsQuestionImpl.setQuestionId(getQuestionId());
771 pollsQuestionImpl.setGroupId(getGroupId());
772 pollsQuestionImpl.setCompanyId(getCompanyId());
773 pollsQuestionImpl.setUserId(getUserId());
774 pollsQuestionImpl.setUserName(getUserName());
775 pollsQuestionImpl.setCreateDate(getCreateDate());
776 pollsQuestionImpl.setModifiedDate(getModifiedDate());
777 pollsQuestionImpl.setTitle(getTitle());
778 pollsQuestionImpl.setDescription(getDescription());
779 pollsQuestionImpl.setExpirationDate(getExpirationDate());
780 pollsQuestionImpl.setLastVoteDate(getLastVoteDate());
781
782 pollsQuestionImpl.resetOriginalValues();
783
784 return pollsQuestionImpl;
785 }
786
787 @Override
788 public int compareTo(PollsQuestion pollsQuestion) {
789 int value = 0;
790
791 value = DateUtil.compareTo(getCreateDate(),
792 pollsQuestion.getCreateDate());
793
794 value = value * -1;
795
796 if (value != 0) {
797 return value;
798 }
799
800 return 0;
801 }
802
803 @Override
804 public boolean equals(Object obj) {
805 if (this == obj) {
806 return true;
807 }
808
809 if (!(obj instanceof PollsQuestion)) {
810 return false;
811 }
812
813 PollsQuestion pollsQuestion = (PollsQuestion)obj;
814
815 long primaryKey = pollsQuestion.getPrimaryKey();
816
817 if (getPrimaryKey() == primaryKey) {
818 return true;
819 }
820 else {
821 return false;
822 }
823 }
824
825 @Override
826 public int hashCode() {
827 return (int)getPrimaryKey();
828 }
829
830 @Override
831 public void resetOriginalValues() {
832 PollsQuestionModelImpl pollsQuestionModelImpl = this;
833
834 pollsQuestionModelImpl._originalUuid = pollsQuestionModelImpl._uuid;
835
836 pollsQuestionModelImpl._originalGroupId = pollsQuestionModelImpl._groupId;
837
838 pollsQuestionModelImpl._setOriginalGroupId = false;
839
840 pollsQuestionModelImpl._originalCompanyId = pollsQuestionModelImpl._companyId;
841
842 pollsQuestionModelImpl._setOriginalCompanyId = false;
843
844 pollsQuestionModelImpl._columnBitmask = 0;
845 }
846
847 @Override
848 public CacheModel<PollsQuestion> toCacheModel() {
849 PollsQuestionCacheModel pollsQuestionCacheModel = new PollsQuestionCacheModel();
850
851 pollsQuestionCacheModel.uuid = getUuid();
852
853 String uuid = pollsQuestionCacheModel.uuid;
854
855 if ((uuid != null) && (uuid.length() == 0)) {
856 pollsQuestionCacheModel.uuid = null;
857 }
858
859 pollsQuestionCacheModel.questionId = getQuestionId();
860
861 pollsQuestionCacheModel.groupId = getGroupId();
862
863 pollsQuestionCacheModel.companyId = getCompanyId();
864
865 pollsQuestionCacheModel.userId = getUserId();
866
867 pollsQuestionCacheModel.userName = getUserName();
868
869 String userName = pollsQuestionCacheModel.userName;
870
871 if ((userName != null) && (userName.length() == 0)) {
872 pollsQuestionCacheModel.userName = null;
873 }
874
875 Date createDate = getCreateDate();
876
877 if (createDate != null) {
878 pollsQuestionCacheModel.createDate = createDate.getTime();
879 }
880 else {
881 pollsQuestionCacheModel.createDate = Long.MIN_VALUE;
882 }
883
884 Date modifiedDate = getModifiedDate();
885
886 if (modifiedDate != null) {
887 pollsQuestionCacheModel.modifiedDate = modifiedDate.getTime();
888 }
889 else {
890 pollsQuestionCacheModel.modifiedDate = Long.MIN_VALUE;
891 }
892
893 pollsQuestionCacheModel.title = getTitle();
894
895 String title = pollsQuestionCacheModel.title;
896
897 if ((title != null) && (title.length() == 0)) {
898 pollsQuestionCacheModel.title = null;
899 }
900
901 pollsQuestionCacheModel.description = getDescription();
902
903 String description = pollsQuestionCacheModel.description;
904
905 if ((description != null) && (description.length() == 0)) {
906 pollsQuestionCacheModel.description = null;
907 }
908
909 Date expirationDate = getExpirationDate();
910
911 if (expirationDate != null) {
912 pollsQuestionCacheModel.expirationDate = expirationDate.getTime();
913 }
914 else {
915 pollsQuestionCacheModel.expirationDate = Long.MIN_VALUE;
916 }
917
918 Date lastVoteDate = getLastVoteDate();
919
920 if (lastVoteDate != null) {
921 pollsQuestionCacheModel.lastVoteDate = lastVoteDate.getTime();
922 }
923 else {
924 pollsQuestionCacheModel.lastVoteDate = Long.MIN_VALUE;
925 }
926
927 return pollsQuestionCacheModel;
928 }
929
930 @Override
931 public String toString() {
932 StringBundler sb = new StringBundler(25);
933
934 sb.append("{uuid=");
935 sb.append(getUuid());
936 sb.append(", questionId=");
937 sb.append(getQuestionId());
938 sb.append(", groupId=");
939 sb.append(getGroupId());
940 sb.append(", companyId=");
941 sb.append(getCompanyId());
942 sb.append(", userId=");
943 sb.append(getUserId());
944 sb.append(", userName=");
945 sb.append(getUserName());
946 sb.append(", createDate=");
947 sb.append(getCreateDate());
948 sb.append(", modifiedDate=");
949 sb.append(getModifiedDate());
950 sb.append(", title=");
951 sb.append(getTitle());
952 sb.append(", description=");
953 sb.append(getDescription());
954 sb.append(", expirationDate=");
955 sb.append(getExpirationDate());
956 sb.append(", lastVoteDate=");
957 sb.append(getLastVoteDate());
958 sb.append("}");
959
960 return sb.toString();
961 }
962
963 @Override
964 public String toXmlString() {
965 StringBundler sb = new StringBundler(40);
966
967 sb.append("<model><model-name>");
968 sb.append("com.liferay.portlet.polls.model.PollsQuestion");
969 sb.append("</model-name>");
970
971 sb.append(
972 "<column><column-name>uuid</column-name><column-value><![CDATA[");
973 sb.append(getUuid());
974 sb.append("]]></column-value></column>");
975 sb.append(
976 "<column><column-name>questionId</column-name><column-value><![CDATA[");
977 sb.append(getQuestionId());
978 sb.append("]]></column-value></column>");
979 sb.append(
980 "<column><column-name>groupId</column-name><column-value><![CDATA[");
981 sb.append(getGroupId());
982 sb.append("]]></column-value></column>");
983 sb.append(
984 "<column><column-name>companyId</column-name><column-value><![CDATA[");
985 sb.append(getCompanyId());
986 sb.append("]]></column-value></column>");
987 sb.append(
988 "<column><column-name>userId</column-name><column-value><![CDATA[");
989 sb.append(getUserId());
990 sb.append("]]></column-value></column>");
991 sb.append(
992 "<column><column-name>userName</column-name><column-value><![CDATA[");
993 sb.append(getUserName());
994 sb.append("]]></column-value></column>");
995 sb.append(
996 "<column><column-name>createDate</column-name><column-value><![CDATA[");
997 sb.append(getCreateDate());
998 sb.append("]]></column-value></column>");
999 sb.append(
1000 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
1001 sb.append(getModifiedDate());
1002 sb.append("]]></column-value></column>");
1003 sb.append(
1004 "<column><column-name>title</column-name><column-value><![CDATA[");
1005 sb.append(getTitle());
1006 sb.append("]]></column-value></column>");
1007 sb.append(
1008 "<column><column-name>description</column-name><column-value><![CDATA[");
1009 sb.append(getDescription());
1010 sb.append("]]></column-value></column>");
1011 sb.append(
1012 "<column><column-name>expirationDate</column-name><column-value><![CDATA[");
1013 sb.append(getExpirationDate());
1014 sb.append("]]></column-value></column>");
1015 sb.append(
1016 "<column><column-name>lastVoteDate</column-name><column-value><![CDATA[");
1017 sb.append(getLastVoteDate());
1018 sb.append("]]></column-value></column>");
1019
1020 sb.append("</model>");
1021
1022 return sb.toString();
1023 }
1024
1025 private static ClassLoader _classLoader = PollsQuestion.class.getClassLoader();
1026 private static Class<?>[] _escapedModelInterfaces = new Class[] {
1027 PollsQuestion.class
1028 };
1029 private String _uuid;
1030 private String _originalUuid;
1031 private long _questionId;
1032 private long _groupId;
1033 private long _originalGroupId;
1034 private boolean _setOriginalGroupId;
1035 private long _companyId;
1036 private long _originalCompanyId;
1037 private boolean _setOriginalCompanyId;
1038 private long _userId;
1039 private String _userUuid;
1040 private String _userName;
1041 private Date _createDate;
1042 private Date _modifiedDate;
1043 private String _title;
1044 private String _titleCurrentLanguageId;
1045 private String _description;
1046 private String _descriptionCurrentLanguageId;
1047 private Date _expirationDate;
1048 private Date _lastVoteDate;
1049 private long _columnBitmask;
1050 private PollsQuestion _escapedModel;
1051 }