001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.announcements.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.CacheModel;
022    
023    import com.liferay.portlet.announcements.model.AnnouncementsDelivery;
024    
025    import java.io.Externalizable;
026    import java.io.IOException;
027    import java.io.ObjectInput;
028    import java.io.ObjectOutput;
029    
030    /**
031     * The cache model class for representing AnnouncementsDelivery in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see AnnouncementsDelivery
035     * @generated
036     */
037    @ProviderType
038    public class AnnouncementsDeliveryCacheModel implements CacheModel<AnnouncementsDelivery>,
039            Externalizable {
040            @Override
041            public String toString() {
042                    StringBundler sb = new StringBundler(15);
043    
044                    sb.append("{deliveryId=");
045                    sb.append(deliveryId);
046                    sb.append(", companyId=");
047                    sb.append(companyId);
048                    sb.append(", userId=");
049                    sb.append(userId);
050                    sb.append(", type=");
051                    sb.append(type);
052                    sb.append(", email=");
053                    sb.append(email);
054                    sb.append(", sms=");
055                    sb.append(sms);
056                    sb.append(", website=");
057                    sb.append(website);
058                    sb.append("}");
059    
060                    return sb.toString();
061            }
062    
063            @Override
064            public AnnouncementsDelivery toEntityModel() {
065                    AnnouncementsDeliveryImpl announcementsDeliveryImpl = new AnnouncementsDeliveryImpl();
066    
067                    announcementsDeliveryImpl.setDeliveryId(deliveryId);
068                    announcementsDeliveryImpl.setCompanyId(companyId);
069                    announcementsDeliveryImpl.setUserId(userId);
070    
071                    if (type == null) {
072                            announcementsDeliveryImpl.setType(StringPool.BLANK);
073                    }
074                    else {
075                            announcementsDeliveryImpl.setType(type);
076                    }
077    
078                    announcementsDeliveryImpl.setEmail(email);
079                    announcementsDeliveryImpl.setSms(sms);
080                    announcementsDeliveryImpl.setWebsite(website);
081    
082                    announcementsDeliveryImpl.resetOriginalValues();
083    
084                    return announcementsDeliveryImpl;
085            }
086    
087            @Override
088            public void readExternal(ObjectInput objectInput) throws IOException {
089                    deliveryId = objectInput.readLong();
090                    companyId = objectInput.readLong();
091                    userId = objectInput.readLong();
092                    type = objectInput.readUTF();
093                    email = objectInput.readBoolean();
094                    sms = objectInput.readBoolean();
095                    website = objectInput.readBoolean();
096            }
097    
098            @Override
099            public void writeExternal(ObjectOutput objectOutput)
100                    throws IOException {
101                    objectOutput.writeLong(deliveryId);
102                    objectOutput.writeLong(companyId);
103                    objectOutput.writeLong(userId);
104    
105                    if (type == null) {
106                            objectOutput.writeUTF(StringPool.BLANK);
107                    }
108                    else {
109                            objectOutput.writeUTF(type);
110                    }
111    
112                    objectOutput.writeBoolean(email);
113                    objectOutput.writeBoolean(sms);
114                    objectOutput.writeBoolean(website);
115            }
116    
117            public long deliveryId;
118            public long companyId;
119            public long userId;
120            public String type;
121            public boolean email;
122            public boolean sms;
123            public boolean website;
124    }