001
014
015 package com.liferay.portlet.documentlibrary.model.impl;
016
017 import com.liferay.portal.kernel.util.StringBundler;
018 import com.liferay.portal.model.CacheModel;
019
020 import com.liferay.portlet.documentlibrary.model.DLFileRank;
021
022 import java.io.Externalizable;
023 import java.io.IOException;
024 import java.io.ObjectInput;
025 import java.io.ObjectOutput;
026
027 import java.util.Date;
028
029
036 public class DLFileRankCacheModel implements CacheModel<DLFileRank>,
037 Externalizable {
038 @Override
039 public String toString() {
040 StringBundler sb = new StringBundler(15);
041
042 sb.append("{fileRankId=");
043 sb.append(fileRankId);
044 sb.append(", groupId=");
045 sb.append(groupId);
046 sb.append(", companyId=");
047 sb.append(companyId);
048 sb.append(", userId=");
049 sb.append(userId);
050 sb.append(", createDate=");
051 sb.append(createDate);
052 sb.append(", fileEntryId=");
053 sb.append(fileEntryId);
054 sb.append(", active=");
055 sb.append(active);
056 sb.append("}");
057
058 return sb.toString();
059 }
060
061 @Override
062 public DLFileRank toEntityModel() {
063 DLFileRankImpl dlFileRankImpl = new DLFileRankImpl();
064
065 dlFileRankImpl.setFileRankId(fileRankId);
066 dlFileRankImpl.setGroupId(groupId);
067 dlFileRankImpl.setCompanyId(companyId);
068 dlFileRankImpl.setUserId(userId);
069
070 if (createDate == Long.MIN_VALUE) {
071 dlFileRankImpl.setCreateDate(null);
072 }
073 else {
074 dlFileRankImpl.setCreateDate(new Date(createDate));
075 }
076
077 dlFileRankImpl.setFileEntryId(fileEntryId);
078 dlFileRankImpl.setActive(active);
079
080 dlFileRankImpl.resetOriginalValues();
081
082 return dlFileRankImpl;
083 }
084
085 @Override
086 public void readExternal(ObjectInput objectInput) throws IOException {
087 fileRankId = objectInput.readLong();
088 groupId = objectInput.readLong();
089 companyId = objectInput.readLong();
090 userId = objectInput.readLong();
091 createDate = objectInput.readLong();
092 fileEntryId = objectInput.readLong();
093 active = objectInput.readBoolean();
094 }
095
096 @Override
097 public void writeExternal(ObjectOutput objectOutput)
098 throws IOException {
099 objectOutput.writeLong(fileRankId);
100 objectOutput.writeLong(groupId);
101 objectOutput.writeLong(companyId);
102 objectOutput.writeLong(userId);
103 objectOutput.writeLong(createDate);
104 objectOutput.writeLong(fileEntryId);
105 objectOutput.writeBoolean(active);
106 }
107
108 public long fileRankId;
109 public long groupId;
110 public long companyId;
111 public long userId;
112 public long createDate;
113 public long fileEntryId;
114 public boolean active;
115 }