001
014
015 package com.liferay.portal.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 import com.liferay.portal.model.UserTrackerPath;
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 UserTrackerPathCacheModel implements CacheModel<UserTrackerPath>,
037 Externalizable {
038 @Override
039 public String toString() {
040 StringBundler sb = new StringBundler(9);
041
042 sb.append("{userTrackerPathId=");
043 sb.append(userTrackerPathId);
044 sb.append(", userTrackerId=");
045 sb.append(userTrackerId);
046 sb.append(", path=");
047 sb.append(path);
048 sb.append(", pathDate=");
049 sb.append(pathDate);
050 sb.append("}");
051
052 return sb.toString();
053 }
054
055 public UserTrackerPath toEntityModel() {
056 UserTrackerPathImpl userTrackerPathImpl = new UserTrackerPathImpl();
057
058 userTrackerPathImpl.setUserTrackerPathId(userTrackerPathId);
059 userTrackerPathImpl.setUserTrackerId(userTrackerId);
060
061 if (path == null) {
062 userTrackerPathImpl.setPath(StringPool.BLANK);
063 }
064 else {
065 userTrackerPathImpl.setPath(path);
066 }
067
068 if (pathDate == Long.MIN_VALUE) {
069 userTrackerPathImpl.setPathDate(null);
070 }
071 else {
072 userTrackerPathImpl.setPathDate(new Date(pathDate));
073 }
074
075 userTrackerPathImpl.resetOriginalValues();
076
077 return userTrackerPathImpl;
078 }
079
080 public void readExternal(ObjectInput objectInput) throws IOException {
081 userTrackerPathId = objectInput.readLong();
082 userTrackerId = objectInput.readLong();
083 path = objectInput.readUTF();
084 pathDate = objectInput.readLong();
085 }
086
087 public void writeExternal(ObjectOutput objectOutput)
088 throws IOException {
089 objectOutput.writeLong(userTrackerPathId);
090 objectOutput.writeLong(userTrackerId);
091
092 if (path == null) {
093 objectOutput.writeUTF(StringPool.BLANK);
094 }
095 else {
096 objectOutput.writeUTF(path);
097 }
098
099 objectOutput.writeLong(pathDate);
100 }
101
102 public long userTrackerPathId;
103 public long userTrackerId;
104 public String path;
105 public long pathDate;
106 }