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.HashUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.model.CacheModel;
023    import com.liferay.portal.model.MVCCModel;
024    import com.liferay.portal.model.UserNotificationEvent;
025    
026    import java.io.Externalizable;
027    import java.io.IOException;
028    import java.io.ObjectInput;
029    import java.io.ObjectOutput;
030    
031    /**
032     * The cache model class for representing UserNotificationEvent in entity cache.
033     *
034     * @author Brian Wing Shun Chan
035     * @see UserNotificationEvent
036     * @generated
037     */
038    @ProviderType
039    public class UserNotificationEventCacheModel implements CacheModel<UserNotificationEvent>,
040            Externalizable, MVCCModel {
041            @Override
042            public boolean equals(Object obj) {
043                    if (this == obj) {
044                            return true;
045                    }
046    
047                    if (!(obj instanceof UserNotificationEventCacheModel)) {
048                            return false;
049                    }
050    
051                    UserNotificationEventCacheModel userNotificationEventCacheModel = (UserNotificationEventCacheModel)obj;
052    
053                    if ((userNotificationEventId == userNotificationEventCacheModel.userNotificationEventId) &&
054                                    (mvccVersion == userNotificationEventCacheModel.mvccVersion)) {
055                            return true;
056                    }
057    
058                    return false;
059            }
060    
061            @Override
062            public int hashCode() {
063                    int hashCode = HashUtil.hash(0, userNotificationEventId);
064    
065                    return HashUtil.hash(hashCode, mvccVersion);
066            }
067    
068            @Override
069            public long getMvccVersion() {
070                    return mvccVersion;
071            }
072    
073            @Override
074            public void setMvccVersion(long mvccVersion) {
075                    this.mvccVersion = mvccVersion;
076            }
077    
078            @Override
079            public String toString() {
080                    StringBundler sb = new StringBundler(27);
081    
082                    sb.append("{mvccVersion=");
083                    sb.append(mvccVersion);
084                    sb.append(", uuid=");
085                    sb.append(uuid);
086                    sb.append(", userNotificationEventId=");
087                    sb.append(userNotificationEventId);
088                    sb.append(", companyId=");
089                    sb.append(companyId);
090                    sb.append(", userId=");
091                    sb.append(userId);
092                    sb.append(", type=");
093                    sb.append(type);
094                    sb.append(", timestamp=");
095                    sb.append(timestamp);
096                    sb.append(", deliveryType=");
097                    sb.append(deliveryType);
098                    sb.append(", deliverBy=");
099                    sb.append(deliverBy);
100                    sb.append(", delivered=");
101                    sb.append(delivered);
102                    sb.append(", payload=");
103                    sb.append(payload);
104                    sb.append(", actionRequired=");
105                    sb.append(actionRequired);
106                    sb.append(", archived=");
107                    sb.append(archived);
108                    sb.append("}");
109    
110                    return sb.toString();
111            }
112    
113            @Override
114            public UserNotificationEvent toEntityModel() {
115                    UserNotificationEventImpl userNotificationEventImpl = new UserNotificationEventImpl();
116    
117                    userNotificationEventImpl.setMvccVersion(mvccVersion);
118    
119                    if (uuid == null) {
120                            userNotificationEventImpl.setUuid(StringPool.BLANK);
121                    }
122                    else {
123                            userNotificationEventImpl.setUuid(uuid);
124                    }
125    
126                    userNotificationEventImpl.setUserNotificationEventId(userNotificationEventId);
127                    userNotificationEventImpl.setCompanyId(companyId);
128                    userNotificationEventImpl.setUserId(userId);
129    
130                    if (type == null) {
131                            userNotificationEventImpl.setType(StringPool.BLANK);
132                    }
133                    else {
134                            userNotificationEventImpl.setType(type);
135                    }
136    
137                    userNotificationEventImpl.setTimestamp(timestamp);
138                    userNotificationEventImpl.setDeliveryType(deliveryType);
139                    userNotificationEventImpl.setDeliverBy(deliverBy);
140                    userNotificationEventImpl.setDelivered(delivered);
141    
142                    if (payload == null) {
143                            userNotificationEventImpl.setPayload(StringPool.BLANK);
144                    }
145                    else {
146                            userNotificationEventImpl.setPayload(payload);
147                    }
148    
149                    userNotificationEventImpl.setActionRequired(actionRequired);
150                    userNotificationEventImpl.setArchived(archived);
151    
152                    userNotificationEventImpl.resetOriginalValues();
153    
154                    return userNotificationEventImpl;
155            }
156    
157            @Override
158            public void readExternal(ObjectInput objectInput) throws IOException {
159                    mvccVersion = objectInput.readLong();
160                    uuid = objectInput.readUTF();
161                    userNotificationEventId = objectInput.readLong();
162                    companyId = objectInput.readLong();
163                    userId = objectInput.readLong();
164                    type = objectInput.readUTF();
165                    timestamp = objectInput.readLong();
166                    deliveryType = objectInput.readInt();
167                    deliverBy = objectInput.readLong();
168                    delivered = objectInput.readBoolean();
169                    payload = objectInput.readUTF();
170                    actionRequired = objectInput.readBoolean();
171                    archived = objectInput.readBoolean();
172            }
173    
174            @Override
175            public void writeExternal(ObjectOutput objectOutput)
176                    throws IOException {
177                    objectOutput.writeLong(mvccVersion);
178    
179                    if (uuid == null) {
180                            objectOutput.writeUTF(StringPool.BLANK);
181                    }
182                    else {
183                            objectOutput.writeUTF(uuid);
184                    }
185    
186                    objectOutput.writeLong(userNotificationEventId);
187                    objectOutput.writeLong(companyId);
188                    objectOutput.writeLong(userId);
189    
190                    if (type == null) {
191                            objectOutput.writeUTF(StringPool.BLANK);
192                    }
193                    else {
194                            objectOutput.writeUTF(type);
195                    }
196    
197                    objectOutput.writeLong(timestamp);
198                    objectOutput.writeInt(deliveryType);
199                    objectOutput.writeLong(deliverBy);
200                    objectOutput.writeBoolean(delivered);
201    
202                    if (payload == null) {
203                            objectOutput.writeUTF(StringPool.BLANK);
204                    }
205                    else {
206                            objectOutput.writeUTF(payload);
207                    }
208    
209                    objectOutput.writeBoolean(actionRequired);
210                    objectOutput.writeBoolean(archived);
211            }
212    
213            public long mvccVersion;
214            public String uuid;
215            public long userNotificationEventId;
216            public long companyId;
217            public long userId;
218            public String type;
219            public long timestamp;
220            public int deliveryType;
221            public long deliverBy;
222            public boolean delivered;
223            public String payload;
224            public boolean actionRequired;
225            public boolean archived;
226    }