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