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.kernel.util.StringBundler;
018    import com.liferay.portal.kernel.util.StringPool;
019    import com.liferay.portal.model.CacheModel;
020    
021    import com.liferay.portlet.polls.model.PollsChoice;
022    
023    import java.io.Serializable;
024    
025    /**
026     * The cache model class for representing PollsChoice in entity cache.
027     *
028     * @author Brian Wing Shun Chan
029     * @see PollsChoice
030     * @generated
031     */
032    public class PollsChoiceCacheModel implements CacheModel<PollsChoice>,
033            Serializable {
034            @Override
035            public String toString() {
036                    StringBundler sb = new StringBundler(11);
037    
038                    sb.append("{uuid=");
039                    sb.append(uuid);
040                    sb.append(", choiceId=");
041                    sb.append(choiceId);
042                    sb.append(", questionId=");
043                    sb.append(questionId);
044                    sb.append(", name=");
045                    sb.append(name);
046                    sb.append(", description=");
047                    sb.append(description);
048                    sb.append("}");
049    
050                    return sb.toString();
051            }
052    
053            public PollsChoice toEntityModel() {
054                    PollsChoiceImpl pollsChoiceImpl = new PollsChoiceImpl();
055    
056                    if (uuid == null) {
057                            pollsChoiceImpl.setUuid(StringPool.BLANK);
058                    }
059                    else {
060                            pollsChoiceImpl.setUuid(uuid);
061                    }
062    
063                    pollsChoiceImpl.setChoiceId(choiceId);
064                    pollsChoiceImpl.setQuestionId(questionId);
065    
066                    if (name == null) {
067                            pollsChoiceImpl.setName(StringPool.BLANK);
068                    }
069                    else {
070                            pollsChoiceImpl.setName(name);
071                    }
072    
073                    if (description == null) {
074                            pollsChoiceImpl.setDescription(StringPool.BLANK);
075                    }
076                    else {
077                            pollsChoiceImpl.setDescription(description);
078                    }
079    
080                    pollsChoiceImpl.resetOriginalValues();
081    
082                    return pollsChoiceImpl;
083            }
084    
085            public String uuid;
086            public long choiceId;
087            public long questionId;
088            public String name;
089            public String description;
090    }