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.UserNotificationDelivery;
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 UserNotificationDelivery in entity cache.
033     *
034     * @author Brian Wing Shun Chan
035     * @see UserNotificationDelivery
036     * @generated
037     */
038    @ProviderType
039    public class UserNotificationDeliveryCacheModel implements CacheModel<UserNotificationDelivery>,
040            Externalizable, MVCCModel {
041            @Override
042            public boolean equals(Object obj) {
043                    if (this == obj) {
044                            return true;
045                    }
046    
047                    if (!(obj instanceof UserNotificationDeliveryCacheModel)) {
048                            return false;
049                    }
050    
051                    UserNotificationDeliveryCacheModel userNotificationDeliveryCacheModel = (UserNotificationDeliveryCacheModel)obj;
052    
053                    if ((userNotificationDeliveryId == userNotificationDeliveryCacheModel.userNotificationDeliveryId) &&
054                                    (mvccVersion == userNotificationDeliveryCacheModel.mvccVersion)) {
055                            return true;
056                    }
057    
058                    return false;
059            }
060    
061            @Override
062            public int hashCode() {
063                    int hashCode = HashUtil.hash(0, userNotificationDeliveryId);
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(19);
081    
082                    sb.append("{mvccVersion=");
083                    sb.append(mvccVersion);
084                    sb.append(", userNotificationDeliveryId=");
085                    sb.append(userNotificationDeliveryId);
086                    sb.append(", companyId=");
087                    sb.append(companyId);
088                    sb.append(", userId=");
089                    sb.append(userId);
090                    sb.append(", portletId=");
091                    sb.append(portletId);
092                    sb.append(", classNameId=");
093                    sb.append(classNameId);
094                    sb.append(", notificationType=");
095                    sb.append(notificationType);
096                    sb.append(", deliveryType=");
097                    sb.append(deliveryType);
098                    sb.append(", deliver=");
099                    sb.append(deliver);
100                    sb.append("}");
101    
102                    return sb.toString();
103            }
104    
105            @Override
106            public UserNotificationDelivery toEntityModel() {
107                    UserNotificationDeliveryImpl userNotificationDeliveryImpl = new UserNotificationDeliveryImpl();
108    
109                    userNotificationDeliveryImpl.setMvccVersion(mvccVersion);
110                    userNotificationDeliveryImpl.setUserNotificationDeliveryId(userNotificationDeliveryId);
111                    userNotificationDeliveryImpl.setCompanyId(companyId);
112                    userNotificationDeliveryImpl.setUserId(userId);
113    
114                    if (portletId == null) {
115                            userNotificationDeliveryImpl.setPortletId(StringPool.BLANK);
116                    }
117                    else {
118                            userNotificationDeliveryImpl.setPortletId(portletId);
119                    }
120    
121                    userNotificationDeliveryImpl.setClassNameId(classNameId);
122                    userNotificationDeliveryImpl.setNotificationType(notificationType);
123                    userNotificationDeliveryImpl.setDeliveryType(deliveryType);
124                    userNotificationDeliveryImpl.setDeliver(deliver);
125    
126                    userNotificationDeliveryImpl.resetOriginalValues();
127    
128                    return userNotificationDeliveryImpl;
129            }
130    
131            @Override
132            public void readExternal(ObjectInput objectInput) throws IOException {
133                    mvccVersion = objectInput.readLong();
134                    userNotificationDeliveryId = objectInput.readLong();
135                    companyId = objectInput.readLong();
136                    userId = objectInput.readLong();
137                    portletId = objectInput.readUTF();
138                    classNameId = objectInput.readLong();
139                    notificationType = objectInput.readInt();
140                    deliveryType = objectInput.readInt();
141                    deliver = objectInput.readBoolean();
142            }
143    
144            @Override
145            public void writeExternal(ObjectOutput objectOutput)
146                    throws IOException {
147                    objectOutput.writeLong(mvccVersion);
148                    objectOutput.writeLong(userNotificationDeliveryId);
149                    objectOutput.writeLong(companyId);
150                    objectOutput.writeLong(userId);
151    
152                    if (portletId == null) {
153                            objectOutput.writeUTF(StringPool.BLANK);
154                    }
155                    else {
156                            objectOutput.writeUTF(portletId);
157                    }
158    
159                    objectOutput.writeLong(classNameId);
160                    objectOutput.writeInt(notificationType);
161                    objectOutput.writeInt(deliveryType);
162                    objectOutput.writeBoolean(deliver);
163            }
164    
165            public long mvccVersion;
166            public long userNotificationDeliveryId;
167            public long companyId;
168            public long userId;
169            public String portletId;
170            public long classNameId;
171            public int notificationType;
172            public int deliveryType;
173            public boolean deliver;
174    }