001
014
015 package com.liferay.portal.model.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.util.StringBundler;
020 import com.liferay.portal.kernel.util.StringPool;
021 import com.liferay.portal.model.CacheModel;
022 import com.liferay.portal.model.MVCCModel;
023 import com.liferay.portal.model.SystemEvent;
024
025 import java.io.Externalizable;
026 import java.io.IOException;
027 import java.io.ObjectInput;
028 import java.io.ObjectOutput;
029
030 import java.util.Date;
031
032
039 @ProviderType
040 public class SystemEventCacheModel implements CacheModel<SystemEvent>,
041 Externalizable, MVCCModel {
042 @Override
043 public long getMvccVersion() {
044 return mvccVersion;
045 }
046
047 @Override
048 public void setMvccVersion(long mvccVersion) {
049 this.mvccVersion = mvccVersion;
050 }
051
052 @Override
053 public String toString() {
054 StringBundler sb = new StringBundler(31);
055
056 sb.append("{mvccVersion=");
057 sb.append(mvccVersion);
058 sb.append(", systemEventId=");
059 sb.append(systemEventId);
060 sb.append(", groupId=");
061 sb.append(groupId);
062 sb.append(", companyId=");
063 sb.append(companyId);
064 sb.append(", userId=");
065 sb.append(userId);
066 sb.append(", userName=");
067 sb.append(userName);
068 sb.append(", createDate=");
069 sb.append(createDate);
070 sb.append(", classNameId=");
071 sb.append(classNameId);
072 sb.append(", classPK=");
073 sb.append(classPK);
074 sb.append(", classUuid=");
075 sb.append(classUuid);
076 sb.append(", referrerClassNameId=");
077 sb.append(referrerClassNameId);
078 sb.append(", parentSystemEventId=");
079 sb.append(parentSystemEventId);
080 sb.append(", systemEventSetKey=");
081 sb.append(systemEventSetKey);
082 sb.append(", type=");
083 sb.append(type);
084 sb.append(", extraData=");
085 sb.append(extraData);
086 sb.append("}");
087
088 return sb.toString();
089 }
090
091 @Override
092 public SystemEvent toEntityModel() {
093 SystemEventImpl systemEventImpl = new SystemEventImpl();
094
095 systemEventImpl.setMvccVersion(mvccVersion);
096 systemEventImpl.setSystemEventId(systemEventId);
097 systemEventImpl.setGroupId(groupId);
098 systemEventImpl.setCompanyId(companyId);
099 systemEventImpl.setUserId(userId);
100
101 if (userName == null) {
102 systemEventImpl.setUserName(StringPool.BLANK);
103 }
104 else {
105 systemEventImpl.setUserName(userName);
106 }
107
108 if (createDate == Long.MIN_VALUE) {
109 systemEventImpl.setCreateDate(null);
110 }
111 else {
112 systemEventImpl.setCreateDate(new Date(createDate));
113 }
114
115 systemEventImpl.setClassNameId(classNameId);
116 systemEventImpl.setClassPK(classPK);
117
118 if (classUuid == null) {
119 systemEventImpl.setClassUuid(StringPool.BLANK);
120 }
121 else {
122 systemEventImpl.setClassUuid(classUuid);
123 }
124
125 systemEventImpl.setReferrerClassNameId(referrerClassNameId);
126 systemEventImpl.setParentSystemEventId(parentSystemEventId);
127 systemEventImpl.setSystemEventSetKey(systemEventSetKey);
128 systemEventImpl.setType(type);
129
130 if (extraData == null) {
131 systemEventImpl.setExtraData(StringPool.BLANK);
132 }
133 else {
134 systemEventImpl.setExtraData(extraData);
135 }
136
137 systemEventImpl.resetOriginalValues();
138
139 return systemEventImpl;
140 }
141
142 @Override
143 public void readExternal(ObjectInput objectInput) throws IOException {
144 mvccVersion = objectInput.readLong();
145 systemEventId = objectInput.readLong();
146 groupId = objectInput.readLong();
147 companyId = objectInput.readLong();
148 userId = objectInput.readLong();
149 userName = objectInput.readUTF();
150 createDate = objectInput.readLong();
151 classNameId = objectInput.readLong();
152 classPK = objectInput.readLong();
153 classUuid = objectInput.readUTF();
154 referrerClassNameId = objectInput.readLong();
155 parentSystemEventId = objectInput.readLong();
156 systemEventSetKey = objectInput.readLong();
157 type = objectInput.readInt();
158 extraData = objectInput.readUTF();
159 }
160
161 @Override
162 public void writeExternal(ObjectOutput objectOutput)
163 throws IOException {
164 objectOutput.writeLong(mvccVersion);
165 objectOutput.writeLong(systemEventId);
166 objectOutput.writeLong(groupId);
167 objectOutput.writeLong(companyId);
168 objectOutput.writeLong(userId);
169
170 if (userName == null) {
171 objectOutput.writeUTF(StringPool.BLANK);
172 }
173 else {
174 objectOutput.writeUTF(userName);
175 }
176
177 objectOutput.writeLong(createDate);
178 objectOutput.writeLong(classNameId);
179 objectOutput.writeLong(classPK);
180
181 if (classUuid == null) {
182 objectOutput.writeUTF(StringPool.BLANK);
183 }
184 else {
185 objectOutput.writeUTF(classUuid);
186 }
187
188 objectOutput.writeLong(referrerClassNameId);
189 objectOutput.writeLong(parentSystemEventId);
190 objectOutput.writeLong(systemEventSetKey);
191 objectOutput.writeInt(type);
192
193 if (extraData == null) {
194 objectOutput.writeUTF(StringPool.BLANK);
195 }
196 else {
197 objectOutput.writeUTF(extraData);
198 }
199 }
200
201 public long mvccVersion;
202 public long systemEventId;
203 public long groupId;
204 public long companyId;
205 public long userId;
206 public String userName;
207 public long createDate;
208 public long classNameId;
209 public long classPK;
210 public String classUuid;
211 public long referrerClassNameId;
212 public long parentSystemEventId;
213 public long systemEventSetKey;
214 public int type;
215 public String extraData;
216 }