001
014
015 package com.liferay.portal.model.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.model.CacheModel;
020 import com.liferay.portal.kernel.model.MVCCModel;
021 import com.liferay.portal.kernel.model.SystemEvent;
022 import com.liferay.portal.kernel.util.HashUtil;
023 import com.liferay.portal.kernel.util.StringBundler;
024 import com.liferay.portal.kernel.util.StringPool;
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 SystemEventCacheModel implements CacheModel<SystemEvent>,
042 Externalizable, MVCCModel {
043 @Override
044 public boolean equals(Object obj) {
045 if (this == obj) {
046 return true;
047 }
048
049 if (!(obj instanceof SystemEventCacheModel)) {
050 return false;
051 }
052
053 SystemEventCacheModel systemEventCacheModel = (SystemEventCacheModel)obj;
054
055 if ((systemEventId == systemEventCacheModel.systemEventId) &&
056 (mvccVersion == systemEventCacheModel.mvccVersion)) {
057 return true;
058 }
059
060 return false;
061 }
062
063 @Override
064 public int hashCode() {
065 int hashCode = HashUtil.hash(0, systemEventId);
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(31);
083
084 sb.append("{mvccVersion=");
085 sb.append(mvccVersion);
086 sb.append(", systemEventId=");
087 sb.append(systemEventId);
088 sb.append(", groupId=");
089 sb.append(groupId);
090 sb.append(", companyId=");
091 sb.append(companyId);
092 sb.append(", userId=");
093 sb.append(userId);
094 sb.append(", userName=");
095 sb.append(userName);
096 sb.append(", createDate=");
097 sb.append(createDate);
098 sb.append(", classNameId=");
099 sb.append(classNameId);
100 sb.append(", classPK=");
101 sb.append(classPK);
102 sb.append(", classUuid=");
103 sb.append(classUuid);
104 sb.append(", referrerClassNameId=");
105 sb.append(referrerClassNameId);
106 sb.append(", parentSystemEventId=");
107 sb.append(parentSystemEventId);
108 sb.append(", systemEventSetKey=");
109 sb.append(systemEventSetKey);
110 sb.append(", type=");
111 sb.append(type);
112 sb.append(", extraData=");
113 sb.append(extraData);
114 sb.append("}");
115
116 return sb.toString();
117 }
118
119 @Override
120 public SystemEvent toEntityModel() {
121 SystemEventImpl systemEventImpl = new SystemEventImpl();
122
123 systemEventImpl.setMvccVersion(mvccVersion);
124 systemEventImpl.setSystemEventId(systemEventId);
125 systemEventImpl.setGroupId(groupId);
126 systemEventImpl.setCompanyId(companyId);
127 systemEventImpl.setUserId(userId);
128
129 if (userName == null) {
130 systemEventImpl.setUserName(StringPool.BLANK);
131 }
132 else {
133 systemEventImpl.setUserName(userName);
134 }
135
136 if (createDate == Long.MIN_VALUE) {
137 systemEventImpl.setCreateDate(null);
138 }
139 else {
140 systemEventImpl.setCreateDate(new Date(createDate));
141 }
142
143 systemEventImpl.setClassNameId(classNameId);
144 systemEventImpl.setClassPK(classPK);
145
146 if (classUuid == null) {
147 systemEventImpl.setClassUuid(StringPool.BLANK);
148 }
149 else {
150 systemEventImpl.setClassUuid(classUuid);
151 }
152
153 systemEventImpl.setReferrerClassNameId(referrerClassNameId);
154 systemEventImpl.setParentSystemEventId(parentSystemEventId);
155 systemEventImpl.setSystemEventSetKey(systemEventSetKey);
156 systemEventImpl.setType(type);
157
158 if (extraData == null) {
159 systemEventImpl.setExtraData(StringPool.BLANK);
160 }
161 else {
162 systemEventImpl.setExtraData(extraData);
163 }
164
165 systemEventImpl.resetOriginalValues();
166
167 return systemEventImpl;
168 }
169
170 @Override
171 public void readExternal(ObjectInput objectInput) throws IOException {
172 mvccVersion = objectInput.readLong();
173
174 systemEventId = objectInput.readLong();
175
176 groupId = objectInput.readLong();
177
178 companyId = objectInput.readLong();
179
180 userId = objectInput.readLong();
181 userName = objectInput.readUTF();
182 createDate = objectInput.readLong();
183
184 classNameId = objectInput.readLong();
185
186 classPK = objectInput.readLong();
187 classUuid = objectInput.readUTF();
188
189 referrerClassNameId = objectInput.readLong();
190
191 parentSystemEventId = objectInput.readLong();
192
193 systemEventSetKey = objectInput.readLong();
194
195 type = objectInput.readInt();
196 extraData = objectInput.readUTF();
197 }
198
199 @Override
200 public void writeExternal(ObjectOutput objectOutput)
201 throws IOException {
202 objectOutput.writeLong(mvccVersion);
203
204 objectOutput.writeLong(systemEventId);
205
206 objectOutput.writeLong(groupId);
207
208 objectOutput.writeLong(companyId);
209
210 objectOutput.writeLong(userId);
211
212 if (userName == null) {
213 objectOutput.writeUTF(StringPool.BLANK);
214 }
215 else {
216 objectOutput.writeUTF(userName);
217 }
218
219 objectOutput.writeLong(createDate);
220
221 objectOutput.writeLong(classNameId);
222
223 objectOutput.writeLong(classPK);
224
225 if (classUuid == null) {
226 objectOutput.writeUTF(StringPool.BLANK);
227 }
228 else {
229 objectOutput.writeUTF(classUuid);
230 }
231
232 objectOutput.writeLong(referrerClassNameId);
233
234 objectOutput.writeLong(parentSystemEventId);
235
236 objectOutput.writeLong(systemEventSetKey);
237
238 objectOutput.writeInt(type);
239
240 if (extraData == null) {
241 objectOutput.writeUTF(StringPool.BLANK);
242 }
243 else {
244 objectOutput.writeUTF(extraData);
245 }
246 }
247
248 public long mvccVersion;
249 public long systemEventId;
250 public long groupId;
251 public long companyId;
252 public long userId;
253 public String userName;
254 public long createDate;
255 public long classNameId;
256 public long classPK;
257 public String classUuid;
258 public long referrerClassNameId;
259 public long parentSystemEventId;
260 public long systemEventSetKey;
261 public int type;
262 public String extraData;
263 }