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.StringBundler;
020 import com.liferay.portal.kernel.util.StringPool;
021 import com.liferay.portal.model.CacheModel;
022
023 import com.liferay.portlet.documentlibrary.model.DLFileVersion;
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 DLFileVersionCacheModel implements CacheModel<DLFileVersion>,
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(", fileVersionId=");
049 sb.append(fileVersionId);
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(", repositoryId=");
063 sb.append(repositoryId);
064 sb.append(", folderId=");
065 sb.append(folderId);
066 sb.append(", fileEntryId=");
067 sb.append(fileEntryId);
068 sb.append(", treePath=");
069 sb.append(treePath);
070 sb.append(", fileName=");
071 sb.append(fileName);
072 sb.append(", extension=");
073 sb.append(extension);
074 sb.append(", mimeType=");
075 sb.append(mimeType);
076 sb.append(", title=");
077 sb.append(title);
078 sb.append(", description=");
079 sb.append(description);
080 sb.append(", changeLog=");
081 sb.append(changeLog);
082 sb.append(", extraSettings=");
083 sb.append(extraSettings);
084 sb.append(", fileEntryTypeId=");
085 sb.append(fileEntryTypeId);
086 sb.append(", version=");
087 sb.append(version);
088 sb.append(", size=");
089 sb.append(size);
090 sb.append(", checksum=");
091 sb.append(checksum);
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 DLFileVersion toEntityModel() {
107 DLFileVersionImpl dlFileVersionImpl = new DLFileVersionImpl();
108
109 if (uuid == null) {
110 dlFileVersionImpl.setUuid(StringPool.BLANK);
111 }
112 else {
113 dlFileVersionImpl.setUuid(uuid);
114 }
115
116 dlFileVersionImpl.setFileVersionId(fileVersionId);
117 dlFileVersionImpl.setGroupId(groupId);
118 dlFileVersionImpl.setCompanyId(companyId);
119 dlFileVersionImpl.setUserId(userId);
120
121 if (userName == null) {
122 dlFileVersionImpl.setUserName(StringPool.BLANK);
123 }
124 else {
125 dlFileVersionImpl.setUserName(userName);
126 }
127
128 if (createDate == Long.MIN_VALUE) {
129 dlFileVersionImpl.setCreateDate(null);
130 }
131 else {
132 dlFileVersionImpl.setCreateDate(new Date(createDate));
133 }
134
135 if (modifiedDate == Long.MIN_VALUE) {
136 dlFileVersionImpl.setModifiedDate(null);
137 }
138 else {
139 dlFileVersionImpl.setModifiedDate(new Date(modifiedDate));
140 }
141
142 dlFileVersionImpl.setRepositoryId(repositoryId);
143 dlFileVersionImpl.setFolderId(folderId);
144 dlFileVersionImpl.setFileEntryId(fileEntryId);
145
146 if (treePath == null) {
147 dlFileVersionImpl.setTreePath(StringPool.BLANK);
148 }
149 else {
150 dlFileVersionImpl.setTreePath(treePath);
151 }
152
153 if (fileName == null) {
154 dlFileVersionImpl.setFileName(StringPool.BLANK);
155 }
156 else {
157 dlFileVersionImpl.setFileName(fileName);
158 }
159
160 if (extension == null) {
161 dlFileVersionImpl.setExtension(StringPool.BLANK);
162 }
163 else {
164 dlFileVersionImpl.setExtension(extension);
165 }
166
167 if (mimeType == null) {
168 dlFileVersionImpl.setMimeType(StringPool.BLANK);
169 }
170 else {
171 dlFileVersionImpl.setMimeType(mimeType);
172 }
173
174 if (title == null) {
175 dlFileVersionImpl.setTitle(StringPool.BLANK);
176 }
177 else {
178 dlFileVersionImpl.setTitle(title);
179 }
180
181 if (description == null) {
182 dlFileVersionImpl.setDescription(StringPool.BLANK);
183 }
184 else {
185 dlFileVersionImpl.setDescription(description);
186 }
187
188 if (changeLog == null) {
189 dlFileVersionImpl.setChangeLog(StringPool.BLANK);
190 }
191 else {
192 dlFileVersionImpl.setChangeLog(changeLog);
193 }
194
195 if (extraSettings == null) {
196 dlFileVersionImpl.setExtraSettings(StringPool.BLANK);
197 }
198 else {
199 dlFileVersionImpl.setExtraSettings(extraSettings);
200 }
201
202 dlFileVersionImpl.setFileEntryTypeId(fileEntryTypeId);
203
204 if (version == null) {
205 dlFileVersionImpl.setVersion(StringPool.BLANK);
206 }
207 else {
208 dlFileVersionImpl.setVersion(version);
209 }
210
211 dlFileVersionImpl.setSize(size);
212
213 if (checksum == null) {
214 dlFileVersionImpl.setChecksum(StringPool.BLANK);
215 }
216 else {
217 dlFileVersionImpl.setChecksum(checksum);
218 }
219
220 dlFileVersionImpl.setStatus(status);
221 dlFileVersionImpl.setStatusByUserId(statusByUserId);
222
223 if (statusByUserName == null) {
224 dlFileVersionImpl.setStatusByUserName(StringPool.BLANK);
225 }
226 else {
227 dlFileVersionImpl.setStatusByUserName(statusByUserName);
228 }
229
230 if (statusDate == Long.MIN_VALUE) {
231 dlFileVersionImpl.setStatusDate(null);
232 }
233 else {
234 dlFileVersionImpl.setStatusDate(new Date(statusDate));
235 }
236
237 dlFileVersionImpl.resetOriginalValues();
238
239 return dlFileVersionImpl;
240 }
241
242 @Override
243 public void readExternal(ObjectInput objectInput) throws IOException {
244 uuid = objectInput.readUTF();
245 fileVersionId = objectInput.readLong();
246 groupId = objectInput.readLong();
247 companyId = objectInput.readLong();
248 userId = objectInput.readLong();
249 userName = objectInput.readUTF();
250 createDate = objectInput.readLong();
251 modifiedDate = objectInput.readLong();
252 repositoryId = objectInput.readLong();
253 folderId = objectInput.readLong();
254 fileEntryId = objectInput.readLong();
255 treePath = objectInput.readUTF();
256 fileName = objectInput.readUTF();
257 extension = objectInput.readUTF();
258 mimeType = objectInput.readUTF();
259 title = objectInput.readUTF();
260 description = objectInput.readUTF();
261 changeLog = objectInput.readUTF();
262 extraSettings = objectInput.readUTF();
263 fileEntryTypeId = objectInput.readLong();
264 version = objectInput.readUTF();
265 size = objectInput.readLong();
266 checksum = objectInput.readUTF();
267 status = objectInput.readInt();
268 statusByUserId = objectInput.readLong();
269 statusByUserName = objectInput.readUTF();
270 statusDate = objectInput.readLong();
271 }
272
273 @Override
274 public void writeExternal(ObjectOutput objectOutput)
275 throws IOException {
276 if (uuid == null) {
277 objectOutput.writeUTF(StringPool.BLANK);
278 }
279 else {
280 objectOutput.writeUTF(uuid);
281 }
282
283 objectOutput.writeLong(fileVersionId);
284 objectOutput.writeLong(groupId);
285 objectOutput.writeLong(companyId);
286 objectOutput.writeLong(userId);
287
288 if (userName == null) {
289 objectOutput.writeUTF(StringPool.BLANK);
290 }
291 else {
292 objectOutput.writeUTF(userName);
293 }
294
295 objectOutput.writeLong(createDate);
296 objectOutput.writeLong(modifiedDate);
297 objectOutput.writeLong(repositoryId);
298 objectOutput.writeLong(folderId);
299 objectOutput.writeLong(fileEntryId);
300
301 if (treePath == null) {
302 objectOutput.writeUTF(StringPool.BLANK);
303 }
304 else {
305 objectOutput.writeUTF(treePath);
306 }
307
308 if (fileName == null) {
309 objectOutput.writeUTF(StringPool.BLANK);
310 }
311 else {
312 objectOutput.writeUTF(fileName);
313 }
314
315 if (extension == null) {
316 objectOutput.writeUTF(StringPool.BLANK);
317 }
318 else {
319 objectOutput.writeUTF(extension);
320 }
321
322 if (mimeType == null) {
323 objectOutput.writeUTF(StringPool.BLANK);
324 }
325 else {
326 objectOutput.writeUTF(mimeType);
327 }
328
329 if (title == null) {
330 objectOutput.writeUTF(StringPool.BLANK);
331 }
332 else {
333 objectOutput.writeUTF(title);
334 }
335
336 if (description == null) {
337 objectOutput.writeUTF(StringPool.BLANK);
338 }
339 else {
340 objectOutput.writeUTF(description);
341 }
342
343 if (changeLog == null) {
344 objectOutput.writeUTF(StringPool.BLANK);
345 }
346 else {
347 objectOutput.writeUTF(changeLog);
348 }
349
350 if (extraSettings == null) {
351 objectOutput.writeUTF(StringPool.BLANK);
352 }
353 else {
354 objectOutput.writeUTF(extraSettings);
355 }
356
357 objectOutput.writeLong(fileEntryTypeId);
358
359 if (version == null) {
360 objectOutput.writeUTF(StringPool.BLANK);
361 }
362 else {
363 objectOutput.writeUTF(version);
364 }
365
366 objectOutput.writeLong(size);
367
368 if (checksum == null) {
369 objectOutput.writeUTF(StringPool.BLANK);
370 }
371 else {
372 objectOutput.writeUTF(checksum);
373 }
374
375 objectOutput.writeInt(status);
376 objectOutput.writeLong(statusByUserId);
377
378 if (statusByUserName == null) {
379 objectOutput.writeUTF(StringPool.BLANK);
380 }
381 else {
382 objectOutput.writeUTF(statusByUserName);
383 }
384
385 objectOutput.writeLong(statusDate);
386 }
387
388 public String uuid;
389 public long fileVersionId;
390 public long groupId;
391 public long companyId;
392 public long userId;
393 public String userName;
394 public long createDate;
395 public long modifiedDate;
396 public long repositoryId;
397 public long folderId;
398 public long fileEntryId;
399 public String treePath;
400 public String fileName;
401 public String extension;
402 public String mimeType;
403 public String title;
404 public String description;
405 public String changeLog;
406 public String extraSettings;
407 public long fileEntryTypeId;
408 public String version;
409 public long size;
410 public String checksum;
411 public int status;
412 public long statusByUserId;
413 public String statusByUserName;
414 public long statusDate;
415 }