001
014
015 package com.liferay.portlet.blogs.model.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.util.StringBundler;
020 import com.liferay.portal.kernel.util.StringPool;
021 import com.liferay.portal.model.CacheModel;
022
023 import com.liferay.portlet.blogs.model.BlogsEntry;
024
025 import java.io.Externalizable;
026 import java.io.IOException;
027 import java.io.ObjectInput;
028 import java.io.ObjectOutput;
029
030 import java.util.Date;
031
032
039 @ProviderType
040 public class BlogsEntryCacheModel implements CacheModel<BlogsEntry>,
041 Externalizable {
042 @Override
043 public String toString() {
044 StringBundler sb = new StringBundler(55);
045
046 sb.append("{uuid=");
047 sb.append(uuid);
048 sb.append(", entryId=");
049 sb.append(entryId);
050 sb.append(", groupId=");
051 sb.append(groupId);
052 sb.append(", companyId=");
053 sb.append(companyId);
054 sb.append(", userId=");
055 sb.append(userId);
056 sb.append(", userName=");
057 sb.append(userName);
058 sb.append(", createDate=");
059 sb.append(createDate);
060 sb.append(", modifiedDate=");
061 sb.append(modifiedDate);
062 sb.append(", title=");
063 sb.append(title);
064 sb.append(", subtitle=");
065 sb.append(subtitle);
066 sb.append(", urlTitle=");
067 sb.append(urlTitle);
068 sb.append(", description=");
069 sb.append(description);
070 sb.append(", content=");
071 sb.append(content);
072 sb.append(", displayDate=");
073 sb.append(displayDate);
074 sb.append(", allowPingbacks=");
075 sb.append(allowPingbacks);
076 sb.append(", allowTrackbacks=");
077 sb.append(allowTrackbacks);
078 sb.append(", trackbacks=");
079 sb.append(trackbacks);
080 sb.append(", coverImageFileEntryId=");
081 sb.append(coverImageFileEntryId);
082 sb.append(", coverImageURL=");
083 sb.append(coverImageURL);
084 sb.append(", smallImage=");
085 sb.append(smallImage);
086 sb.append(", smallImageFileEntryId=");
087 sb.append(smallImageFileEntryId);
088 sb.append(", smallImageId=");
089 sb.append(smallImageId);
090 sb.append(", smallImageURL=");
091 sb.append(smallImageURL);
092 sb.append(", status=");
093 sb.append(status);
094 sb.append(", statusByUserId=");
095 sb.append(statusByUserId);
096 sb.append(", statusByUserName=");
097 sb.append(statusByUserName);
098 sb.append(", statusDate=");
099 sb.append(statusDate);
100 sb.append("}");
101
102 return sb.toString();
103 }
104
105 @Override
106 public BlogsEntry toEntityModel() {
107 BlogsEntryImpl blogsEntryImpl = new BlogsEntryImpl();
108
109 if (uuid == null) {
110 blogsEntryImpl.setUuid(StringPool.BLANK);
111 }
112 else {
113 blogsEntryImpl.setUuid(uuid);
114 }
115
116 blogsEntryImpl.setEntryId(entryId);
117 blogsEntryImpl.setGroupId(groupId);
118 blogsEntryImpl.setCompanyId(companyId);
119 blogsEntryImpl.setUserId(userId);
120
121 if (userName == null) {
122 blogsEntryImpl.setUserName(StringPool.BLANK);
123 }
124 else {
125 blogsEntryImpl.setUserName(userName);
126 }
127
128 if (createDate == Long.MIN_VALUE) {
129 blogsEntryImpl.setCreateDate(null);
130 }
131 else {
132 blogsEntryImpl.setCreateDate(new Date(createDate));
133 }
134
135 if (modifiedDate == Long.MIN_VALUE) {
136 blogsEntryImpl.setModifiedDate(null);
137 }
138 else {
139 blogsEntryImpl.setModifiedDate(new Date(modifiedDate));
140 }
141
142 if (title == null) {
143 blogsEntryImpl.setTitle(StringPool.BLANK);
144 }
145 else {
146 blogsEntryImpl.setTitle(title);
147 }
148
149 if (subtitle == null) {
150 blogsEntryImpl.setSubtitle(StringPool.BLANK);
151 }
152 else {
153 blogsEntryImpl.setSubtitle(subtitle);
154 }
155
156 if (urlTitle == null) {
157 blogsEntryImpl.setUrlTitle(StringPool.BLANK);
158 }
159 else {
160 blogsEntryImpl.setUrlTitle(urlTitle);
161 }
162
163 if (description == null) {
164 blogsEntryImpl.setDescription(StringPool.BLANK);
165 }
166 else {
167 blogsEntryImpl.setDescription(description);
168 }
169
170 if (content == null) {
171 blogsEntryImpl.setContent(StringPool.BLANK);
172 }
173 else {
174 blogsEntryImpl.setContent(content);
175 }
176
177 if (displayDate == Long.MIN_VALUE) {
178 blogsEntryImpl.setDisplayDate(null);
179 }
180 else {
181 blogsEntryImpl.setDisplayDate(new Date(displayDate));
182 }
183
184 blogsEntryImpl.setAllowPingbacks(allowPingbacks);
185 blogsEntryImpl.setAllowTrackbacks(allowTrackbacks);
186
187 if (trackbacks == null) {
188 blogsEntryImpl.setTrackbacks(StringPool.BLANK);
189 }
190 else {
191 blogsEntryImpl.setTrackbacks(trackbacks);
192 }
193
194 blogsEntryImpl.setCoverImageFileEntryId(coverImageFileEntryId);
195
196 if (coverImageURL == null) {
197 blogsEntryImpl.setCoverImageURL(StringPool.BLANK);
198 }
199 else {
200 blogsEntryImpl.setCoverImageURL(coverImageURL);
201 }
202
203 blogsEntryImpl.setSmallImage(smallImage);
204 blogsEntryImpl.setSmallImageFileEntryId(smallImageFileEntryId);
205 blogsEntryImpl.setSmallImageId(smallImageId);
206
207 if (smallImageURL == null) {
208 blogsEntryImpl.setSmallImageURL(StringPool.BLANK);
209 }
210 else {
211 blogsEntryImpl.setSmallImageURL(smallImageURL);
212 }
213
214 blogsEntryImpl.setStatus(status);
215 blogsEntryImpl.setStatusByUserId(statusByUserId);
216
217 if (statusByUserName == null) {
218 blogsEntryImpl.setStatusByUserName(StringPool.BLANK);
219 }
220 else {
221 blogsEntryImpl.setStatusByUserName(statusByUserName);
222 }
223
224 if (statusDate == Long.MIN_VALUE) {
225 blogsEntryImpl.setStatusDate(null);
226 }
227 else {
228 blogsEntryImpl.setStatusDate(new Date(statusDate));
229 }
230
231 blogsEntryImpl.resetOriginalValues();
232
233 return blogsEntryImpl;
234 }
235
236 @Override
237 public void readExternal(ObjectInput objectInput) throws IOException {
238 uuid = objectInput.readUTF();
239 entryId = objectInput.readLong();
240 groupId = objectInput.readLong();
241 companyId = objectInput.readLong();
242 userId = objectInput.readLong();
243 userName = objectInput.readUTF();
244 createDate = objectInput.readLong();
245 modifiedDate = objectInput.readLong();
246 title = objectInput.readUTF();
247 subtitle = objectInput.readUTF();
248 urlTitle = objectInput.readUTF();
249 description = objectInput.readUTF();
250 content = objectInput.readUTF();
251 displayDate = objectInput.readLong();
252 allowPingbacks = objectInput.readBoolean();
253 allowTrackbacks = objectInput.readBoolean();
254 trackbacks = objectInput.readUTF();
255 coverImageFileEntryId = objectInput.readLong();
256 coverImageURL = objectInput.readUTF();
257 smallImage = objectInput.readBoolean();
258 smallImageFileEntryId = objectInput.readLong();
259 smallImageId = objectInput.readLong();
260 smallImageURL = objectInput.readUTF();
261 status = objectInput.readInt();
262 statusByUserId = objectInput.readLong();
263 statusByUserName = objectInput.readUTF();
264 statusDate = objectInput.readLong();
265 }
266
267 @Override
268 public void writeExternal(ObjectOutput objectOutput)
269 throws IOException {
270 if (uuid == null) {
271 objectOutput.writeUTF(StringPool.BLANK);
272 }
273 else {
274 objectOutput.writeUTF(uuid);
275 }
276
277 objectOutput.writeLong(entryId);
278 objectOutput.writeLong(groupId);
279 objectOutput.writeLong(companyId);
280 objectOutput.writeLong(userId);
281
282 if (userName == null) {
283 objectOutput.writeUTF(StringPool.BLANK);
284 }
285 else {
286 objectOutput.writeUTF(userName);
287 }
288
289 objectOutput.writeLong(createDate);
290 objectOutput.writeLong(modifiedDate);
291
292 if (title == null) {
293 objectOutput.writeUTF(StringPool.BLANK);
294 }
295 else {
296 objectOutput.writeUTF(title);
297 }
298
299 if (subtitle == null) {
300 objectOutput.writeUTF(StringPool.BLANK);
301 }
302 else {
303 objectOutput.writeUTF(subtitle);
304 }
305
306 if (urlTitle == null) {
307 objectOutput.writeUTF(StringPool.BLANK);
308 }
309 else {
310 objectOutput.writeUTF(urlTitle);
311 }
312
313 if (description == null) {
314 objectOutput.writeUTF(StringPool.BLANK);
315 }
316 else {
317 objectOutput.writeUTF(description);
318 }
319
320 if (content == null) {
321 objectOutput.writeUTF(StringPool.BLANK);
322 }
323 else {
324 objectOutput.writeUTF(content);
325 }
326
327 objectOutput.writeLong(displayDate);
328 objectOutput.writeBoolean(allowPingbacks);
329 objectOutput.writeBoolean(allowTrackbacks);
330
331 if (trackbacks == null) {
332 objectOutput.writeUTF(StringPool.BLANK);
333 }
334 else {
335 objectOutput.writeUTF(trackbacks);
336 }
337
338 objectOutput.writeLong(coverImageFileEntryId);
339
340 if (coverImageURL == null) {
341 objectOutput.writeUTF(StringPool.BLANK);
342 }
343 else {
344 objectOutput.writeUTF(coverImageURL);
345 }
346
347 objectOutput.writeBoolean(smallImage);
348 objectOutput.writeLong(smallImageFileEntryId);
349 objectOutput.writeLong(smallImageId);
350
351 if (smallImageURL == null) {
352 objectOutput.writeUTF(StringPool.BLANK);
353 }
354 else {
355 objectOutput.writeUTF(smallImageURL);
356 }
357
358 objectOutput.writeInt(status);
359 objectOutput.writeLong(statusByUserId);
360
361 if (statusByUserName == null) {
362 objectOutput.writeUTF(StringPool.BLANK);
363 }
364 else {
365 objectOutput.writeUTF(statusByUserName);
366 }
367
368 objectOutput.writeLong(statusDate);
369 }
370
371 public String uuid;
372 public long entryId;
373 public long groupId;
374 public long companyId;
375 public long userId;
376 public String userName;
377 public long createDate;
378 public long modifiedDate;
379 public String title;
380 public String subtitle;
381 public String urlTitle;
382 public String description;
383 public String content;
384 public long displayDate;
385 public boolean allowPingbacks;
386 public boolean allowTrackbacks;
387 public String trackbacks;
388 public long coverImageFileEntryId;
389 public String coverImageURL;
390 public boolean smallImage;
391 public long smallImageFileEntryId;
392 public long smallImageId;
393 public String smallImageURL;
394 public int status;
395 public long statusByUserId;
396 public String statusByUserName;
397 public long statusDate;
398 }