001
014
015 package com.liferay.portlet.documentlibrary.model.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.document.library.kernel.model.DLFileEntry;
020
021 import com.liferay.portal.kernel.model.CacheModel;
022 import com.liferay.portal.kernel.util.HashUtil;
023 import com.liferay.portal.kernel.util.StringBundler;
024 import com.liferay.portal.kernel.util.StringPool;
025
026 import java.io.Externalizable;
027 import java.io.IOException;
028 import java.io.ObjectInput;
029 import java.io.ObjectOutput;
030
031 import java.util.Date;
032
033
040 @ProviderType
041 public class DLFileEntryCacheModel implements CacheModel<DLFileEntry>,
042 Externalizable {
043 @Override
044 public boolean equals(Object obj) {
045 if (this == obj) {
046 return true;
047 }
048
049 if (!(obj instanceof DLFileEntryCacheModel)) {
050 return false;
051 }
052
053 DLFileEntryCacheModel dlFileEntryCacheModel = (DLFileEntryCacheModel)obj;
054
055 if (fileEntryId == dlFileEntryCacheModel.fileEntryId) {
056 return true;
057 }
058
059 return false;
060 }
061
062 @Override
063 public int hashCode() {
064 return HashUtil.hash(0, fileEntryId);
065 }
066
067 @Override
068 public String toString() {
069 StringBundler sb = new StringBundler(61);
070
071 sb.append("{uuid=");
072 sb.append(uuid);
073 sb.append(", fileEntryId=");
074 sb.append(fileEntryId);
075 sb.append(", groupId=");
076 sb.append(groupId);
077 sb.append(", companyId=");
078 sb.append(companyId);
079 sb.append(", userId=");
080 sb.append(userId);
081 sb.append(", userName=");
082 sb.append(userName);
083 sb.append(", createDate=");
084 sb.append(createDate);
085 sb.append(", modifiedDate=");
086 sb.append(modifiedDate);
087 sb.append(", classNameId=");
088 sb.append(classNameId);
089 sb.append(", classPK=");
090 sb.append(classPK);
091 sb.append(", repositoryId=");
092 sb.append(repositoryId);
093 sb.append(", folderId=");
094 sb.append(folderId);
095 sb.append(", treePath=");
096 sb.append(treePath);
097 sb.append(", name=");
098 sb.append(name);
099 sb.append(", fileName=");
100 sb.append(fileName);
101 sb.append(", extension=");
102 sb.append(extension);
103 sb.append(", mimeType=");
104 sb.append(mimeType);
105 sb.append(", title=");
106 sb.append(title);
107 sb.append(", description=");
108 sb.append(description);
109 sb.append(", extraSettings=");
110 sb.append(extraSettings);
111 sb.append(", fileEntryTypeId=");
112 sb.append(fileEntryTypeId);
113 sb.append(", version=");
114 sb.append(version);
115 sb.append(", size=");
116 sb.append(size);
117 sb.append(", readCount=");
118 sb.append(readCount);
119 sb.append(", smallImageId=");
120 sb.append(smallImageId);
121 sb.append(", largeImageId=");
122 sb.append(largeImageId);
123 sb.append(", custom1ImageId=");
124 sb.append(custom1ImageId);
125 sb.append(", custom2ImageId=");
126 sb.append(custom2ImageId);
127 sb.append(", manualCheckInRequired=");
128 sb.append(manualCheckInRequired);
129 sb.append(", lastPublishDate=");
130 sb.append(lastPublishDate);
131 sb.append("}");
132
133 return sb.toString();
134 }
135
136 @Override
137 public DLFileEntry toEntityModel() {
138 DLFileEntryImpl dlFileEntryImpl = new DLFileEntryImpl();
139
140 if (uuid == null) {
141 dlFileEntryImpl.setUuid(StringPool.BLANK);
142 }
143 else {
144 dlFileEntryImpl.setUuid(uuid);
145 }
146
147 dlFileEntryImpl.setFileEntryId(fileEntryId);
148 dlFileEntryImpl.setGroupId(groupId);
149 dlFileEntryImpl.setCompanyId(companyId);
150 dlFileEntryImpl.setUserId(userId);
151
152 if (userName == null) {
153 dlFileEntryImpl.setUserName(StringPool.BLANK);
154 }
155 else {
156 dlFileEntryImpl.setUserName(userName);
157 }
158
159 if (createDate == Long.MIN_VALUE) {
160 dlFileEntryImpl.setCreateDate(null);
161 }
162 else {
163 dlFileEntryImpl.setCreateDate(new Date(createDate));
164 }
165
166 if (modifiedDate == Long.MIN_VALUE) {
167 dlFileEntryImpl.setModifiedDate(null);
168 }
169 else {
170 dlFileEntryImpl.setModifiedDate(new Date(modifiedDate));
171 }
172
173 dlFileEntryImpl.setClassNameId(classNameId);
174 dlFileEntryImpl.setClassPK(classPK);
175 dlFileEntryImpl.setRepositoryId(repositoryId);
176 dlFileEntryImpl.setFolderId(folderId);
177
178 if (treePath == null) {
179 dlFileEntryImpl.setTreePath(StringPool.BLANK);
180 }
181 else {
182 dlFileEntryImpl.setTreePath(treePath);
183 }
184
185 if (name == null) {
186 dlFileEntryImpl.setName(StringPool.BLANK);
187 }
188 else {
189 dlFileEntryImpl.setName(name);
190 }
191
192 if (fileName == null) {
193 dlFileEntryImpl.setFileName(StringPool.BLANK);
194 }
195 else {
196 dlFileEntryImpl.setFileName(fileName);
197 }
198
199 if (extension == null) {
200 dlFileEntryImpl.setExtension(StringPool.BLANK);
201 }
202 else {
203 dlFileEntryImpl.setExtension(extension);
204 }
205
206 if (mimeType == null) {
207 dlFileEntryImpl.setMimeType(StringPool.BLANK);
208 }
209 else {
210 dlFileEntryImpl.setMimeType(mimeType);
211 }
212
213 if (title == null) {
214 dlFileEntryImpl.setTitle(StringPool.BLANK);
215 }
216 else {
217 dlFileEntryImpl.setTitle(title);
218 }
219
220 if (description == null) {
221 dlFileEntryImpl.setDescription(StringPool.BLANK);
222 }
223 else {
224 dlFileEntryImpl.setDescription(description);
225 }
226
227 if (extraSettings == null) {
228 dlFileEntryImpl.setExtraSettings(StringPool.BLANK);
229 }
230 else {
231 dlFileEntryImpl.setExtraSettings(extraSettings);
232 }
233
234 dlFileEntryImpl.setFileEntryTypeId(fileEntryTypeId);
235
236 if (version == null) {
237 dlFileEntryImpl.setVersion(StringPool.BLANK);
238 }
239 else {
240 dlFileEntryImpl.setVersion(version);
241 }
242
243 dlFileEntryImpl.setSize(size);
244 dlFileEntryImpl.setReadCount(readCount);
245 dlFileEntryImpl.setSmallImageId(smallImageId);
246 dlFileEntryImpl.setLargeImageId(largeImageId);
247 dlFileEntryImpl.setCustom1ImageId(custom1ImageId);
248 dlFileEntryImpl.setCustom2ImageId(custom2ImageId);
249 dlFileEntryImpl.setManualCheckInRequired(manualCheckInRequired);
250
251 if (lastPublishDate == Long.MIN_VALUE) {
252 dlFileEntryImpl.setLastPublishDate(null);
253 }
254 else {
255 dlFileEntryImpl.setLastPublishDate(new Date(lastPublishDate));
256 }
257
258 dlFileEntryImpl.resetOriginalValues();
259
260 return dlFileEntryImpl;
261 }
262
263 @Override
264 public void readExternal(ObjectInput objectInput) throws IOException {
265 uuid = objectInput.readUTF();
266
267 fileEntryId = objectInput.readLong();
268
269 groupId = objectInput.readLong();
270
271 companyId = objectInput.readLong();
272
273 userId = objectInput.readLong();
274 userName = objectInput.readUTF();
275 createDate = objectInput.readLong();
276 modifiedDate = objectInput.readLong();
277
278 classNameId = objectInput.readLong();
279
280 classPK = objectInput.readLong();
281
282 repositoryId = objectInput.readLong();
283
284 folderId = objectInput.readLong();
285 treePath = objectInput.readUTF();
286 name = objectInput.readUTF();
287 fileName = objectInput.readUTF();
288 extension = objectInput.readUTF();
289 mimeType = objectInput.readUTF();
290 title = objectInput.readUTF();
291 description = objectInput.readUTF();
292 extraSettings = objectInput.readUTF();
293
294 fileEntryTypeId = objectInput.readLong();
295 version = objectInput.readUTF();
296
297 size = objectInput.readLong();
298
299 readCount = objectInput.readInt();
300
301 smallImageId = objectInput.readLong();
302
303 largeImageId = objectInput.readLong();
304
305 custom1ImageId = objectInput.readLong();
306
307 custom2ImageId = objectInput.readLong();
308
309 manualCheckInRequired = objectInput.readBoolean();
310 lastPublishDate = objectInput.readLong();
311 }
312
313 @Override
314 public void writeExternal(ObjectOutput objectOutput)
315 throws IOException {
316 if (uuid == null) {
317 objectOutput.writeUTF(StringPool.BLANK);
318 }
319 else {
320 objectOutput.writeUTF(uuid);
321 }
322
323 objectOutput.writeLong(fileEntryId);
324
325 objectOutput.writeLong(groupId);
326
327 objectOutput.writeLong(companyId);
328
329 objectOutput.writeLong(userId);
330
331 if (userName == null) {
332 objectOutput.writeUTF(StringPool.BLANK);
333 }
334 else {
335 objectOutput.writeUTF(userName);
336 }
337
338 objectOutput.writeLong(createDate);
339 objectOutput.writeLong(modifiedDate);
340
341 objectOutput.writeLong(classNameId);
342
343 objectOutput.writeLong(classPK);
344
345 objectOutput.writeLong(repositoryId);
346
347 objectOutput.writeLong(folderId);
348
349 if (treePath == null) {
350 objectOutput.writeUTF(StringPool.BLANK);
351 }
352 else {
353 objectOutput.writeUTF(treePath);
354 }
355
356 if (name == null) {
357 objectOutput.writeUTF(StringPool.BLANK);
358 }
359 else {
360 objectOutput.writeUTF(name);
361 }
362
363 if (fileName == null) {
364 objectOutput.writeUTF(StringPool.BLANK);
365 }
366 else {
367 objectOutput.writeUTF(fileName);
368 }
369
370 if (extension == null) {
371 objectOutput.writeUTF(StringPool.BLANK);
372 }
373 else {
374 objectOutput.writeUTF(extension);
375 }
376
377 if (mimeType == null) {
378 objectOutput.writeUTF(StringPool.BLANK);
379 }
380 else {
381 objectOutput.writeUTF(mimeType);
382 }
383
384 if (title == null) {
385 objectOutput.writeUTF(StringPool.BLANK);
386 }
387 else {
388 objectOutput.writeUTF(title);
389 }
390
391 if (description == null) {
392 objectOutput.writeUTF(StringPool.BLANK);
393 }
394 else {
395 objectOutput.writeUTF(description);
396 }
397
398 if (extraSettings == null) {
399 objectOutput.writeUTF(StringPool.BLANK);
400 }
401 else {
402 objectOutput.writeUTF(extraSettings);
403 }
404
405 objectOutput.writeLong(fileEntryTypeId);
406
407 if (version == null) {
408 objectOutput.writeUTF(StringPool.BLANK);
409 }
410 else {
411 objectOutput.writeUTF(version);
412 }
413
414 objectOutput.writeLong(size);
415
416 objectOutput.writeInt(readCount);
417
418 objectOutput.writeLong(smallImageId);
419
420 objectOutput.writeLong(largeImageId);
421
422 objectOutput.writeLong(custom1ImageId);
423
424 objectOutput.writeLong(custom2ImageId);
425
426 objectOutput.writeBoolean(manualCheckInRequired);
427 objectOutput.writeLong(lastPublishDate);
428 }
429
430 public String uuid;
431 public long fileEntryId;
432 public long groupId;
433 public long companyId;
434 public long userId;
435 public String userName;
436 public long createDate;
437 public long modifiedDate;
438 public long classNameId;
439 public long classPK;
440 public long repositoryId;
441 public long folderId;
442 public String treePath;
443 public String name;
444 public String fileName;
445 public String extension;
446 public String mimeType;
447 public String title;
448 public String description;
449 public String extraSettings;
450 public long fileEntryTypeId;
451 public String version;
452 public long size;
453 public int readCount;
454 public long smallImageId;
455 public long largeImageId;
456 public long custom1ImageId;
457 public long custom2ImageId;
458 public boolean manualCheckInRequired;
459 public long lastPublishDate;
460 }