001
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.MBCategory;
022
023 import java.io.Serializable;
024
025 import java.util.Date;
026
027
034 public class MBCategoryCacheModel implements CacheModel<MBCategory>,
035 Serializable {
036 @Override
037 public String toString() {
038 StringBundler sb = new StringBundler(31);
039
040 sb.append("{uuid=");
041 sb.append(uuid);
042 sb.append(", categoryId=");
043 sb.append(categoryId);
044 sb.append(", groupId=");
045 sb.append(groupId);
046 sb.append(", companyId=");
047 sb.append(companyId);
048 sb.append(", userId=");
049 sb.append(userId);
050 sb.append(", userName=");
051 sb.append(userName);
052 sb.append(", createDate=");
053 sb.append(createDate);
054 sb.append(", modifiedDate=");
055 sb.append(modifiedDate);
056 sb.append(", parentCategoryId=");
057 sb.append(parentCategoryId);
058 sb.append(", name=");
059 sb.append(name);
060 sb.append(", description=");
061 sb.append(description);
062 sb.append(", displayStyle=");
063 sb.append(displayStyle);
064 sb.append(", threadCount=");
065 sb.append(threadCount);
066 sb.append(", messageCount=");
067 sb.append(messageCount);
068 sb.append(", lastPostDate=");
069 sb.append(lastPostDate);
070 sb.append("}");
071
072 return sb.toString();
073 }
074
075 public MBCategory toEntityModel() {
076 MBCategoryImpl mbCategoryImpl = new MBCategoryImpl();
077
078 if (uuid == null) {
079 mbCategoryImpl.setUuid(StringPool.BLANK);
080 }
081 else {
082 mbCategoryImpl.setUuid(uuid);
083 }
084
085 mbCategoryImpl.setCategoryId(categoryId);
086 mbCategoryImpl.setGroupId(groupId);
087 mbCategoryImpl.setCompanyId(companyId);
088 mbCategoryImpl.setUserId(userId);
089
090 if (userName == null) {
091 mbCategoryImpl.setUserName(StringPool.BLANK);
092 }
093 else {
094 mbCategoryImpl.setUserName(userName);
095 }
096
097 if (createDate == Long.MIN_VALUE) {
098 mbCategoryImpl.setCreateDate(null);
099 }
100 else {
101 mbCategoryImpl.setCreateDate(new Date(createDate));
102 }
103
104 if (modifiedDate == Long.MIN_VALUE) {
105 mbCategoryImpl.setModifiedDate(null);
106 }
107 else {
108 mbCategoryImpl.setModifiedDate(new Date(modifiedDate));
109 }
110
111 mbCategoryImpl.setParentCategoryId(parentCategoryId);
112
113 if (name == null) {
114 mbCategoryImpl.setName(StringPool.BLANK);
115 }
116 else {
117 mbCategoryImpl.setName(name);
118 }
119
120 if (description == null) {
121 mbCategoryImpl.setDescription(StringPool.BLANK);
122 }
123 else {
124 mbCategoryImpl.setDescription(description);
125 }
126
127 if (displayStyle == null) {
128 mbCategoryImpl.setDisplayStyle(StringPool.BLANK);
129 }
130 else {
131 mbCategoryImpl.setDisplayStyle(displayStyle);
132 }
133
134 mbCategoryImpl.setThreadCount(threadCount);
135 mbCategoryImpl.setMessageCount(messageCount);
136
137 if (lastPostDate == Long.MIN_VALUE) {
138 mbCategoryImpl.setLastPostDate(null);
139 }
140 else {
141 mbCategoryImpl.setLastPostDate(new Date(lastPostDate));
142 }
143
144 mbCategoryImpl.resetOriginalValues();
145
146 return mbCategoryImpl;
147 }
148
149 public String uuid;
150 public long categoryId;
151 public long groupId;
152 public long companyId;
153 public long userId;
154 public String userName;
155 public long createDate;
156 public long modifiedDate;
157 public long parentCategoryId;
158 public String name;
159 public String description;
160 public String displayStyle;
161 public int threadCount;
162 public int messageCount;
163 public long lastPostDate;
164 }