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