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.UserNotificationDelivery;
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 UserNotificationDeliveryCacheModel implements CacheModel<UserNotificationDelivery>,
035 Externalizable {
036 @Override
037 public String toString() {
038 StringBundler sb = new StringBundler(17);
039
040 sb.append("{userNotificationDeliveryId=");
041 sb.append(userNotificationDeliveryId);
042 sb.append(", companyId=");
043 sb.append(companyId);
044 sb.append(", userId=");
045 sb.append(userId);
046 sb.append(", portletId=");
047 sb.append(portletId);
048 sb.append(", classNameId=");
049 sb.append(classNameId);
050 sb.append(", notificationType=");
051 sb.append(notificationType);
052 sb.append(", deliveryType=");
053 sb.append(deliveryType);
054 sb.append(", deliver=");
055 sb.append(deliver);
056 sb.append("}");
057
058 return sb.toString();
059 }
060
061 @Override
062 public UserNotificationDelivery toEntityModel() {
063 UserNotificationDeliveryImpl userNotificationDeliveryImpl = new UserNotificationDeliveryImpl();
064
065 userNotificationDeliveryImpl.setUserNotificationDeliveryId(userNotificationDeliveryId);
066 userNotificationDeliveryImpl.setCompanyId(companyId);
067 userNotificationDeliveryImpl.setUserId(userId);
068
069 if (portletId == null) {
070 userNotificationDeliveryImpl.setPortletId(StringPool.BLANK);
071 }
072 else {
073 userNotificationDeliveryImpl.setPortletId(portletId);
074 }
075
076 userNotificationDeliveryImpl.setClassNameId(classNameId);
077 userNotificationDeliveryImpl.setNotificationType(notificationType);
078 userNotificationDeliveryImpl.setDeliveryType(deliveryType);
079 userNotificationDeliveryImpl.setDeliver(deliver);
080
081 userNotificationDeliveryImpl.resetOriginalValues();
082
083 return userNotificationDeliveryImpl;
084 }
085
086 @Override
087 public void readExternal(ObjectInput objectInput) throws IOException {
088 userNotificationDeliveryId = objectInput.readLong();
089 companyId = objectInput.readLong();
090 userId = objectInput.readLong();
091 portletId = objectInput.readUTF();
092 classNameId = objectInput.readLong();
093 notificationType = objectInput.readInt();
094 deliveryType = objectInput.readInt();
095 deliver = objectInput.readBoolean();
096 }
097
098 @Override
099 public void writeExternal(ObjectOutput objectOutput)
100 throws IOException {
101 objectOutput.writeLong(userNotificationDeliveryId);
102 objectOutput.writeLong(companyId);
103 objectOutput.writeLong(userId);
104
105 if (portletId == null) {
106 objectOutput.writeUTF(StringPool.BLANK);
107 }
108 else {
109 objectOutput.writeUTF(portletId);
110 }
111
112 objectOutput.writeLong(classNameId);
113 objectOutput.writeInt(notificationType);
114 objectOutput.writeInt(deliveryType);
115 objectOutput.writeBoolean(deliver);
116 }
117
118 public long userNotificationDeliveryId;
119 public long companyId;
120 public long userId;
121 public String portletId;
122 public long classNameId;
123 public int notificationType;
124 public int deliveryType;
125 public boolean deliver;
126 }