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 @Override
056 public UserTrackerPath toEntityModel() {
057 UserTrackerPathImpl userTrackerPathImpl = new UserTrackerPathImpl();
058
059 userTrackerPathImpl.setUserTrackerPathId(userTrackerPathId);
060 userTrackerPathImpl.setUserTrackerId(userTrackerId);
061
062 if (path == null) {
063 userTrackerPathImpl.setPath(StringPool.BLANK);
064 }
065 else {
066 userTrackerPathImpl.setPath(path);
067 }
068
069 if (pathDate == Long.MIN_VALUE) {
070 userTrackerPathImpl.setPathDate(null);
071 }
072 else {
073 userTrackerPathImpl.setPathDate(new Date(pathDate));
074 }
075
076 userTrackerPathImpl.resetOriginalValues();
077
078 return userTrackerPathImpl;
079 }
080
081 @Override
082 public void readExternal(ObjectInput objectInput) throws IOException {
083 userTrackerPathId = objectInput.readLong();
084 userTrackerId = objectInput.readLong();
085 path = objectInput.readUTF();
086 pathDate = objectInput.readLong();
087 }
088
089 @Override
090 public void writeExternal(ObjectOutput objectOutput)
091 throws IOException {
092 objectOutput.writeLong(userTrackerPathId);
093 objectOutput.writeLong(userTrackerId);
094
095 if (path == null) {
096 objectOutput.writeUTF(StringPool.BLANK);
097 }
098 else {
099 objectOutput.writeUTF(path);
100 }
101
102 objectOutput.writeLong(pathDate);
103 }
104
105 public long userTrackerPathId;
106 public long userTrackerId;
107 public String path;
108 public long pathDate;
109 }