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.portlet.social.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.model.CacheModel;
020    import com.liferay.portal.kernel.util.HashUtil;
021    import com.liferay.portal.kernel.util.StringBundler;
022    import com.liferay.portal.kernel.util.StringPool;
023    
024    import com.liferay.social.kernel.model.SocialRequest;
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 SocialRequest in entity cache.
033     *
034     * @author Brian Wing Shun Chan
035     * @see SocialRequest
036     * @generated
037     */
038    @ProviderType
039    public class SocialRequestCacheModel implements CacheModel<SocialRequest>,
040            Externalizable {
041            @Override
042            public boolean equals(Object obj) {
043                    if (this == obj) {
044                            return true;
045                    }
046    
047                    if (!(obj instanceof SocialRequestCacheModel)) {
048                            return false;
049                    }
050    
051                    SocialRequestCacheModel socialRequestCacheModel = (SocialRequestCacheModel)obj;
052    
053                    if (requestId == socialRequestCacheModel.requestId) {
054                            return true;
055                    }
056    
057                    return false;
058            }
059    
060            @Override
061            public int hashCode() {
062                    return HashUtil.hash(0, requestId);
063            }
064    
065            @Override
066            public String toString() {
067                    StringBundler sb = new StringBundler(27);
068    
069                    sb.append("{uuid=");
070                    sb.append(uuid);
071                    sb.append(", requestId=");
072                    sb.append(requestId);
073                    sb.append(", groupId=");
074                    sb.append(groupId);
075                    sb.append(", companyId=");
076                    sb.append(companyId);
077                    sb.append(", userId=");
078                    sb.append(userId);
079                    sb.append(", createDate=");
080                    sb.append(createDate);
081                    sb.append(", modifiedDate=");
082                    sb.append(modifiedDate);
083                    sb.append(", classNameId=");
084                    sb.append(classNameId);
085                    sb.append(", classPK=");
086                    sb.append(classPK);
087                    sb.append(", type=");
088                    sb.append(type);
089                    sb.append(", extraData=");
090                    sb.append(extraData);
091                    sb.append(", receiverUserId=");
092                    sb.append(receiverUserId);
093                    sb.append(", status=");
094                    sb.append(status);
095                    sb.append("}");
096    
097                    return sb.toString();
098            }
099    
100            @Override
101            public SocialRequest toEntityModel() {
102                    SocialRequestImpl socialRequestImpl = new SocialRequestImpl();
103    
104                    if (uuid == null) {
105                            socialRequestImpl.setUuid(StringPool.BLANK);
106                    }
107                    else {
108                            socialRequestImpl.setUuid(uuid);
109                    }
110    
111                    socialRequestImpl.setRequestId(requestId);
112                    socialRequestImpl.setGroupId(groupId);
113                    socialRequestImpl.setCompanyId(companyId);
114                    socialRequestImpl.setUserId(userId);
115                    socialRequestImpl.setCreateDate(createDate);
116                    socialRequestImpl.setModifiedDate(modifiedDate);
117                    socialRequestImpl.setClassNameId(classNameId);
118                    socialRequestImpl.setClassPK(classPK);
119                    socialRequestImpl.setType(type);
120    
121                    if (extraData == null) {
122                            socialRequestImpl.setExtraData(StringPool.BLANK);
123                    }
124                    else {
125                            socialRequestImpl.setExtraData(extraData);
126                    }
127    
128                    socialRequestImpl.setReceiverUserId(receiverUserId);
129                    socialRequestImpl.setStatus(status);
130    
131                    socialRequestImpl.resetOriginalValues();
132    
133                    return socialRequestImpl;
134            }
135    
136            @Override
137            public void readExternal(ObjectInput objectInput) throws IOException {
138                    uuid = objectInput.readUTF();
139    
140                    requestId = objectInput.readLong();
141    
142                    groupId = objectInput.readLong();
143    
144                    companyId = objectInput.readLong();
145    
146                    userId = objectInput.readLong();
147    
148                    createDate = objectInput.readLong();
149    
150                    modifiedDate = objectInput.readLong();
151    
152                    classNameId = objectInput.readLong();
153    
154                    classPK = objectInput.readLong();
155    
156                    type = objectInput.readInt();
157                    extraData = objectInput.readUTF();
158    
159                    receiverUserId = objectInput.readLong();
160    
161                    status = objectInput.readInt();
162            }
163    
164            @Override
165            public void writeExternal(ObjectOutput objectOutput)
166                    throws IOException {
167                    if (uuid == null) {
168                            objectOutput.writeUTF(StringPool.BLANK);
169                    }
170                    else {
171                            objectOutput.writeUTF(uuid);
172                    }
173    
174                    objectOutput.writeLong(requestId);
175    
176                    objectOutput.writeLong(groupId);
177    
178                    objectOutput.writeLong(companyId);
179    
180                    objectOutput.writeLong(userId);
181    
182                    objectOutput.writeLong(createDate);
183    
184                    objectOutput.writeLong(modifiedDate);
185    
186                    objectOutput.writeLong(classNameId);
187    
188                    objectOutput.writeLong(classPK);
189    
190                    objectOutput.writeInt(type);
191    
192                    if (extraData == null) {
193                            objectOutput.writeUTF(StringPool.BLANK);
194                    }
195                    else {
196                            objectOutput.writeUTF(extraData);
197                    }
198    
199                    objectOutput.writeLong(receiverUserId);
200    
201                    objectOutput.writeInt(status);
202            }
203    
204            public String uuid;
205            public long requestId;
206            public long groupId;
207            public long companyId;
208            public long userId;
209            public long createDate;
210            public long modifiedDate;
211            public long classNameId;
212            public long classPK;
213            public int type;
214            public String extraData;
215            public long receiverUserId;
216            public int status;
217    }