001
014
015 package com.liferay.portlet.documentlibrary.model.impl;
016
017 import com.liferay.portal.kernel.util.StringBundler;
018 import com.liferay.portal.kernel.util.StringPool;
019 import com.liferay.portal.model.CacheModel;
020
021 import com.liferay.portlet.documentlibrary.model.DLFileShortcut;
022
023 import java.io.Externalizable;
024 import java.io.IOException;
025 import java.io.ObjectInput;
026 import java.io.ObjectOutput;
027
028 import java.util.Date;
029
030
037 public class DLFileShortcutCacheModel implements CacheModel<DLFileShortcut>,
038 Externalizable {
039 @Override
040 public String toString() {
041 StringBundler sb = new StringBundler(33);
042
043 sb.append("{uuid=");
044 sb.append(uuid);
045 sb.append(", fileShortcutId=");
046 sb.append(fileShortcutId);
047 sb.append(", groupId=");
048 sb.append(groupId);
049 sb.append(", companyId=");
050 sb.append(companyId);
051 sb.append(", userId=");
052 sb.append(userId);
053 sb.append(", userName=");
054 sb.append(userName);
055 sb.append(", createDate=");
056 sb.append(createDate);
057 sb.append(", modifiedDate=");
058 sb.append(modifiedDate);
059 sb.append(", repositoryId=");
060 sb.append(repositoryId);
061 sb.append(", folderId=");
062 sb.append(folderId);
063 sb.append(", toFileEntryId=");
064 sb.append(toFileEntryId);
065 sb.append(", active=");
066 sb.append(active);
067 sb.append(", status=");
068 sb.append(status);
069 sb.append(", statusByUserId=");
070 sb.append(statusByUserId);
071 sb.append(", statusByUserName=");
072 sb.append(statusByUserName);
073 sb.append(", statusDate=");
074 sb.append(statusDate);
075 sb.append("}");
076
077 return sb.toString();
078 }
079
080 public DLFileShortcut toEntityModel() {
081 DLFileShortcutImpl dlFileShortcutImpl = new DLFileShortcutImpl();
082
083 if (uuid == null) {
084 dlFileShortcutImpl.setUuid(StringPool.BLANK);
085 }
086 else {
087 dlFileShortcutImpl.setUuid(uuid);
088 }
089
090 dlFileShortcutImpl.setFileShortcutId(fileShortcutId);
091 dlFileShortcutImpl.setGroupId(groupId);
092 dlFileShortcutImpl.setCompanyId(companyId);
093 dlFileShortcutImpl.setUserId(userId);
094
095 if (userName == null) {
096 dlFileShortcutImpl.setUserName(StringPool.BLANK);
097 }
098 else {
099 dlFileShortcutImpl.setUserName(userName);
100 }
101
102 if (createDate == Long.MIN_VALUE) {
103 dlFileShortcutImpl.setCreateDate(null);
104 }
105 else {
106 dlFileShortcutImpl.setCreateDate(new Date(createDate));
107 }
108
109 if (modifiedDate == Long.MIN_VALUE) {
110 dlFileShortcutImpl.setModifiedDate(null);
111 }
112 else {
113 dlFileShortcutImpl.setModifiedDate(new Date(modifiedDate));
114 }
115
116 dlFileShortcutImpl.setRepositoryId(repositoryId);
117 dlFileShortcutImpl.setFolderId(folderId);
118 dlFileShortcutImpl.setToFileEntryId(toFileEntryId);
119 dlFileShortcutImpl.setActive(active);
120 dlFileShortcutImpl.setStatus(status);
121 dlFileShortcutImpl.setStatusByUserId(statusByUserId);
122
123 if (statusByUserName == null) {
124 dlFileShortcutImpl.setStatusByUserName(StringPool.BLANK);
125 }
126 else {
127 dlFileShortcutImpl.setStatusByUserName(statusByUserName);
128 }
129
130 if (statusDate == Long.MIN_VALUE) {
131 dlFileShortcutImpl.setStatusDate(null);
132 }
133 else {
134 dlFileShortcutImpl.setStatusDate(new Date(statusDate));
135 }
136
137 dlFileShortcutImpl.resetOriginalValues();
138
139 return dlFileShortcutImpl;
140 }
141
142 public void readExternal(ObjectInput objectInput) throws IOException {
143 uuid = objectInput.readUTF();
144 fileShortcutId = objectInput.readLong();
145 groupId = objectInput.readLong();
146 companyId = objectInput.readLong();
147 userId = objectInput.readLong();
148 userName = objectInput.readUTF();
149 createDate = objectInput.readLong();
150 modifiedDate = objectInput.readLong();
151 repositoryId = objectInput.readLong();
152 folderId = objectInput.readLong();
153 toFileEntryId = objectInput.readLong();
154 active = objectInput.readBoolean();
155 status = objectInput.readInt();
156 statusByUserId = objectInput.readLong();
157 statusByUserName = objectInput.readUTF();
158 statusDate = objectInput.readLong();
159 }
160
161 public void writeExternal(ObjectOutput objectOutput)
162 throws IOException {
163 if (uuid == null) {
164 objectOutput.writeUTF(StringPool.BLANK);
165 }
166 else {
167 objectOutput.writeUTF(uuid);
168 }
169
170 objectOutput.writeLong(fileShortcutId);
171 objectOutput.writeLong(groupId);
172 objectOutput.writeLong(companyId);
173 objectOutput.writeLong(userId);
174
175 if (userName == null) {
176 objectOutput.writeUTF(StringPool.BLANK);
177 }
178 else {
179 objectOutput.writeUTF(userName);
180 }
181
182 objectOutput.writeLong(createDate);
183 objectOutput.writeLong(modifiedDate);
184 objectOutput.writeLong(repositoryId);
185 objectOutput.writeLong(folderId);
186 objectOutput.writeLong(toFileEntryId);
187 objectOutput.writeBoolean(active);
188 objectOutput.writeInt(status);
189 objectOutput.writeLong(statusByUserId);
190
191 if (statusByUserName == null) {
192 objectOutput.writeUTF(StringPool.BLANK);
193 }
194 else {
195 objectOutput.writeUTF(statusByUserName);
196 }
197
198 objectOutput.writeLong(statusDate);
199 }
200
201 public String uuid;
202 public long fileShortcutId;
203 public long groupId;
204 public long companyId;
205 public long userId;
206 public String userName;
207 public long createDate;
208 public long modifiedDate;
209 public long repositoryId;
210 public long folderId;
211 public long toFileEntryId;
212 public boolean active;
213 public int status;
214 public long statusByUserId;
215 public String statusByUserName;
216 public long statusDate;
217 }