001    /**
002     * Copyright (c) 2000-2012 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 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    /**
029     * The cache model class for representing AnnouncementsDelivery in entity cache.
030     *
031     * @author Brian Wing Shun Chan
032     * @see AnnouncementsDelivery
033     * @generated
034     */
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            public AnnouncementsDelivery toEntityModel() {
061                    AnnouncementsDeliveryImpl announcementsDeliveryImpl = new AnnouncementsDeliveryImpl();
062    
063                    announcementsDeliveryImpl.setDeliveryId(deliveryId);
064                    announcementsDeliveryImpl.setCompanyId(companyId);
065                    announcementsDeliveryImpl.setUserId(userId);
066    
067                    if (type == null) {
068                            announcementsDeliveryImpl.setType(StringPool.BLANK);
069                    }
070                    else {
071                            announcementsDeliveryImpl.setType(type);
072                    }
073    
074                    announcementsDeliveryImpl.setEmail(email);
075                    announcementsDeliveryImpl.setSms(sms);
076                    announcementsDeliveryImpl.setWebsite(website);
077    
078                    announcementsDeliveryImpl.resetOriginalValues();
079    
080                    return announcementsDeliveryImpl;
081            }
082    
083            public void readExternal(ObjectInput objectInput) throws IOException {
084                    deliveryId = objectInput.readLong();
085                    companyId = objectInput.readLong();
086                    userId = objectInput.readLong();
087                    type = objectInput.readUTF();
088                    email = objectInput.readBoolean();
089                    sms = objectInput.readBoolean();
090                    website = objectInput.readBoolean();
091            }
092    
093            public void writeExternal(ObjectOutput objectOutput)
094                    throws IOException {
095                    objectOutput.writeLong(deliveryId);
096                    objectOutput.writeLong(companyId);
097                    objectOutput.writeLong(userId);
098    
099                    if (type == null) {
100                            objectOutput.writeUTF(StringPool.BLANK);
101                    }
102                    else {
103                            objectOutput.writeUTF(type);
104                    }
105    
106                    objectOutput.writeBoolean(email);
107                    objectOutput.writeBoolean(sms);
108                    objectOutput.writeBoolean(website);
109            }
110    
111            public long deliveryId;
112            public long companyId;
113            public long userId;
114            public String type;
115            public boolean email;
116            public boolean sms;
117            public boolean website;
118    }