001
014
015 package com.liferay.portal.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 import com.liferay.portal.model.MVCCModel;
024 import com.liferay.portal.model.UserTrackerPath;
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 UserTrackerPathCacheModel implements CacheModel<UserTrackerPath>,
042 Externalizable, MVCCModel {
043 @Override
044 public boolean equals(Object obj) {
045 if (this == obj) {
046 return true;
047 }
048
049 if (!(obj instanceof UserTrackerPathCacheModel)) {
050 return false;
051 }
052
053 UserTrackerPathCacheModel userTrackerPathCacheModel = (UserTrackerPathCacheModel)obj;
054
055 if ((userTrackerPathId == userTrackerPathCacheModel.userTrackerPathId) &&
056 (mvccVersion == userTrackerPathCacheModel.mvccVersion)) {
057 return true;
058 }
059
060 return false;
061 }
062
063 @Override
064 public int hashCode() {
065 int hashCode = HashUtil.hash(0, userTrackerPathId);
066
067 return HashUtil.hash(hashCode, mvccVersion);
068 }
069
070 @Override
071 public long getMvccVersion() {
072 return mvccVersion;
073 }
074
075 @Override
076 public void setMvccVersion(long mvccVersion) {
077 this.mvccVersion = mvccVersion;
078 }
079
080 @Override
081 public String toString() {
082 StringBundler sb = new StringBundler(11);
083
084 sb.append("{mvccVersion=");
085 sb.append(mvccVersion);
086 sb.append(", userTrackerPathId=");
087 sb.append(userTrackerPathId);
088 sb.append(", userTrackerId=");
089 sb.append(userTrackerId);
090 sb.append(", path=");
091 sb.append(path);
092 sb.append(", pathDate=");
093 sb.append(pathDate);
094 sb.append("}");
095
096 return sb.toString();
097 }
098
099 @Override
100 public UserTrackerPath toEntityModel() {
101 UserTrackerPathImpl userTrackerPathImpl = new UserTrackerPathImpl();
102
103 userTrackerPathImpl.setMvccVersion(mvccVersion);
104 userTrackerPathImpl.setUserTrackerPathId(userTrackerPathId);
105 userTrackerPathImpl.setUserTrackerId(userTrackerId);
106
107 if (path == null) {
108 userTrackerPathImpl.setPath(StringPool.BLANK);
109 }
110 else {
111 userTrackerPathImpl.setPath(path);
112 }
113
114 if (pathDate == Long.MIN_VALUE) {
115 userTrackerPathImpl.setPathDate(null);
116 }
117 else {
118 userTrackerPathImpl.setPathDate(new Date(pathDate));
119 }
120
121 userTrackerPathImpl.resetOriginalValues();
122
123 return userTrackerPathImpl;
124 }
125
126 @Override
127 public void readExternal(ObjectInput objectInput) throws IOException {
128 mvccVersion = objectInput.readLong();
129 userTrackerPathId = objectInput.readLong();
130 userTrackerId = objectInput.readLong();
131 path = objectInput.readUTF();
132 pathDate = objectInput.readLong();
133 }
134
135 @Override
136 public void writeExternal(ObjectOutput objectOutput)
137 throws IOException {
138 objectOutput.writeLong(mvccVersion);
139 objectOutput.writeLong(userTrackerPathId);
140 objectOutput.writeLong(userTrackerId);
141
142 if (path == null) {
143 objectOutput.writeUTF(StringPool.BLANK);
144 }
145 else {
146 objectOutput.writeUTF(path);
147 }
148
149 objectOutput.writeLong(pathDate);
150 }
151
152 public long mvccVersion;
153 public long userTrackerPathId;
154 public long userTrackerId;
155 public String path;
156 public long pathDate;
157 }