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.UserNotificationEvent;
021
022 import java.io.Externalizable;
023 import java.io.IOException;
024 import java.io.ObjectInput;
025 import java.io.ObjectOutput;
026
027
034 public class UserNotificationEventCacheModel implements CacheModel<UserNotificationEvent>,
035 Externalizable {
036 @Override
037 public String toString() {
038 StringBundler sb = new StringBundler(21);
039
040 sb.append("{uuid=");
041 sb.append(uuid);
042 sb.append(", userNotificationEventId=");
043 sb.append(userNotificationEventId);
044 sb.append(", companyId=");
045 sb.append(companyId);
046 sb.append(", userId=");
047 sb.append(userId);
048 sb.append(", type=");
049 sb.append(type);
050 sb.append(", timestamp=");
051 sb.append(timestamp);
052 sb.append(", deliverBy=");
053 sb.append(deliverBy);
054 sb.append(", delivered=");
055 sb.append(delivered);
056 sb.append(", payload=");
057 sb.append(payload);
058 sb.append(", archived=");
059 sb.append(archived);
060 sb.append("}");
061
062 return sb.toString();
063 }
064
065 @Override
066 public UserNotificationEvent toEntityModel() {
067 UserNotificationEventImpl userNotificationEventImpl = new UserNotificationEventImpl();
068
069 if (uuid == null) {
070 userNotificationEventImpl.setUuid(StringPool.BLANK);
071 }
072 else {
073 userNotificationEventImpl.setUuid(uuid);
074 }
075
076 userNotificationEventImpl.setUserNotificationEventId(userNotificationEventId);
077 userNotificationEventImpl.setCompanyId(companyId);
078 userNotificationEventImpl.setUserId(userId);
079
080 if (type == null) {
081 userNotificationEventImpl.setType(StringPool.BLANK);
082 }
083 else {
084 userNotificationEventImpl.setType(type);
085 }
086
087 userNotificationEventImpl.setTimestamp(timestamp);
088 userNotificationEventImpl.setDeliverBy(deliverBy);
089 userNotificationEventImpl.setDelivered(delivered);
090
091 if (payload == null) {
092 userNotificationEventImpl.setPayload(StringPool.BLANK);
093 }
094 else {
095 userNotificationEventImpl.setPayload(payload);
096 }
097
098 userNotificationEventImpl.setArchived(archived);
099
100 userNotificationEventImpl.resetOriginalValues();
101
102 return userNotificationEventImpl;
103 }
104
105 @Override
106 public void readExternal(ObjectInput objectInput) throws IOException {
107 uuid = objectInput.readUTF();
108 userNotificationEventId = objectInput.readLong();
109 companyId = objectInput.readLong();
110 userId = objectInput.readLong();
111 type = objectInput.readUTF();
112 timestamp = objectInput.readLong();
113 deliverBy = objectInput.readLong();
114 delivered = objectInput.readBoolean();
115 payload = objectInput.readUTF();
116 archived = objectInput.readBoolean();
117 }
118
119 @Override
120 public void writeExternal(ObjectOutput objectOutput)
121 throws IOException {
122 if (uuid == null) {
123 objectOutput.writeUTF(StringPool.BLANK);
124 }
125 else {
126 objectOutput.writeUTF(uuid);
127 }
128
129 objectOutput.writeLong(userNotificationEventId);
130 objectOutput.writeLong(companyId);
131 objectOutput.writeLong(userId);
132
133 if (type == null) {
134 objectOutput.writeUTF(StringPool.BLANK);
135 }
136 else {
137 objectOutput.writeUTF(type);
138 }
139
140 objectOutput.writeLong(timestamp);
141 objectOutput.writeLong(deliverBy);
142 objectOutput.writeBoolean(delivered);
143
144 if (payload == null) {
145 objectOutput.writeUTF(StringPool.BLANK);
146 }
147 else {
148 objectOutput.writeUTF(payload);
149 }
150
151 objectOutput.writeBoolean(archived);
152 }
153
154 public String uuid;
155 public long userNotificationEventId;
156 public long companyId;
157 public long userId;
158 public String type;
159 public long timestamp;
160 public long deliverBy;
161 public boolean delivered;
162 public String payload;
163 public boolean archived;
164 }