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.SystemEvent;
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 SystemEventCacheModel implements CacheModel<SystemEvent>,
037 Externalizable {
038 @Override
039 public String toString() {
040 StringBundler sb = new StringBundler(29);
041
042 sb.append("{systemEventId=");
043 sb.append(systemEventId);
044 sb.append(", groupId=");
045 sb.append(groupId);
046 sb.append(", companyId=");
047 sb.append(companyId);
048 sb.append(", userId=");
049 sb.append(userId);
050 sb.append(", userName=");
051 sb.append(userName);
052 sb.append(", createDate=");
053 sb.append(createDate);
054 sb.append(", classNameId=");
055 sb.append(classNameId);
056 sb.append(", classPK=");
057 sb.append(classPK);
058 sb.append(", classUuid=");
059 sb.append(classUuid);
060 sb.append(", referrerClassNameId=");
061 sb.append(referrerClassNameId);
062 sb.append(", parentSystemEventId=");
063 sb.append(parentSystemEventId);
064 sb.append(", systemEventSetKey=");
065 sb.append(systemEventSetKey);
066 sb.append(", type=");
067 sb.append(type);
068 sb.append(", extraData=");
069 sb.append(extraData);
070 sb.append("}");
071
072 return sb.toString();
073 }
074
075 @Override
076 public SystemEvent toEntityModel() {
077 SystemEventImpl systemEventImpl = new SystemEventImpl();
078
079 systemEventImpl.setSystemEventId(systemEventId);
080 systemEventImpl.setGroupId(groupId);
081 systemEventImpl.setCompanyId(companyId);
082 systemEventImpl.setUserId(userId);
083
084 if (userName == null) {
085 systemEventImpl.setUserName(StringPool.BLANK);
086 }
087 else {
088 systemEventImpl.setUserName(userName);
089 }
090
091 if (createDate == Long.MIN_VALUE) {
092 systemEventImpl.setCreateDate(null);
093 }
094 else {
095 systemEventImpl.setCreateDate(new Date(createDate));
096 }
097
098 systemEventImpl.setClassNameId(classNameId);
099 systemEventImpl.setClassPK(classPK);
100
101 if (classUuid == null) {
102 systemEventImpl.setClassUuid(StringPool.BLANK);
103 }
104 else {
105 systemEventImpl.setClassUuid(classUuid);
106 }
107
108 systemEventImpl.setReferrerClassNameId(referrerClassNameId);
109 systemEventImpl.setParentSystemEventId(parentSystemEventId);
110 systemEventImpl.setSystemEventSetKey(systemEventSetKey);
111 systemEventImpl.setType(type);
112
113 if (extraData == null) {
114 systemEventImpl.setExtraData(StringPool.BLANK);
115 }
116 else {
117 systemEventImpl.setExtraData(extraData);
118 }
119
120 systemEventImpl.resetOriginalValues();
121
122 return systemEventImpl;
123 }
124
125 @Override
126 public void readExternal(ObjectInput objectInput) throws IOException {
127 systemEventId = objectInput.readLong();
128 groupId = objectInput.readLong();
129 companyId = objectInput.readLong();
130 userId = objectInput.readLong();
131 userName = objectInput.readUTF();
132 createDate = objectInput.readLong();
133 classNameId = objectInput.readLong();
134 classPK = objectInput.readLong();
135 classUuid = objectInput.readUTF();
136 referrerClassNameId = objectInput.readLong();
137 parentSystemEventId = objectInput.readLong();
138 systemEventSetKey = objectInput.readLong();
139 type = objectInput.readInt();
140 extraData = objectInput.readUTF();
141 }
142
143 @Override
144 public void writeExternal(ObjectOutput objectOutput)
145 throws IOException {
146 objectOutput.writeLong(systemEventId);
147 objectOutput.writeLong(groupId);
148 objectOutput.writeLong(companyId);
149 objectOutput.writeLong(userId);
150
151 if (userName == null) {
152 objectOutput.writeUTF(StringPool.BLANK);
153 }
154 else {
155 objectOutput.writeUTF(userName);
156 }
157
158 objectOutput.writeLong(createDate);
159 objectOutput.writeLong(classNameId);
160 objectOutput.writeLong(classPK);
161
162 if (classUuid == null) {
163 objectOutput.writeUTF(StringPool.BLANK);
164 }
165 else {
166 objectOutput.writeUTF(classUuid);
167 }
168
169 objectOutput.writeLong(referrerClassNameId);
170 objectOutput.writeLong(parentSystemEventId);
171 objectOutput.writeLong(systemEventSetKey);
172 objectOutput.writeInt(type);
173
174 if (extraData == null) {
175 objectOutput.writeUTF(StringPool.BLANK);
176 }
177 else {
178 objectOutput.writeUTF(extraData);
179 }
180 }
181
182 public long systemEventId;
183 public long groupId;
184 public long companyId;
185 public long userId;
186 public String userName;
187 public long createDate;
188 public long classNameId;
189 public long classPK;
190 public String classUuid;
191 public long referrerClassNameId;
192 public long parentSystemEventId;
193 public long systemEventSetKey;
194 public int type;
195 public String extraData;
196 }