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.messageboards.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.messageboards.model.MBThread;
022    
023    import java.io.Serializable;
024    
025    import java.util.Date;
026    
027    /**
028     * The cache model class for representing MBThread in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see MBThread
032     * @generated
033     */
034    public class MBThreadCacheModel implements CacheModel<MBThread>, Serializable {
035            @Override
036            public String toString() {
037                    StringBundler sb = new StringBundler(33);
038    
039                    sb.append("{threadId=");
040                    sb.append(threadId);
041                    sb.append(", groupId=");
042                    sb.append(groupId);
043                    sb.append(", companyId=");
044                    sb.append(companyId);
045                    sb.append(", categoryId=");
046                    sb.append(categoryId);
047                    sb.append(", rootMessageId=");
048                    sb.append(rootMessageId);
049                    sb.append(", rootMessageUserId=");
050                    sb.append(rootMessageUserId);
051                    sb.append(", messageCount=");
052                    sb.append(messageCount);
053                    sb.append(", viewCount=");
054                    sb.append(viewCount);
055                    sb.append(", lastPostByUserId=");
056                    sb.append(lastPostByUserId);
057                    sb.append(", lastPostDate=");
058                    sb.append(lastPostDate);
059                    sb.append(", priority=");
060                    sb.append(priority);
061                    sb.append(", question=");
062                    sb.append(question);
063                    sb.append(", status=");
064                    sb.append(status);
065                    sb.append(", statusByUserId=");
066                    sb.append(statusByUserId);
067                    sb.append(", statusByUserName=");
068                    sb.append(statusByUserName);
069                    sb.append(", statusDate=");
070                    sb.append(statusDate);
071                    sb.append("}");
072    
073                    return sb.toString();
074            }
075    
076            public MBThread toEntityModel() {
077                    MBThreadImpl mbThreadImpl = new MBThreadImpl();
078    
079                    mbThreadImpl.setThreadId(threadId);
080                    mbThreadImpl.setGroupId(groupId);
081                    mbThreadImpl.setCompanyId(companyId);
082                    mbThreadImpl.setCategoryId(categoryId);
083                    mbThreadImpl.setRootMessageId(rootMessageId);
084                    mbThreadImpl.setRootMessageUserId(rootMessageUserId);
085                    mbThreadImpl.setMessageCount(messageCount);
086                    mbThreadImpl.setViewCount(viewCount);
087                    mbThreadImpl.setLastPostByUserId(lastPostByUserId);
088    
089                    if (lastPostDate == Long.MIN_VALUE) {
090                            mbThreadImpl.setLastPostDate(null);
091                    }
092                    else {
093                            mbThreadImpl.setLastPostDate(new Date(lastPostDate));
094                    }
095    
096                    mbThreadImpl.setPriority(priority);
097                    mbThreadImpl.setQuestion(question);
098                    mbThreadImpl.setStatus(status);
099                    mbThreadImpl.setStatusByUserId(statusByUserId);
100    
101                    if (statusByUserName == null) {
102                            mbThreadImpl.setStatusByUserName(StringPool.BLANK);
103                    }
104                    else {
105                            mbThreadImpl.setStatusByUserName(statusByUserName);
106                    }
107    
108                    if (statusDate == Long.MIN_VALUE) {
109                            mbThreadImpl.setStatusDate(null);
110                    }
111                    else {
112                            mbThreadImpl.setStatusDate(new Date(statusDate));
113                    }
114    
115                    mbThreadImpl.resetOriginalValues();
116    
117                    return mbThreadImpl;
118            }
119    
120            public long threadId;
121            public long groupId;
122            public long companyId;
123            public long categoryId;
124            public long rootMessageId;
125            public long rootMessageUserId;
126            public int messageCount;
127            public int viewCount;
128            public long lastPostByUserId;
129            public long lastPostDate;
130            public double priority;
131            public boolean question;
132            public int status;
133            public long statusByUserId;
134            public String statusByUserName;
135            public long statusDate;
136    }