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.UserNotificationEvent;
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 UserNotificationEvent in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see UserNotificationEvent
035     * @generated
036     */
037    @ProviderType
038    public class UserNotificationEventCacheModel implements CacheModel<UserNotificationEvent>,
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(27);
053    
054                    sb.append("{mvccVersion=");
055                    sb.append(mvccVersion);
056                    sb.append(", uuid=");
057                    sb.append(uuid);
058                    sb.append(", userNotificationEventId=");
059                    sb.append(userNotificationEventId);
060                    sb.append(", companyId=");
061                    sb.append(companyId);
062                    sb.append(", userId=");
063                    sb.append(userId);
064                    sb.append(", type=");
065                    sb.append(type);
066                    sb.append(", timestamp=");
067                    sb.append(timestamp);
068                    sb.append(", deliveryType=");
069                    sb.append(deliveryType);
070                    sb.append(", deliverBy=");
071                    sb.append(deliverBy);
072                    sb.append(", delivered=");
073                    sb.append(delivered);
074                    sb.append(", payload=");
075                    sb.append(payload);
076                    sb.append(", actionRequired=");
077                    sb.append(actionRequired);
078                    sb.append(", archived=");
079                    sb.append(archived);
080                    sb.append("}");
081    
082                    return sb.toString();
083            }
084    
085            @Override
086            public UserNotificationEvent toEntityModel() {
087                    UserNotificationEventImpl userNotificationEventImpl = new UserNotificationEventImpl();
088    
089                    userNotificationEventImpl.setMvccVersion(mvccVersion);
090    
091                    if (uuid == null) {
092                            userNotificationEventImpl.setUuid(StringPool.BLANK);
093                    }
094                    else {
095                            userNotificationEventImpl.setUuid(uuid);
096                    }
097    
098                    userNotificationEventImpl.setUserNotificationEventId(userNotificationEventId);
099                    userNotificationEventImpl.setCompanyId(companyId);
100                    userNotificationEventImpl.setUserId(userId);
101    
102                    if (type == null) {
103                            userNotificationEventImpl.setType(StringPool.BLANK);
104                    }
105                    else {
106                            userNotificationEventImpl.setType(type);
107                    }
108    
109                    userNotificationEventImpl.setTimestamp(timestamp);
110                    userNotificationEventImpl.setDeliveryType(deliveryType);
111                    userNotificationEventImpl.setDeliverBy(deliverBy);
112                    userNotificationEventImpl.setDelivered(delivered);
113    
114                    if (payload == null) {
115                            userNotificationEventImpl.setPayload(StringPool.BLANK);
116                    }
117                    else {
118                            userNotificationEventImpl.setPayload(payload);
119                    }
120    
121                    userNotificationEventImpl.setActionRequired(actionRequired);
122                    userNotificationEventImpl.setArchived(archived);
123    
124                    userNotificationEventImpl.resetOriginalValues();
125    
126                    return userNotificationEventImpl;
127            }
128    
129            @Override
130            public void readExternal(ObjectInput objectInput) throws IOException {
131                    mvccVersion = objectInput.readLong();
132                    uuid = objectInput.readUTF();
133                    userNotificationEventId = objectInput.readLong();
134                    companyId = objectInput.readLong();
135                    userId = objectInput.readLong();
136                    type = objectInput.readUTF();
137                    timestamp = objectInput.readLong();
138                    deliveryType = objectInput.readInt();
139                    deliverBy = objectInput.readLong();
140                    delivered = objectInput.readBoolean();
141                    payload = objectInput.readUTF();
142                    actionRequired = objectInput.readBoolean();
143                    archived = objectInput.readBoolean();
144            }
145    
146            @Override
147            public void writeExternal(ObjectOutput objectOutput)
148                    throws IOException {
149                    objectOutput.writeLong(mvccVersion);
150    
151                    if (uuid == null) {
152                            objectOutput.writeUTF(StringPool.BLANK);
153                    }
154                    else {
155                            objectOutput.writeUTF(uuid);
156                    }
157    
158                    objectOutput.writeLong(userNotificationEventId);
159                    objectOutput.writeLong(companyId);
160                    objectOutput.writeLong(userId);
161    
162                    if (type == null) {
163                            objectOutput.writeUTF(StringPool.BLANK);
164                    }
165                    else {
166                            objectOutput.writeUTF(type);
167                    }
168    
169                    objectOutput.writeLong(timestamp);
170                    objectOutput.writeInt(deliveryType);
171                    objectOutput.writeLong(deliverBy);
172                    objectOutput.writeBoolean(delivered);
173    
174                    if (payload == null) {
175                            objectOutput.writeUTF(StringPool.BLANK);
176                    }
177                    else {
178                            objectOutput.writeUTF(payload);
179                    }
180    
181                    objectOutput.writeBoolean(actionRequired);
182                    objectOutput.writeBoolean(archived);
183            }
184    
185            public long mvccVersion;
186            public String uuid;
187            public long userNotificationEventId;
188            public long companyId;
189            public long userId;
190            public String type;
191            public long timestamp;
192            public int deliveryType;
193            public long deliverBy;
194            public boolean delivered;
195            public String payload;
196            public boolean actionRequired;
197            public boolean archived;
198    }