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