001    /**
002     * Copyright (c) 2000-2012 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    
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                    _columnBitmask |= COMPANYID_COLUMN_BITMASK;
340    
341                    if (!_setOriginalCompanyId) {
342                            _setOriginalCompanyId = true;
343    
344                            _originalCompanyId = _companyId;
345                    }
346    
347                    _companyId = companyId;
348            }
349    
350            public long getOriginalCompanyId() {
351                    return _originalCompanyId;
352            }
353    
354            @JSON
355            public long getUserId() {
356                    return _userId;
357            }
358    
359            public void setUserId(long userId) {
360                    _userId = userId;
361            }
362    
363            public String getUserUuid() throws SystemException {
364                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
365            }
366    
367            public void setUserUuid(String userUuid) {
368                    _userUuid = userUuid;
369            }
370    
371            @JSON
372            public String getUserName() {
373                    if (_userName == null) {
374                            return StringPool.BLANK;
375                    }
376                    else {
377                            return _userName;
378                    }
379            }
380    
381            public void setUserName(String userName) {
382                    _userName = userName;
383            }
384    
385            @JSON
386            public Date getCreateDate() {
387                    return _createDate;
388            }
389    
390            public void setCreateDate(Date createDate) {
391                    _columnBitmask = -1L;
392    
393                    _createDate = createDate;
394            }
395    
396            @JSON
397            public Date getModifiedDate() {
398                    return _modifiedDate;
399            }
400    
401            public void setModifiedDate(Date modifiedDate) {
402                    _modifiedDate = modifiedDate;
403            }
404    
405            @JSON
406            public String getTitle() {
407                    if (_title == null) {
408                            return StringPool.BLANK;
409                    }
410                    else {
411                            return _title;
412                    }
413            }
414    
415            public String getTitle(Locale locale) {
416                    String languageId = LocaleUtil.toLanguageId(locale);
417    
418                    return getTitle(languageId);
419            }
420    
421            public String getTitle(Locale locale, boolean useDefault) {
422                    String languageId = LocaleUtil.toLanguageId(locale);
423    
424                    return getTitle(languageId, useDefault);
425            }
426    
427            public String getTitle(String languageId) {
428                    return LocalizationUtil.getLocalization(getTitle(), languageId);
429            }
430    
431            public String getTitle(String languageId, boolean useDefault) {
432                    return LocalizationUtil.getLocalization(getTitle(), languageId,
433                            useDefault);
434            }
435    
436            public String getTitleCurrentLanguageId() {
437                    return _titleCurrentLanguageId;
438            }
439    
440            @JSON
441            public String getTitleCurrentValue() {
442                    Locale locale = getLocale(_titleCurrentLanguageId);
443    
444                    return getTitle(locale);
445            }
446    
447            public Map<Locale, String> getTitleMap() {
448                    return LocalizationUtil.getLocalizationMap(getTitle());
449            }
450    
451            public void setTitle(String title) {
452                    _title = title;
453            }
454    
455            public void setTitle(String title, Locale locale) {
456                    setTitle(title, locale, LocaleUtil.getDefault());
457            }
458    
459            public void setTitle(String title, Locale locale, Locale defaultLocale) {
460                    String languageId = LocaleUtil.toLanguageId(locale);
461                    String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
462    
463                    if (Validator.isNotNull(title)) {
464                            setTitle(LocalizationUtil.updateLocalization(getTitle(), "Title",
465                                            title, languageId, defaultLanguageId));
466                    }
467                    else {
468                            setTitle(LocalizationUtil.removeLocalization(getTitle(), "Title",
469                                            languageId));
470                    }
471            }
472    
473            public void setTitleCurrentLanguageId(String languageId) {
474                    _titleCurrentLanguageId = languageId;
475            }
476    
477            public void setTitleMap(Map<Locale, String> titleMap) {
478                    setTitleMap(titleMap, LocaleUtil.getDefault());
479            }
480    
481            public void setTitleMap(Map<Locale, String> titleMap, Locale defaultLocale) {
482                    if (titleMap == null) {
483                            return;
484                    }
485    
486                    setTitle(LocalizationUtil.updateLocalization(titleMap, getTitle(),
487                                    "Title", LocaleUtil.toLanguageId(defaultLocale)));
488            }
489    
490            @JSON
491            public String getDescription() {
492                    if (_description == null) {
493                            return StringPool.BLANK;
494                    }
495                    else {
496                            return _description;
497                    }
498            }
499    
500            public String getDescription(Locale locale) {
501                    String languageId = LocaleUtil.toLanguageId(locale);
502    
503                    return getDescription(languageId);
504            }
505    
506            public String getDescription(Locale locale, boolean useDefault) {
507                    String languageId = LocaleUtil.toLanguageId(locale);
508    
509                    return getDescription(languageId, useDefault);
510            }
511    
512            public String getDescription(String languageId) {
513                    return LocalizationUtil.getLocalization(getDescription(), languageId);
514            }
515    
516            public String getDescription(String languageId, boolean useDefault) {
517                    return LocalizationUtil.getLocalization(getDescription(), languageId,
518                            useDefault);
519            }
520    
521            public String getDescriptionCurrentLanguageId() {
522                    return _descriptionCurrentLanguageId;
523            }
524    
525            @JSON
526            public String getDescriptionCurrentValue() {
527                    Locale locale = getLocale(_descriptionCurrentLanguageId);
528    
529                    return getDescription(locale);
530            }
531    
532            public Map<Locale, String> getDescriptionMap() {
533                    return LocalizationUtil.getLocalizationMap(getDescription());
534            }
535    
536            public void setDescription(String description) {
537                    _description = description;
538            }
539    
540            public void setDescription(String description, Locale locale) {
541                    setDescription(description, locale, LocaleUtil.getDefault());
542            }
543    
544            public void setDescription(String description, Locale locale,
545                    Locale defaultLocale) {
546                    String languageId = LocaleUtil.toLanguageId(locale);
547                    String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
548    
549                    if (Validator.isNotNull(description)) {
550                            setDescription(LocalizationUtil.updateLocalization(
551                                            getDescription(), "Description", description, languageId,
552                                            defaultLanguageId));
553                    }
554                    else {
555                            setDescription(LocalizationUtil.removeLocalization(
556                                            getDescription(), "Description", languageId));
557                    }
558            }
559    
560            public void setDescriptionCurrentLanguageId(String languageId) {
561                    _descriptionCurrentLanguageId = languageId;
562            }
563    
564            public void setDescriptionMap(Map<Locale, String> descriptionMap) {
565                    setDescriptionMap(descriptionMap, LocaleUtil.getDefault());
566            }
567    
568            public void setDescriptionMap(Map<Locale, String> descriptionMap,
569                    Locale defaultLocale) {
570                    if (descriptionMap == null) {
571                            return;
572                    }
573    
574                    setDescription(LocalizationUtil.updateLocalization(descriptionMap,
575                                    getDescription(), "Description",
576                                    LocaleUtil.toLanguageId(defaultLocale)));
577            }
578    
579            @JSON
580            public Date getExpirationDate() {
581                    return _expirationDate;
582            }
583    
584            public void setExpirationDate(Date expirationDate) {
585                    _expirationDate = expirationDate;
586            }
587    
588            @JSON
589            public Date getLastVoteDate() {
590                    return _lastVoteDate;
591            }
592    
593            public void setLastVoteDate(Date lastVoteDate) {
594                    _lastVoteDate = lastVoteDate;
595            }
596    
597            public long getColumnBitmask() {
598                    return _columnBitmask;
599            }
600    
601            @Override
602            public ExpandoBridge getExpandoBridge() {
603                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
604                            PollsQuestion.class.getName(), getPrimaryKey());
605            }
606    
607            @Override
608            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
609                    ExpandoBridge expandoBridge = getExpandoBridge();
610    
611                    expandoBridge.setAttributes(serviceContext);
612            }
613    
614            @SuppressWarnings("unused")
615            public void prepareLocalizedFieldsForImport(Locale defaultImportLocale)
616                    throws LocaleException {
617                    setTitle(getTitle(defaultImportLocale), defaultImportLocale,
618                            defaultImportLocale);
619                    setDescription(getDescription(defaultImportLocale),
620                            defaultImportLocale, defaultImportLocale);
621            }
622    
623            @Override
624            public PollsQuestion toEscapedModel() {
625                    if (_escapedModelProxy == null) {
626                            _escapedModelProxy = (PollsQuestion)ProxyUtil.newProxyInstance(_classLoader,
627                                            _escapedModelProxyInterfaces,
628                                            new AutoEscapeBeanHandler(this));
629                    }
630    
631                    return _escapedModelProxy;
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<?>[] _escapedModelProxyInterfaces = 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 _escapedModelProxy;
921    }