001
014
015 package com.liferay.portlet.documentlibrary.model.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.util.HashUtil;
020 import com.liferay.portal.kernel.util.StringBundler;
021 import com.liferay.portal.kernel.util.StringPool;
022 import com.liferay.portal.model.CacheModel;
023
024 import com.liferay.portlet.documentlibrary.model.DLFileEntry;
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(59);
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("}");
130
131 return sb.toString();
132 }
133
134 @Override
135 public DLFileEntry toEntityModel() {
136 DLFileEntryImpl dlFileEntryImpl = new DLFileEntryImpl();
137
138 if (uuid == null) {
139 dlFileEntryImpl.setUuid(StringPool.BLANK);
140 }
141 else {
142 dlFileEntryImpl.setUuid(uuid);
143 }
144
145 dlFileEntryImpl.setFileEntryId(fileEntryId);
146 dlFileEntryImpl.setGroupId(groupId);
147 dlFileEntryImpl.setCompanyId(companyId);
148 dlFileEntryImpl.setUserId(userId);
149
150 if (userName == null) {
151 dlFileEntryImpl.setUserName(StringPool.BLANK);
152 }
153 else {
154 dlFileEntryImpl.setUserName(userName);
155 }
156
157 if (createDate == Long.MIN_VALUE) {
158 dlFileEntryImpl.setCreateDate(null);
159 }
160 else {
161 dlFileEntryImpl.setCreateDate(new Date(createDate));
162 }
163
164 if (modifiedDate == Long.MIN_VALUE) {
165 dlFileEntryImpl.setModifiedDate(null);
166 }
167 else {
168 dlFileEntryImpl.setModifiedDate(new Date(modifiedDate));
169 }
170
171 dlFileEntryImpl.setClassNameId(classNameId);
172 dlFileEntryImpl.setClassPK(classPK);
173 dlFileEntryImpl.setRepositoryId(repositoryId);
174 dlFileEntryImpl.setFolderId(folderId);
175
176 if (treePath == null) {
177 dlFileEntryImpl.setTreePath(StringPool.BLANK);
178 }
179 else {
180 dlFileEntryImpl.setTreePath(treePath);
181 }
182
183 if (name == null) {
184 dlFileEntryImpl.setName(StringPool.BLANK);
185 }
186 else {
187 dlFileEntryImpl.setName(name);
188 }
189
190 if (fileName == null) {
191 dlFileEntryImpl.setFileName(StringPool.BLANK);
192 }
193 else {
194 dlFileEntryImpl.setFileName(fileName);
195 }
196
197 if (extension == null) {
198 dlFileEntryImpl.setExtension(StringPool.BLANK);
199 }
200 else {
201 dlFileEntryImpl.setExtension(extension);
202 }
203
204 if (mimeType == null) {
205 dlFileEntryImpl.setMimeType(StringPool.BLANK);
206 }
207 else {
208 dlFileEntryImpl.setMimeType(mimeType);
209 }
210
211 if (title == null) {
212 dlFileEntryImpl.setTitle(StringPool.BLANK);
213 }
214 else {
215 dlFileEntryImpl.setTitle(title);
216 }
217
218 if (description == null) {
219 dlFileEntryImpl.setDescription(StringPool.BLANK);
220 }
221 else {
222 dlFileEntryImpl.setDescription(description);
223 }
224
225 if (extraSettings == null) {
226 dlFileEntryImpl.setExtraSettings(StringPool.BLANK);
227 }
228 else {
229 dlFileEntryImpl.setExtraSettings(extraSettings);
230 }
231
232 dlFileEntryImpl.setFileEntryTypeId(fileEntryTypeId);
233
234 if (version == null) {
235 dlFileEntryImpl.setVersion(StringPool.BLANK);
236 }
237 else {
238 dlFileEntryImpl.setVersion(version);
239 }
240
241 dlFileEntryImpl.setSize(size);
242 dlFileEntryImpl.setReadCount(readCount);
243 dlFileEntryImpl.setSmallImageId(smallImageId);
244 dlFileEntryImpl.setLargeImageId(largeImageId);
245 dlFileEntryImpl.setCustom1ImageId(custom1ImageId);
246 dlFileEntryImpl.setCustom2ImageId(custom2ImageId);
247 dlFileEntryImpl.setManualCheckInRequired(manualCheckInRequired);
248
249 dlFileEntryImpl.resetOriginalValues();
250
251 return dlFileEntryImpl;
252 }
253
254 @Override
255 public void readExternal(ObjectInput objectInput) throws IOException {
256 uuid = objectInput.readUTF();
257 fileEntryId = objectInput.readLong();
258 groupId = objectInput.readLong();
259 companyId = objectInput.readLong();
260 userId = objectInput.readLong();
261 userName = objectInput.readUTF();
262 createDate = objectInput.readLong();
263 modifiedDate = objectInput.readLong();
264 classNameId = objectInput.readLong();
265 classPK = objectInput.readLong();
266 repositoryId = objectInput.readLong();
267 folderId = objectInput.readLong();
268 treePath = objectInput.readUTF();
269 name = objectInput.readUTF();
270 fileName = objectInput.readUTF();
271 extension = objectInput.readUTF();
272 mimeType = objectInput.readUTF();
273 title = objectInput.readUTF();
274 description = objectInput.readUTF();
275 extraSettings = objectInput.readUTF();
276 fileEntryTypeId = objectInput.readLong();
277 version = objectInput.readUTF();
278 size = objectInput.readLong();
279 readCount = objectInput.readInt();
280 smallImageId = objectInput.readLong();
281 largeImageId = objectInput.readLong();
282 custom1ImageId = objectInput.readLong();
283 custom2ImageId = objectInput.readLong();
284 manualCheckInRequired = objectInput.readBoolean();
285 }
286
287 @Override
288 public void writeExternal(ObjectOutput objectOutput)
289 throws IOException {
290 if (uuid == null) {
291 objectOutput.writeUTF(StringPool.BLANK);
292 }
293 else {
294 objectOutput.writeUTF(uuid);
295 }
296
297 objectOutput.writeLong(fileEntryId);
298 objectOutput.writeLong(groupId);
299 objectOutput.writeLong(companyId);
300 objectOutput.writeLong(userId);
301
302 if (userName == null) {
303 objectOutput.writeUTF(StringPool.BLANK);
304 }
305 else {
306 objectOutput.writeUTF(userName);
307 }
308
309 objectOutput.writeLong(createDate);
310 objectOutput.writeLong(modifiedDate);
311 objectOutput.writeLong(classNameId);
312 objectOutput.writeLong(classPK);
313 objectOutput.writeLong(repositoryId);
314 objectOutput.writeLong(folderId);
315
316 if (treePath == null) {
317 objectOutput.writeUTF(StringPool.BLANK);
318 }
319 else {
320 objectOutput.writeUTF(treePath);
321 }
322
323 if (name == null) {
324 objectOutput.writeUTF(StringPool.BLANK);
325 }
326 else {
327 objectOutput.writeUTF(name);
328 }
329
330 if (fileName == null) {
331 objectOutput.writeUTF(StringPool.BLANK);
332 }
333 else {
334 objectOutput.writeUTF(fileName);
335 }
336
337 if (extension == null) {
338 objectOutput.writeUTF(StringPool.BLANK);
339 }
340 else {
341 objectOutput.writeUTF(extension);
342 }
343
344 if (mimeType == null) {
345 objectOutput.writeUTF(StringPool.BLANK);
346 }
347 else {
348 objectOutput.writeUTF(mimeType);
349 }
350
351 if (title == null) {
352 objectOutput.writeUTF(StringPool.BLANK);
353 }
354 else {
355 objectOutput.writeUTF(title);
356 }
357
358 if (description == null) {
359 objectOutput.writeUTF(StringPool.BLANK);
360 }
361 else {
362 objectOutput.writeUTF(description);
363 }
364
365 if (extraSettings == null) {
366 objectOutput.writeUTF(StringPool.BLANK);
367 }
368 else {
369 objectOutput.writeUTF(extraSettings);
370 }
371
372 objectOutput.writeLong(fileEntryTypeId);
373
374 if (version == null) {
375 objectOutput.writeUTF(StringPool.BLANK);
376 }
377 else {
378 objectOutput.writeUTF(version);
379 }
380
381 objectOutput.writeLong(size);
382 objectOutput.writeInt(readCount);
383 objectOutput.writeLong(smallImageId);
384 objectOutput.writeLong(largeImageId);
385 objectOutput.writeLong(custom1ImageId);
386 objectOutput.writeLong(custom2ImageId);
387 objectOutput.writeBoolean(manualCheckInRequired);
388 }
389
390 public String uuid;
391 public long fileEntryId;
392 public long groupId;
393 public long companyId;
394 public long userId;
395 public String userName;
396 public long createDate;
397 public long modifiedDate;
398 public long classNameId;
399 public long classPK;
400 public long repositoryId;
401 public long folderId;
402 public String treePath;
403 public String name;
404 public String fileName;
405 public String extension;
406 public String mimeType;
407 public String title;
408 public String description;
409 public String extraSettings;
410 public long fileEntryTypeId;
411 public String version;
412 public long size;
413 public int readCount;
414 public long smallImageId;
415 public long largeImageId;
416 public long custom1ImageId;
417 public long custom2ImageId;
418 public boolean manualCheckInRequired;
419 }