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.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    
024    import com.liferay.portlet.social.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                    requestId = objectInput.readLong();
140                    groupId = objectInput.readLong();
141                    companyId = objectInput.readLong();
142                    userId = objectInput.readLong();
143                    createDate = objectInput.readLong();
144                    modifiedDate = objectInput.readLong();
145                    classNameId = objectInput.readLong();
146                    classPK = objectInput.readLong();
147                    type = objectInput.readInt();
148                    extraData = objectInput.readUTF();
149                    receiverUserId = objectInput.readLong();
150                    status = objectInput.readInt();
151            }
152    
153            @Override
154            public void writeExternal(ObjectOutput objectOutput)
155                    throws IOException {
156                    if (uuid == null) {
157                            objectOutput.writeUTF(StringPool.BLANK);
158                    }
159                    else {
160                            objectOutput.writeUTF(uuid);
161                    }
162    
163                    objectOutput.writeLong(requestId);
164                    objectOutput.writeLong(groupId);
165                    objectOutput.writeLong(companyId);
166                    objectOutput.writeLong(userId);
167                    objectOutput.writeLong(createDate);
168                    objectOutput.writeLong(modifiedDate);
169                    objectOutput.writeLong(classNameId);
170                    objectOutput.writeLong(classPK);
171                    objectOutput.writeInt(type);
172    
173                    if (extraData == null) {
174                            objectOutput.writeUTF(StringPool.BLANK);
175                    }
176                    else {
177                            objectOutput.writeUTF(extraData);
178                    }
179    
180                    objectOutput.writeLong(receiverUserId);
181                    objectOutput.writeInt(status);
182            }
183    
184            public String uuid;
185            public long requestId;
186            public long groupId;
187            public long companyId;
188            public long userId;
189            public long createDate;
190            public long modifiedDate;
191            public long classNameId;
192            public long classPK;
193            public int type;
194            public String extraData;
195            public long receiverUserId;
196            public int status;
197    }