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.HashUtil;
020 import com.liferay.portal.kernel.util.StringBundler;
021 import com.liferay.portal.kernel.util.StringPool;
022 import com.liferay.portal.model.CacheModel;
023
024 import com.liferay.portlet.documentlibrary.model.DLFileShortcut;
025
026 import java.io.Externalizable;
027 import java.io.IOException;
028 import java.io.ObjectInput;
029 import java.io.ObjectOutput;
030
031 import java.util.Date;
032
033
040 @ProviderType
041 public class DLFileShortcutCacheModel implements CacheModel<DLFileShortcut>,
042 Externalizable {
043 @Override
044 public boolean equals(Object obj) {
045 if (this == obj) {
046 return true;
047 }
048
049 if (!(obj instanceof DLFileShortcutCacheModel)) {
050 return false;
051 }
052
053 DLFileShortcutCacheModel dlFileShortcutCacheModel = (DLFileShortcutCacheModel)obj;
054
055 if (fileShortcutId == dlFileShortcutCacheModel.fileShortcutId) {
056 return true;
057 }
058
059 return false;
060 }
061
062 @Override
063 public int hashCode() {
064 return HashUtil.hash(0, fileShortcutId);
065 }
066
067 @Override
068 public String toString() {
069 StringBundler sb = new StringBundler(35);
070
071 sb.append("{uuid=");
072 sb.append(uuid);
073 sb.append(", fileShortcutId=");
074 sb.append(fileShortcutId);
075 sb.append(", groupId=");
076 sb.append(groupId);
077 sb.append(", companyId=");
078 sb.append(companyId);
079 sb.append(", userId=");
080 sb.append(userId);
081 sb.append(", userName=");
082 sb.append(userName);
083 sb.append(", createDate=");
084 sb.append(createDate);
085 sb.append(", modifiedDate=");
086 sb.append(modifiedDate);
087 sb.append(", repositoryId=");
088 sb.append(repositoryId);
089 sb.append(", folderId=");
090 sb.append(folderId);
091 sb.append(", toFileEntryId=");
092 sb.append(toFileEntryId);
093 sb.append(", treePath=");
094 sb.append(treePath);
095 sb.append(", active=");
096 sb.append(active);
097 sb.append(", status=");
098 sb.append(status);
099 sb.append(", statusByUserId=");
100 sb.append(statusByUserId);
101 sb.append(", statusByUserName=");
102 sb.append(statusByUserName);
103 sb.append(", statusDate=");
104 sb.append(statusDate);
105 sb.append("}");
106
107 return sb.toString();
108 }
109
110 @Override
111 public DLFileShortcut toEntityModel() {
112 DLFileShortcutImpl dlFileShortcutImpl = new DLFileShortcutImpl();
113
114 if (uuid == null) {
115 dlFileShortcutImpl.setUuid(StringPool.BLANK);
116 }
117 else {
118 dlFileShortcutImpl.setUuid(uuid);
119 }
120
121 dlFileShortcutImpl.setFileShortcutId(fileShortcutId);
122 dlFileShortcutImpl.setGroupId(groupId);
123 dlFileShortcutImpl.setCompanyId(companyId);
124 dlFileShortcutImpl.setUserId(userId);
125
126 if (userName == null) {
127 dlFileShortcutImpl.setUserName(StringPool.BLANK);
128 }
129 else {
130 dlFileShortcutImpl.setUserName(userName);
131 }
132
133 if (createDate == Long.MIN_VALUE) {
134 dlFileShortcutImpl.setCreateDate(null);
135 }
136 else {
137 dlFileShortcutImpl.setCreateDate(new Date(createDate));
138 }
139
140 if (modifiedDate == Long.MIN_VALUE) {
141 dlFileShortcutImpl.setModifiedDate(null);
142 }
143 else {
144 dlFileShortcutImpl.setModifiedDate(new Date(modifiedDate));
145 }
146
147 dlFileShortcutImpl.setRepositoryId(repositoryId);
148 dlFileShortcutImpl.setFolderId(folderId);
149 dlFileShortcutImpl.setToFileEntryId(toFileEntryId);
150
151 if (treePath == null) {
152 dlFileShortcutImpl.setTreePath(StringPool.BLANK);
153 }
154 else {
155 dlFileShortcutImpl.setTreePath(treePath);
156 }
157
158 dlFileShortcutImpl.setActive(active);
159 dlFileShortcutImpl.setStatus(status);
160 dlFileShortcutImpl.setStatusByUserId(statusByUserId);
161
162 if (statusByUserName == null) {
163 dlFileShortcutImpl.setStatusByUserName(StringPool.BLANK);
164 }
165 else {
166 dlFileShortcutImpl.setStatusByUserName(statusByUserName);
167 }
168
169 if (statusDate == Long.MIN_VALUE) {
170 dlFileShortcutImpl.setStatusDate(null);
171 }
172 else {
173 dlFileShortcutImpl.setStatusDate(new Date(statusDate));
174 }
175
176 dlFileShortcutImpl.resetOriginalValues();
177
178 return dlFileShortcutImpl;
179 }
180
181 @Override
182 public void readExternal(ObjectInput objectInput) throws IOException {
183 uuid = objectInput.readUTF();
184 fileShortcutId = objectInput.readLong();
185 groupId = objectInput.readLong();
186 companyId = objectInput.readLong();
187 userId = objectInput.readLong();
188 userName = objectInput.readUTF();
189 createDate = objectInput.readLong();
190 modifiedDate = objectInput.readLong();
191 repositoryId = objectInput.readLong();
192 folderId = objectInput.readLong();
193 toFileEntryId = objectInput.readLong();
194 treePath = objectInput.readUTF();
195 active = objectInput.readBoolean();
196 status = objectInput.readInt();
197 statusByUserId = objectInput.readLong();
198 statusByUserName = objectInput.readUTF();
199 statusDate = objectInput.readLong();
200 }
201
202 @Override
203 public void writeExternal(ObjectOutput objectOutput)
204 throws IOException {
205 if (uuid == null) {
206 objectOutput.writeUTF(StringPool.BLANK);
207 }
208 else {
209 objectOutput.writeUTF(uuid);
210 }
211
212 objectOutput.writeLong(fileShortcutId);
213 objectOutput.writeLong(groupId);
214 objectOutput.writeLong(companyId);
215 objectOutput.writeLong(userId);
216
217 if (userName == null) {
218 objectOutput.writeUTF(StringPool.BLANK);
219 }
220 else {
221 objectOutput.writeUTF(userName);
222 }
223
224 objectOutput.writeLong(createDate);
225 objectOutput.writeLong(modifiedDate);
226 objectOutput.writeLong(repositoryId);
227 objectOutput.writeLong(folderId);
228 objectOutput.writeLong(toFileEntryId);
229
230 if (treePath == null) {
231 objectOutput.writeUTF(StringPool.BLANK);
232 }
233 else {
234 objectOutput.writeUTF(treePath);
235 }
236
237 objectOutput.writeBoolean(active);
238 objectOutput.writeInt(status);
239 objectOutput.writeLong(statusByUserId);
240
241 if (statusByUserName == null) {
242 objectOutput.writeUTF(StringPool.BLANK);
243 }
244 else {
245 objectOutput.writeUTF(statusByUserName);
246 }
247
248 objectOutput.writeLong(statusDate);
249 }
250
251 public String uuid;
252 public long fileShortcutId;
253 public long groupId;
254 public long companyId;
255 public long userId;
256 public String userName;
257 public long createDate;
258 public long modifiedDate;
259 public long repositoryId;
260 public long folderId;
261 public long toFileEntryId;
262 public String treePath;
263 public boolean active;
264 public int status;
265 public long statusByUserId;
266 public String statusByUserName;
267 public long statusDate;
268 }