001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
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.language.LanguageUtil;
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    
052    /**
053     * The base model implementation for the PollsQuestion service. Represents a row in the "PollsQuestion" database table, with each column mapped to a property of this class.
054     *
055     * <p>
056     * This implementation and its corresponding interface {@link com.liferay.portlet.polls.model.PollsQuestionModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link PollsQuestionImpl}.
057     * </p>
058     *
059     * @author Brian Wing Shun Chan
060     * @see PollsQuestionImpl
061     * @see com.liferay.portlet.polls.model.PollsQuestion
062     * @see com.liferay.portlet.polls.model.PollsQuestionModel
063     * @generated
064     */
065    @JSON(strict = true)
066    public class PollsQuestionModelImpl extends BaseModelImpl<PollsQuestion>
067            implements PollsQuestionModel {
068            /*
069             * NOTE FOR DEVELOPERS:
070             *
071             * Never modify or reference this class directly. All methods that expect a polls question model instance should use the {@link com.liferay.portlet.polls.model.PollsQuestion} interface instead.
072             */
073            public static final String TABLE_NAME = "PollsQuestion";
074            public static final Object[][] TABLE_COLUMNS = {
075                            { "uuid_", Types.VARCHAR },
076                            { "questionId", Types.BIGINT },
077                            { "groupId", Types.BIGINT },
078                            { "companyId", Types.BIGINT },
079                            { "userId", Types.BIGINT },
080                            { "userName", Types.VARCHAR },
081                            { "createDate", Types.TIMESTAMP },
082                            { "modifiedDate", Types.TIMESTAMP },
083                            { "title", Types.VARCHAR },
084                            { "description", Types.VARCHAR },
085                            { "expirationDate", Types.TIMESTAMP },
086                            { "lastVoteDate", Types.TIMESTAMP }
087                    };
088            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)";
089            public static final String TABLE_SQL_DROP = "drop table PollsQuestion";
090            public static final String ORDER_BY_JPQL = " ORDER BY pollsQuestion.createDate DESC";
091            public static final String ORDER_BY_SQL = " ORDER BY PollsQuestion.createDate DESC";
092            public static final String DATA_SOURCE = "liferayDataSource";
093            public static final String SESSION_FACTORY = "liferaySessionFactory";
094            public static final String TX_MANAGER = "liferayTransactionManager";
095            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
096                                    "value.object.entity.cache.enabled.com.liferay.portlet.polls.model.PollsQuestion"),
097                            true);
098            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
099                                    "value.object.finder.cache.enabled.com.liferay.portlet.polls.model.PollsQuestion"),
100                            true);
101            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
102                                    "value.object.column.bitmask.enabled.com.liferay.portlet.polls.model.PollsQuestion"),
103                            true);
104            public static long GROUPID_COLUMN_BITMASK = 1L;
105            public static long UUID_COLUMN_BITMASK = 2L;
106    
107            /**
108             * Converts the soap model instance into a normal model instance.
109             *
110             * @param soapModel the soap model instance to convert
111             * @return the normal model instance
112             */
113            public static PollsQuestion toModel(PollsQuestionSoap soapModel) {
114                    if (soapModel == null) {
115                            return null;
116                    }
117    
118                    PollsQuestion model = new PollsQuestionImpl();
119    
120                    model.setUuid(soapModel.getUuid());
121                    model.setQuestionId(soapModel.getQuestionId());
122                    model.setGroupId(soapModel.getGroupId());
123                    model.setCompanyId(soapModel.getCompanyId());
124                    model.setUserId(soapModel.getUserId());
125                    model.setUserName(soapModel.getUserName());
126                    model.setCreateDate(soapModel.getCreateDate());
127                    model.setModifiedDate(soapModel.getModifiedDate());
128                    model.setTitle(soapModel.getTitle());
129                    model.setDescription(soapModel.getDescription());
130                    model.setExpirationDate(soapModel.getExpirationDate());
131                    model.setLastVoteDate(soapModel.getLastVoteDate());
132    
133                    return model;
134            }
135    
136            /**
137             * Converts the soap model instances into normal model instances.
138             *
139             * @param soapModels the soap model instances to convert
140             * @return the normal model instances
141             */
142            public static List<PollsQuestion> toModels(PollsQuestionSoap[] soapModels) {
143                    if (soapModels == null) {
144                            return null;
145                    }
146    
147                    List<PollsQuestion> models = new ArrayList<PollsQuestion>(soapModels.length);
148    
149                    for (PollsQuestionSoap soapModel : soapModels) {
150                            models.add(toModel(soapModel));
151                    }
152    
153                    return models;
154            }
155    
156            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
157                                    "lock.expiration.time.com.liferay.portlet.polls.model.PollsQuestion"));
158    
159            public PollsQuestionModelImpl() {
160            }
161    
162            public long getPrimaryKey() {
163                    return _questionId;
164            }
165    
166            public void setPrimaryKey(long primaryKey) {
167                    setQuestionId(primaryKey);
168            }
169    
170            public Serializable getPrimaryKeyObj() {
171                    return new Long(_questionId);
172            }
173    
174            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
175                    setPrimaryKey(((Long)primaryKeyObj).longValue());
176            }
177    
178            public Class<?> getModelClass() {
179                    return PollsQuestion.class;
180            }
181    
182            public String getModelClassName() {
183                    return PollsQuestion.class.getName();
184            }
185    
186            @Override
187            public Map<String, Object> getModelAttributes() {
188                    Map<String, Object> attributes = new HashMap<String, Object>();
189    
190                    attributes.put("uuid", getUuid());
191                    attributes.put("questionId", getQuestionId());
192                    attributes.put("groupId", getGroupId());
193                    attributes.put("companyId", getCompanyId());
194                    attributes.put("userId", getUserId());
195                    attributes.put("userName", getUserName());
196                    attributes.put("createDate", getCreateDate());
197                    attributes.put("modifiedDate", getModifiedDate());
198                    attributes.put("title", getTitle());
199                    attributes.put("description", getDescription());
200                    attributes.put("expirationDate", getExpirationDate());
201                    attributes.put("lastVoteDate", getLastVoteDate());
202    
203                    return attributes;
204            }
205    
206            @Override
207            public void setModelAttributes(Map<String, Object> attributes) {
208                    String uuid = (String)attributes.get("uuid");
209    
210                    if (uuid != null) {
211                            setUuid(uuid);
212                    }
213    
214                    Long questionId = (Long)attributes.get("questionId");
215    
216                    if (questionId != null) {
217                            setQuestionId(questionId);
218                    }
219    
220                    Long groupId = (Long)attributes.get("groupId");
221    
222                    if (groupId != null) {
223                            setGroupId(groupId);
224                    }
225    
226                    Long companyId = (Long)attributes.get("companyId");
227    
228                    if (companyId != null) {
229                            setCompanyId(companyId);
230                    }
231    
232                    Long userId = (Long)attributes.get("userId");
233    
234                    if (userId != null) {
235                            setUserId(userId);
236                    }
237    
238                    String userName = (String)attributes.get("userName");
239    
240                    if (userName != null) {
241                            setUserName(userName);
242                    }
243    
244                    Date createDate = (Date)attributes.get("createDate");
245    
246                    if (createDate != null) {
247                            setCreateDate(createDate);
248                    }
249    
250                    Date modifiedDate = (Date)attributes.get("modifiedDate");
251    
252                    if (modifiedDate != null) {
253                            setModifiedDate(modifiedDate);
254                    }
255    
256                    String title = (String)attributes.get("title");
257    
258                    if (title != null) {
259                            setTitle(title);
260                    }
261    
262                    String description = (String)attributes.get("description");
263    
264                    if (description != null) {
265                            setDescription(description);
266                    }
267    
268                    Date expirationDate = (Date)attributes.get("expirationDate");
269    
270                    if (expirationDate != null) {
271                            setExpirationDate(expirationDate);
272                    }
273    
274                    Date lastVoteDate = (Date)attributes.get("lastVoteDate");
275    
276                    if (lastVoteDate != null) {
277                            setLastVoteDate(lastVoteDate);
278                    }
279            }
280    
281            @JSON
282            public String getUuid() {
283                    if (_uuid == null) {
284                            return StringPool.BLANK;
285                    }
286                    else {
287                            return _uuid;
288                    }
289            }
290    
291            public void setUuid(String uuid) {
292                    if (_originalUuid == null) {
293                            _originalUuid = _uuid;
294                    }
295    
296                    _uuid = uuid;
297            }
298    
299            public String getOriginalUuid() {
300                    return GetterUtil.getString(_originalUuid);
301            }
302    
303            @JSON
304            public long getQuestionId() {
305                    return _questionId;
306            }
307    
308            public void setQuestionId(long questionId) {
309                    _questionId = questionId;
310            }
311    
312            @JSON
313            public long getGroupId() {
314                    return _groupId;
315            }
316    
317            public void setGroupId(long groupId) {
318                    _columnBitmask |= GROUPID_COLUMN_BITMASK;
319    
320                    if (!_setOriginalGroupId) {
321                            _setOriginalGroupId = true;
322    
323                            _originalGroupId = _groupId;
324                    }
325    
326                    _groupId = groupId;
327            }
328    
329            public long getOriginalGroupId() {
330                    return _originalGroupId;
331            }
332    
333            @JSON
334            public long getCompanyId() {
335                    return _companyId;
336            }
337    
338            public void setCompanyId(long companyId) {
339                    _companyId = companyId;
340            }
341    
342            @JSON
343            public long getUserId() {
344                    return _userId;
345            }
346    
347            public void setUserId(long userId) {
348                    _userId = userId;
349            }
350    
351            public String getUserUuid() throws SystemException {
352                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
353            }
354    
355            public void setUserUuid(String userUuid) {
356                    _userUuid = userUuid;
357            }
358    
359            @JSON
360            public String getUserName() {
361                    if (_userName == null) {
362                            return StringPool.BLANK;
363                    }
364                    else {
365                            return _userName;
366                    }
367            }
368    
369            public void setUserName(String userName) {
370                    _userName = userName;
371            }
372    
373            @JSON
374            public Date getCreateDate() {
375                    return _createDate;
376            }
377    
378            public void setCreateDate(Date createDate) {
379                    _columnBitmask = -1L;
380    
381                    _createDate = createDate;
382            }
383    
384            @JSON
385            public Date getModifiedDate() {
386                    return _modifiedDate;
387            }
388    
389            public void setModifiedDate(Date modifiedDate) {
390                    _modifiedDate = modifiedDate;
391            }
392    
393            @JSON
394            public String getTitle() {
395                    if (_title == null) {
396                            return StringPool.BLANK;
397                    }
398                    else {
399                            return _title;
400                    }
401            }
402    
403            public String getTitle(Locale locale) {
404                    String languageId = LocaleUtil.toLanguageId(locale);
405    
406                    return getTitle(languageId);
407            }
408    
409            public String getTitle(Locale locale, boolean useDefault) {
410                    String languageId = LocaleUtil.toLanguageId(locale);
411    
412                    return getTitle(languageId, useDefault);
413            }
414    
415            public String getTitle(String languageId) {
416                    return LocalizationUtil.getLocalization(getTitle(), languageId);
417            }
418    
419            public String getTitle(String languageId, boolean useDefault) {
420                    return LocalizationUtil.getLocalization(getTitle(), languageId,
421                            useDefault);
422            }
423    
424            public String getTitleCurrentLanguageId() {
425                    return _titleCurrentLanguageId;
426            }
427    
428            @JSON
429            public String getTitleCurrentValue() {
430                    Locale locale = getLocale(_titleCurrentLanguageId);
431    
432                    return getTitle(locale);
433            }
434    
435            public Map<Locale, String> getTitleMap() {
436                    return LocalizationUtil.getLocalizationMap(getTitle());
437            }
438    
439            public void setTitle(String title) {
440                    _title = title;
441            }
442    
443            public void setTitle(String title, Locale locale) {
444                    setTitle(title, locale, LocaleUtil.getDefault());
445            }
446    
447            public void setTitle(String title, Locale locale, Locale defaultLocale) {
448                    String languageId = LocaleUtil.toLanguageId(locale);
449                    String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
450    
451                    if (Validator.isNotNull(title)) {
452                            setTitle(LocalizationUtil.updateLocalization(getTitle(), "Title",
453                                            title, languageId, defaultLanguageId));
454                    }
455                    else {
456                            setTitle(LocalizationUtil.removeLocalization(getTitle(), "Title",
457                                            languageId));
458                    }
459            }
460    
461            public void setTitleCurrentLanguageId(String languageId) {
462                    _titleCurrentLanguageId = languageId;
463            }
464    
465            public void setTitleMap(Map<Locale, String> titleMap) {
466                    setTitleMap(titleMap, LocaleUtil.getDefault());
467            }
468    
469            public void setTitleMap(Map<Locale, String> titleMap, Locale defaultLocale) {
470                    if (titleMap == null) {
471                            return;
472                    }
473    
474                    Locale[] locales = LanguageUtil.getAvailableLocales();
475    
476                    for (Locale locale : locales) {
477                            String title = titleMap.get(locale);
478    
479                            setTitle(title, locale, defaultLocale);
480                    }
481            }
482    
483            @JSON
484            public String getDescription() {
485                    if (_description == null) {
486                            return StringPool.BLANK;
487                    }
488                    else {
489                            return _description;
490                    }
491            }
492    
493            public String getDescription(Locale locale) {
494                    String languageId = LocaleUtil.toLanguageId(locale);
495    
496                    return getDescription(languageId);
497            }
498    
499            public String getDescription(Locale locale, boolean useDefault) {
500                    String languageId = LocaleUtil.toLanguageId(locale);
501    
502                    return getDescription(languageId, useDefault);
503            }
504    
505            public String getDescription(String languageId) {
506                    return LocalizationUtil.getLocalization(getDescription(), languageId);
507            }
508    
509            public String getDescription(String languageId, boolean useDefault) {
510                    return LocalizationUtil.getLocalization(getDescription(), languageId,
511                            useDefault);
512            }
513    
514            public String getDescriptionCurrentLanguageId() {
515                    return _descriptionCurrentLanguageId;
516            }
517    
518            @JSON
519            public String getDescriptionCurrentValue() {
520                    Locale locale = getLocale(_descriptionCurrentLanguageId);
521    
522                    return getDescription(locale);
523            }
524    
525            public Map<Locale, String> getDescriptionMap() {
526                    return LocalizationUtil.getLocalizationMap(getDescription());
527            }
528    
529            public void setDescription(String description) {
530                    _description = description;
531            }
532    
533            public void setDescription(String description, Locale locale) {
534                    setDescription(description, locale, LocaleUtil.getDefault());
535            }
536    
537            public void setDescription(String description, Locale locale,
538                    Locale defaultLocale) {
539                    String languageId = LocaleUtil.toLanguageId(locale);
540                    String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
541    
542                    if (Validator.isNotNull(description)) {
543                            setDescription(LocalizationUtil.updateLocalization(
544                                            getDescription(), "Description", description, languageId,
545                                            defaultLanguageId));
546                    }
547                    else {
548                            setDescription(LocalizationUtil.removeLocalization(
549                                            getDescription(), "Description", languageId));
550                    }
551            }
552    
553            public void setDescriptionCurrentLanguageId(String languageId) {
554                    _descriptionCurrentLanguageId = languageId;
555            }
556    
557            public void setDescriptionMap(Map<Locale, String> descriptionMap) {
558                    setDescriptionMap(descriptionMap, LocaleUtil.getDefault());
559            }
560    
561            public void setDescriptionMap(Map<Locale, String> descriptionMap,
562                    Locale defaultLocale) {
563                    if (descriptionMap == null) {
564                            return;
565                    }
566    
567                    Locale[] locales = LanguageUtil.getAvailableLocales();
568    
569                    for (Locale locale : locales) {
570                            String description = descriptionMap.get(locale);
571    
572                            setDescription(description, locale, defaultLocale);
573                    }
574            }
575    
576            @JSON
577            public Date getExpirationDate() {
578                    return _expirationDate;
579            }
580    
581            public void setExpirationDate(Date expirationDate) {
582                    _expirationDate = expirationDate;
583            }
584    
585            @JSON
586            public Date getLastVoteDate() {
587                    return _lastVoteDate;
588            }
589    
590            public void setLastVoteDate(Date lastVoteDate) {
591                    _lastVoteDate = lastVoteDate;
592            }
593    
594            public long getColumnBitmask() {
595                    return _columnBitmask;
596            }
597    
598            @Override
599            public ExpandoBridge getExpandoBridge() {
600                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
601                            PollsQuestion.class.getName(), getPrimaryKey());
602            }
603    
604            @Override
605            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
606                    ExpandoBridge expandoBridge = getExpandoBridge();
607    
608                    expandoBridge.setAttributes(serviceContext);
609            }
610    
611            @SuppressWarnings("unused")
612            public void prepareLocalizedFieldsForImport(Locale defaultImportLocale)
613                    throws LocaleException {
614                    setTitle(getTitle(defaultImportLocale), defaultImportLocale,
615                            defaultImportLocale);
616                    setDescription(getDescription(defaultImportLocale),
617                            defaultImportLocale, defaultImportLocale);
618            }
619    
620            @Override
621            public PollsQuestion toEscapedModel() {
622                    if (_escapedModel == null) {
623                            _escapedModel = (PollsQuestion)ProxyUtil.newProxyInstance(_classLoader,
624                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
625                    }
626    
627                    return _escapedModel;
628            }
629    
630            public PollsQuestion toUnescapedModel() {
631                    return (PollsQuestion)this;
632            }
633    
634            @Override
635            public Object clone() {
636                    PollsQuestionImpl pollsQuestionImpl = new PollsQuestionImpl();
637    
638                    pollsQuestionImpl.setUuid(getUuid());
639                    pollsQuestionImpl.setQuestionId(getQuestionId());
640                    pollsQuestionImpl.setGroupId(getGroupId());
641                    pollsQuestionImpl.setCompanyId(getCompanyId());
642                    pollsQuestionImpl.setUserId(getUserId());
643                    pollsQuestionImpl.setUserName(getUserName());
644                    pollsQuestionImpl.setCreateDate(getCreateDate());
645                    pollsQuestionImpl.setModifiedDate(getModifiedDate());
646                    pollsQuestionImpl.setTitle(getTitle());
647                    pollsQuestionImpl.setDescription(getDescription());
648                    pollsQuestionImpl.setExpirationDate(getExpirationDate());
649                    pollsQuestionImpl.setLastVoteDate(getLastVoteDate());
650    
651                    pollsQuestionImpl.resetOriginalValues();
652    
653                    return pollsQuestionImpl;
654            }
655    
656            public int compareTo(PollsQuestion pollsQuestion) {
657                    int value = 0;
658    
659                    value = DateUtil.compareTo(getCreateDate(),
660                                    pollsQuestion.getCreateDate());
661    
662                    value = value * -1;
663    
664                    if (value != 0) {
665                            return value;
666                    }
667    
668                    return 0;
669            }
670    
671            @Override
672            public boolean equals(Object obj) {
673                    if (this == obj) {
674                            return true;
675                    }
676    
677                    if (!(obj instanceof PollsQuestion)) {
678                            return false;
679                    }
680    
681                    PollsQuestion pollsQuestion = (PollsQuestion)obj;
682    
683                    long primaryKey = pollsQuestion.getPrimaryKey();
684    
685                    if (getPrimaryKey() == primaryKey) {
686                            return true;
687                    }
688                    else {
689                            return false;
690                    }
691            }
692    
693            @Override
694            public int hashCode() {
695                    return (int)getPrimaryKey();
696            }
697    
698            @Override
699            public void resetOriginalValues() {
700                    PollsQuestionModelImpl pollsQuestionModelImpl = this;
701    
702                    pollsQuestionModelImpl._originalUuid = pollsQuestionModelImpl._uuid;
703    
704                    pollsQuestionModelImpl._originalGroupId = pollsQuestionModelImpl._groupId;
705    
706                    pollsQuestionModelImpl._setOriginalGroupId = false;
707    
708                    pollsQuestionModelImpl._columnBitmask = 0;
709            }
710    
711            @Override
712            public CacheModel<PollsQuestion> toCacheModel() {
713                    PollsQuestionCacheModel pollsQuestionCacheModel = new PollsQuestionCacheModel();
714    
715                    pollsQuestionCacheModel.uuid = getUuid();
716    
717                    String uuid = pollsQuestionCacheModel.uuid;
718    
719                    if ((uuid != null) && (uuid.length() == 0)) {
720                            pollsQuestionCacheModel.uuid = null;
721                    }
722    
723                    pollsQuestionCacheModel.questionId = getQuestionId();
724    
725                    pollsQuestionCacheModel.groupId = getGroupId();
726    
727                    pollsQuestionCacheModel.companyId = getCompanyId();
728    
729                    pollsQuestionCacheModel.userId = getUserId();
730    
731                    pollsQuestionCacheModel.userName = getUserName();
732    
733                    String userName = pollsQuestionCacheModel.userName;
734    
735                    if ((userName != null) && (userName.length() == 0)) {
736                            pollsQuestionCacheModel.userName = null;
737                    }
738    
739                    Date createDate = getCreateDate();
740    
741                    if (createDate != null) {
742                            pollsQuestionCacheModel.createDate = createDate.getTime();
743                    }
744                    else {
745                            pollsQuestionCacheModel.createDate = Long.MIN_VALUE;
746                    }
747    
748                    Date modifiedDate = getModifiedDate();
749    
750                    if (modifiedDate != null) {
751                            pollsQuestionCacheModel.modifiedDate = modifiedDate.getTime();
752                    }
753                    else {
754                            pollsQuestionCacheModel.modifiedDate = Long.MIN_VALUE;
755                    }
756    
757                    pollsQuestionCacheModel.title = getTitle();
758    
759                    String title = pollsQuestionCacheModel.title;
760    
761                    if ((title != null) && (title.length() == 0)) {
762                            pollsQuestionCacheModel.title = null;
763                    }
764    
765                    pollsQuestionCacheModel.description = getDescription();
766    
767                    String description = pollsQuestionCacheModel.description;
768    
769                    if ((description != null) && (description.length() == 0)) {
770                            pollsQuestionCacheModel.description = null;
771                    }
772    
773                    Date expirationDate = getExpirationDate();
774    
775                    if (expirationDate != null) {
776                            pollsQuestionCacheModel.expirationDate = expirationDate.getTime();
777                    }
778                    else {
779                            pollsQuestionCacheModel.expirationDate = Long.MIN_VALUE;
780                    }
781    
782                    Date lastVoteDate = getLastVoteDate();
783    
784                    if (lastVoteDate != null) {
785                            pollsQuestionCacheModel.lastVoteDate = lastVoteDate.getTime();
786                    }
787                    else {
788                            pollsQuestionCacheModel.lastVoteDate = Long.MIN_VALUE;
789                    }
790    
791                    return pollsQuestionCacheModel;
792            }
793    
794            @Override
795            public String toString() {
796                    StringBundler sb = new StringBundler(25);
797    
798                    sb.append("{uuid=");
799                    sb.append(getUuid());
800                    sb.append(", questionId=");
801                    sb.append(getQuestionId());
802                    sb.append(", groupId=");
803                    sb.append(getGroupId());
804                    sb.append(", companyId=");
805                    sb.append(getCompanyId());
806                    sb.append(", userId=");
807                    sb.append(getUserId());
808                    sb.append(", userName=");
809                    sb.append(getUserName());
810                    sb.append(", createDate=");
811                    sb.append(getCreateDate());
812                    sb.append(", modifiedDate=");
813                    sb.append(getModifiedDate());
814                    sb.append(", title=");
815                    sb.append(getTitle());
816                    sb.append(", description=");
817                    sb.append(getDescription());
818                    sb.append(", expirationDate=");
819                    sb.append(getExpirationDate());
820                    sb.append(", lastVoteDate=");
821                    sb.append(getLastVoteDate());
822                    sb.append("}");
823    
824                    return sb.toString();
825            }
826    
827            public String toXmlString() {
828                    StringBundler sb = new StringBundler(40);
829    
830                    sb.append("<model><model-name>");
831                    sb.append("com.liferay.portlet.polls.model.PollsQuestion");
832                    sb.append("</model-name>");
833    
834                    sb.append(
835                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
836                    sb.append(getUuid());
837                    sb.append("]]></column-value></column>");
838                    sb.append(
839                            "<column><column-name>questionId</column-name><column-value><![CDATA[");
840                    sb.append(getQuestionId());
841                    sb.append("]]></column-value></column>");
842                    sb.append(
843                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
844                    sb.append(getGroupId());
845                    sb.append("]]></column-value></column>");
846                    sb.append(
847                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
848                    sb.append(getCompanyId());
849                    sb.append("]]></column-value></column>");
850                    sb.append(
851                            "<column><column-name>userId</column-name><column-value><![CDATA[");
852                    sb.append(getUserId());
853                    sb.append("]]></column-value></column>");
854                    sb.append(
855                            "<column><column-name>userName</column-name><column-value><![CDATA[");
856                    sb.append(getUserName());
857                    sb.append("]]></column-value></column>");
858                    sb.append(
859                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
860                    sb.append(getCreateDate());
861                    sb.append("]]></column-value></column>");
862                    sb.append(
863                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
864                    sb.append(getModifiedDate());
865                    sb.append("]]></column-value></column>");
866                    sb.append(
867                            "<column><column-name>title</column-name><column-value><![CDATA[");
868                    sb.append(getTitle());
869                    sb.append("]]></column-value></column>");
870                    sb.append(
871                            "<column><column-name>description</column-name><column-value><![CDATA[");
872                    sb.append(getDescription());
873                    sb.append("]]></column-value></column>");
874                    sb.append(
875                            "<column><column-name>expirationDate</column-name><column-value><![CDATA[");
876                    sb.append(getExpirationDate());
877                    sb.append("]]></column-value></column>");
878                    sb.append(
879                            "<column><column-name>lastVoteDate</column-name><column-value><![CDATA[");
880                    sb.append(getLastVoteDate());
881                    sb.append("]]></column-value></column>");
882    
883                    sb.append("</model>");
884    
885                    return sb.toString();
886            }
887    
888            private static ClassLoader _classLoader = PollsQuestion.class.getClassLoader();
889            private static Class<?>[] _escapedModelInterfaces = new Class[] {
890                            PollsQuestion.class
891                    };
892            private String _uuid;
893            private String _originalUuid;
894            private long _questionId;
895            private long _groupId;
896            private long _originalGroupId;
897            private boolean _setOriginalGroupId;
898            private long _companyId;
899            private long _userId;
900            private String _userUuid;
901            private String _userName;
902            private Date _createDate;
903            private Date _modifiedDate;
904            private String _title;
905            private String _titleCurrentLanguageId;
906            private String _description;
907            private String _descriptionCurrentLanguageId;
908            private Date _expirationDate;
909            private Date _lastVoteDate;
910            private long _columnBitmask;
911            private PollsQuestion _escapedModel;
912    }