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.portal.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    import com.liferay.portal.model.MVCCModel;
023    import com.liferay.portal.model.UserNotificationDelivery;
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 UserNotificationDelivery in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see UserNotificationDelivery
035     * @generated
036     */
037    @ProviderType
038    public class UserNotificationDeliveryCacheModel implements CacheModel<UserNotificationDelivery>,
039            Externalizable, MVCCModel {
040            @Override
041            public long getMvccVersion() {
042                    return mvccVersion;
043            }
044    
045            @Override
046            public void setMvccVersion(long mvccVersion) {
047                    this.mvccVersion = mvccVersion;
048            }
049    
050            @Override
051            public String toString() {
052                    StringBundler sb = new StringBundler(19);
053    
054                    sb.append("{mvccVersion=");
055                    sb.append(mvccVersion);
056                    sb.append(", userNotificationDeliveryId=");
057                    sb.append(userNotificationDeliveryId);
058                    sb.append(", companyId=");
059                    sb.append(companyId);
060                    sb.append(", userId=");
061                    sb.append(userId);
062                    sb.append(", portletId=");
063                    sb.append(portletId);
064                    sb.append(", classNameId=");
065                    sb.append(classNameId);
066                    sb.append(", notificationType=");
067                    sb.append(notificationType);
068                    sb.append(", deliveryType=");
069                    sb.append(deliveryType);
070                    sb.append(", deliver=");
071                    sb.append(deliver);
072                    sb.append("}");
073    
074                    return sb.toString();
075            }
076    
077            @Override
078            public UserNotificationDelivery toEntityModel() {
079                    UserNotificationDeliveryImpl userNotificationDeliveryImpl = new UserNotificationDeliveryImpl();
080    
081                    userNotificationDeliveryImpl.setMvccVersion(mvccVersion);
082                    userNotificationDeliveryImpl.setUserNotificationDeliveryId(userNotificationDeliveryId);
083                    userNotificationDeliveryImpl.setCompanyId(companyId);
084                    userNotificationDeliveryImpl.setUserId(userId);
085    
086                    if (portletId == null) {
087                            userNotificationDeliveryImpl.setPortletId(StringPool.BLANK);
088                    }
089                    else {
090                            userNotificationDeliveryImpl.setPortletId(portletId);
091                    }
092    
093                    userNotificationDeliveryImpl.setClassNameId(classNameId);
094                    userNotificationDeliveryImpl.setNotificationType(notificationType);
095                    userNotificationDeliveryImpl.setDeliveryType(deliveryType);
096                    userNotificationDeliveryImpl.setDeliver(deliver);
097    
098                    userNotificationDeliveryImpl.resetOriginalValues();
099    
100                    return userNotificationDeliveryImpl;
101            }
102    
103            @Override
104            public void readExternal(ObjectInput objectInput) throws IOException {
105                    mvccVersion = objectInput.readLong();
106                    userNotificationDeliveryId = objectInput.readLong();
107                    companyId = objectInput.readLong();
108                    userId = objectInput.readLong();
109                    portletId = objectInput.readUTF();
110                    classNameId = objectInput.readLong();
111                    notificationType = objectInput.readInt();
112                    deliveryType = objectInput.readInt();
113                    deliver = objectInput.readBoolean();
114            }
115    
116            @Override
117            public void writeExternal(ObjectOutput objectOutput)
118                    throws IOException {
119                    objectOutput.writeLong(mvccVersion);
120                    objectOutput.writeLong(userNotificationDeliveryId);
121                    objectOutput.writeLong(companyId);
122                    objectOutput.writeLong(userId);
123    
124                    if (portletId == null) {
125                            objectOutput.writeUTF(StringPool.BLANK);
126                    }
127                    else {
128                            objectOutput.writeUTF(portletId);
129                    }
130    
131                    objectOutput.writeLong(classNameId);
132                    objectOutput.writeInt(notificationType);
133                    objectOutput.writeInt(deliveryType);
134                    objectOutput.writeBoolean(deliver);
135            }
136    
137            public long mvccVersion;
138            public long userNotificationDeliveryId;
139            public long companyId;
140            public long userId;
141            public String portletId;
142            public long classNameId;
143            public int notificationType;
144            public int deliveryType;
145            public boolean deliver;
146    }