001
014
015 package com.liferay.portlet.announcements.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
021 import com.liferay.portlet.announcements.model.AnnouncementsDelivery;
022
023 import java.io.Externalizable;
024 import java.io.IOException;
025 import java.io.ObjectInput;
026 import java.io.ObjectOutput;
027
028
035 public class AnnouncementsDeliveryCacheModel implements CacheModel<AnnouncementsDelivery>,
036 Externalizable {
037 @Override
038 public String toString() {
039 StringBundler sb = new StringBundler(15);
040
041 sb.append("{deliveryId=");
042 sb.append(deliveryId);
043 sb.append(", companyId=");
044 sb.append(companyId);
045 sb.append(", userId=");
046 sb.append(userId);
047 sb.append(", type=");
048 sb.append(type);
049 sb.append(", email=");
050 sb.append(email);
051 sb.append(", sms=");
052 sb.append(sms);
053 sb.append(", website=");
054 sb.append(website);
055 sb.append("}");
056
057 return sb.toString();
058 }
059
060 @Override
061 public AnnouncementsDelivery toEntityModel() {
062 AnnouncementsDeliveryImpl announcementsDeliveryImpl = new AnnouncementsDeliveryImpl();
063
064 announcementsDeliveryImpl.setDeliveryId(deliveryId);
065 announcementsDeliveryImpl.setCompanyId(companyId);
066 announcementsDeliveryImpl.setUserId(userId);
067
068 if (type == null) {
069 announcementsDeliveryImpl.setType(StringPool.BLANK);
070 }
071 else {
072 announcementsDeliveryImpl.setType(type);
073 }
074
075 announcementsDeliveryImpl.setEmail(email);
076 announcementsDeliveryImpl.setSms(sms);
077 announcementsDeliveryImpl.setWebsite(website);
078
079 announcementsDeliveryImpl.resetOriginalValues();
080
081 return announcementsDeliveryImpl;
082 }
083
084 @Override
085 public void readExternal(ObjectInput objectInput) throws IOException {
086 deliveryId = objectInput.readLong();
087 companyId = objectInput.readLong();
088 userId = objectInput.readLong();
089 type = objectInput.readUTF();
090 email = objectInput.readBoolean();
091 sms = objectInput.readBoolean();
092 website = objectInput.readBoolean();
093 }
094
095 @Override
096 public void writeExternal(ObjectOutput objectOutput)
097 throws IOException {
098 objectOutput.writeLong(deliveryId);
099 objectOutput.writeLong(companyId);
100 objectOutput.writeLong(userId);
101
102 if (type == null) {
103 objectOutput.writeUTF(StringPool.BLANK);
104 }
105 else {
106 objectOutput.writeUTF(type);
107 }
108
109 objectOutput.writeBoolean(email);
110 objectOutput.writeBoolean(sms);
111 objectOutput.writeBoolean(website);
112 }
113
114 public long deliveryId;
115 public long companyId;
116 public long userId;
117 public String type;
118 public boolean email;
119 public boolean sms;
120 public boolean website;
121 }