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.UserNotificationDelivery;
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
038 @ProviderType
039 public class UserNotificationDeliveryCacheModel implements CacheModel<UserNotificationDelivery>,
040 Externalizable, MVCCModel {
041 @Override
042 public boolean equals(Object obj) {
043 if (this == obj) {
044 return true;
045 }
046
047 if (!(obj instanceof UserNotificationDeliveryCacheModel)) {
048 return false;
049 }
050
051 UserNotificationDeliveryCacheModel userNotificationDeliveryCacheModel = (UserNotificationDeliveryCacheModel)obj;
052
053 if ((userNotificationDeliveryId == userNotificationDeliveryCacheModel.userNotificationDeliveryId) &&
054 (mvccVersion == userNotificationDeliveryCacheModel.mvccVersion)) {
055 return true;
056 }
057
058 return false;
059 }
060
061 @Override
062 public int hashCode() {
063 int hashCode = HashUtil.hash(0, userNotificationDeliveryId);
064
065 return HashUtil.hash(hashCode, mvccVersion);
066 }
067
068 @Override
069 public long getMvccVersion() {
070 return mvccVersion;
071 }
072
073 @Override
074 public void setMvccVersion(long mvccVersion) {
075 this.mvccVersion = mvccVersion;
076 }
077
078 @Override
079 public String toString() {
080 StringBundler sb = new StringBundler(19);
081
082 sb.append("{mvccVersion=");
083 sb.append(mvccVersion);
084 sb.append(", userNotificationDeliveryId=");
085 sb.append(userNotificationDeliveryId);
086 sb.append(", companyId=");
087 sb.append(companyId);
088 sb.append(", userId=");
089 sb.append(userId);
090 sb.append(", portletId=");
091 sb.append(portletId);
092 sb.append(", classNameId=");
093 sb.append(classNameId);
094 sb.append(", notificationType=");
095 sb.append(notificationType);
096 sb.append(", deliveryType=");
097 sb.append(deliveryType);
098 sb.append(", deliver=");
099 sb.append(deliver);
100 sb.append("}");
101
102 return sb.toString();
103 }
104
105 @Override
106 public UserNotificationDelivery toEntityModel() {
107 UserNotificationDeliveryImpl userNotificationDeliveryImpl = new UserNotificationDeliveryImpl();
108
109 userNotificationDeliveryImpl.setMvccVersion(mvccVersion);
110 userNotificationDeliveryImpl.setUserNotificationDeliveryId(userNotificationDeliveryId);
111 userNotificationDeliveryImpl.setCompanyId(companyId);
112 userNotificationDeliveryImpl.setUserId(userId);
113
114 if (portletId == null) {
115 userNotificationDeliveryImpl.setPortletId(StringPool.BLANK);
116 }
117 else {
118 userNotificationDeliveryImpl.setPortletId(portletId);
119 }
120
121 userNotificationDeliveryImpl.setClassNameId(classNameId);
122 userNotificationDeliveryImpl.setNotificationType(notificationType);
123 userNotificationDeliveryImpl.setDeliveryType(deliveryType);
124 userNotificationDeliveryImpl.setDeliver(deliver);
125
126 userNotificationDeliveryImpl.resetOriginalValues();
127
128 return userNotificationDeliveryImpl;
129 }
130
131 @Override
132 public void readExternal(ObjectInput objectInput) throws IOException {
133 mvccVersion = objectInput.readLong();
134
135 userNotificationDeliveryId = objectInput.readLong();
136
137 companyId = objectInput.readLong();
138
139 userId = objectInput.readLong();
140 portletId = objectInput.readUTF();
141
142 classNameId = objectInput.readLong();
143
144 notificationType = objectInput.readInt();
145
146 deliveryType = objectInput.readInt();
147
148 deliver = objectInput.readBoolean();
149 }
150
151 @Override
152 public void writeExternal(ObjectOutput objectOutput)
153 throws IOException {
154 objectOutput.writeLong(mvccVersion);
155
156 objectOutput.writeLong(userNotificationDeliveryId);
157
158 objectOutput.writeLong(companyId);
159
160 objectOutput.writeLong(userId);
161
162 if (portletId == null) {
163 objectOutput.writeUTF(StringPool.BLANK);
164 }
165 else {
166 objectOutput.writeUTF(portletId);
167 }
168
169 objectOutput.writeLong(classNameId);
170
171 objectOutput.writeInt(notificationType);
172
173 objectOutput.writeInt(deliveryType);
174
175 objectOutput.writeBoolean(deliver);
176 }
177
178 public long mvccVersion;
179 public long userNotificationDeliveryId;
180 public long companyId;
181 public long userId;
182 public String portletId;
183 public long classNameId;
184 public int notificationType;
185 public int deliveryType;
186 public boolean deliver;
187 }