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(35);
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(", treePath=");
066 sb.append(treePath);
067 sb.append(", active=");
068 sb.append(active);
069 sb.append(", status=");
070 sb.append(status);
071 sb.append(", statusByUserId=");
072 sb.append(statusByUserId);
073 sb.append(", statusByUserName=");
074 sb.append(statusByUserName);
075 sb.append(", statusDate=");
076 sb.append(statusDate);
077 sb.append("}");
078
079 return sb.toString();
080 }
081
082 @Override
083 public DLFileShortcut toEntityModel() {
084 DLFileShortcutImpl dlFileShortcutImpl = new DLFileShortcutImpl();
085
086 if (uuid == null) {
087 dlFileShortcutImpl.setUuid(StringPool.BLANK);
088 }
089 else {
090 dlFileShortcutImpl.setUuid(uuid);
091 }
092
093 dlFileShortcutImpl.setFileShortcutId(fileShortcutId);
094 dlFileShortcutImpl.setGroupId(groupId);
095 dlFileShortcutImpl.setCompanyId(companyId);
096 dlFileShortcutImpl.setUserId(userId);
097
098 if (userName == null) {
099 dlFileShortcutImpl.setUserName(StringPool.BLANK);
100 }
101 else {
102 dlFileShortcutImpl.setUserName(userName);
103 }
104
105 if (createDate == Long.MIN_VALUE) {
106 dlFileShortcutImpl.setCreateDate(null);
107 }
108 else {
109 dlFileShortcutImpl.setCreateDate(new Date(createDate));
110 }
111
112 if (modifiedDate == Long.MIN_VALUE) {
113 dlFileShortcutImpl.setModifiedDate(null);
114 }
115 else {
116 dlFileShortcutImpl.setModifiedDate(new Date(modifiedDate));
117 }
118
119 dlFileShortcutImpl.setRepositoryId(repositoryId);
120 dlFileShortcutImpl.setFolderId(folderId);
121 dlFileShortcutImpl.setToFileEntryId(toFileEntryId);
122
123 if (treePath == null) {
124 dlFileShortcutImpl.setTreePath(StringPool.BLANK);
125 }
126 else {
127 dlFileShortcutImpl.setTreePath(treePath);
128 }
129
130 dlFileShortcutImpl.setActive(active);
131 dlFileShortcutImpl.setStatus(status);
132 dlFileShortcutImpl.setStatusByUserId(statusByUserId);
133
134 if (statusByUserName == null) {
135 dlFileShortcutImpl.setStatusByUserName(StringPool.BLANK);
136 }
137 else {
138 dlFileShortcutImpl.setStatusByUserName(statusByUserName);
139 }
140
141 if (statusDate == Long.MIN_VALUE) {
142 dlFileShortcutImpl.setStatusDate(null);
143 }
144 else {
145 dlFileShortcutImpl.setStatusDate(new Date(statusDate));
146 }
147
148 dlFileShortcutImpl.resetOriginalValues();
149
150 return dlFileShortcutImpl;
151 }
152
153 @Override
154 public void readExternal(ObjectInput objectInput) throws IOException {
155 uuid = objectInput.readUTF();
156 fileShortcutId = objectInput.readLong();
157 groupId = objectInput.readLong();
158 companyId = objectInput.readLong();
159 userId = objectInput.readLong();
160 userName = objectInput.readUTF();
161 createDate = objectInput.readLong();
162 modifiedDate = objectInput.readLong();
163 repositoryId = objectInput.readLong();
164 folderId = objectInput.readLong();
165 toFileEntryId = objectInput.readLong();
166 treePath = objectInput.readUTF();
167 active = objectInput.readBoolean();
168 status = objectInput.readInt();
169 statusByUserId = objectInput.readLong();
170 statusByUserName = objectInput.readUTF();
171 statusDate = objectInput.readLong();
172 }
173
174 @Override
175 public void writeExternal(ObjectOutput objectOutput)
176 throws IOException {
177 if (uuid == null) {
178 objectOutput.writeUTF(StringPool.BLANK);
179 }
180 else {
181 objectOutput.writeUTF(uuid);
182 }
183
184 objectOutput.writeLong(fileShortcutId);
185 objectOutput.writeLong(groupId);
186 objectOutput.writeLong(companyId);
187 objectOutput.writeLong(userId);
188
189 if (userName == null) {
190 objectOutput.writeUTF(StringPool.BLANK);
191 }
192 else {
193 objectOutput.writeUTF(userName);
194 }
195
196 objectOutput.writeLong(createDate);
197 objectOutput.writeLong(modifiedDate);
198 objectOutput.writeLong(repositoryId);
199 objectOutput.writeLong(folderId);
200 objectOutput.writeLong(toFileEntryId);
201
202 if (treePath == null) {
203 objectOutput.writeUTF(StringPool.BLANK);
204 }
205 else {
206 objectOutput.writeUTF(treePath);
207 }
208
209 objectOutput.writeBoolean(active);
210 objectOutput.writeInt(status);
211 objectOutput.writeLong(statusByUserId);
212
213 if (statusByUserName == null) {
214 objectOutput.writeUTF(StringPool.BLANK);
215 }
216 else {
217 objectOutput.writeUTF(statusByUserName);
218 }
219
220 objectOutput.writeLong(statusDate);
221 }
222
223 public String uuid;
224 public long fileShortcutId;
225 public long groupId;
226 public long companyId;
227 public long userId;
228 public String userName;
229 public long createDate;
230 public long modifiedDate;
231 public long repositoryId;
232 public long folderId;
233 public long toFileEntryId;
234 public String treePath;
235 public boolean active;
236 public int status;
237 public long statusByUserId;
238 public String statusByUserName;
239 public long statusDate;
240 }