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.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.CacheModel;
022    
023    import com.liferay.portlet.social.model.SocialRelation;
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 SocialRelation in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see SocialRelation
035     * @generated
036     */
037    @ProviderType
038    public class SocialRelationCacheModel implements CacheModel<SocialRelation>,
039            Externalizable {
040            @Override
041            public String toString() {
042                    StringBundler sb = new StringBundler(15);
043    
044                    sb.append("{uuid=");
045                    sb.append(uuid);
046                    sb.append(", relationId=");
047                    sb.append(relationId);
048                    sb.append(", companyId=");
049                    sb.append(companyId);
050                    sb.append(", createDate=");
051                    sb.append(createDate);
052                    sb.append(", userId1=");
053                    sb.append(userId1);
054                    sb.append(", userId2=");
055                    sb.append(userId2);
056                    sb.append(", type=");
057                    sb.append(type);
058                    sb.append("}");
059    
060                    return sb.toString();
061            }
062    
063            @Override
064            public SocialRelation toEntityModel() {
065                    SocialRelationImpl socialRelationImpl = new SocialRelationImpl();
066    
067                    if (uuid == null) {
068                            socialRelationImpl.setUuid(StringPool.BLANK);
069                    }
070                    else {
071                            socialRelationImpl.setUuid(uuid);
072                    }
073    
074                    socialRelationImpl.setRelationId(relationId);
075                    socialRelationImpl.setCompanyId(companyId);
076                    socialRelationImpl.setCreateDate(createDate);
077                    socialRelationImpl.setUserId1(userId1);
078                    socialRelationImpl.setUserId2(userId2);
079                    socialRelationImpl.setType(type);
080    
081                    socialRelationImpl.resetOriginalValues();
082    
083                    return socialRelationImpl;
084            }
085    
086            @Override
087            public void readExternal(ObjectInput objectInput) throws IOException {
088                    uuid = objectInput.readUTF();
089                    relationId = objectInput.readLong();
090                    companyId = objectInput.readLong();
091                    createDate = objectInput.readLong();
092                    userId1 = objectInput.readLong();
093                    userId2 = objectInput.readLong();
094                    type = objectInput.readInt();
095            }
096    
097            @Override
098            public void writeExternal(ObjectOutput objectOutput)
099                    throws IOException {
100                    if (uuid == null) {
101                            objectOutput.writeUTF(StringPool.BLANK);
102                    }
103                    else {
104                            objectOutput.writeUTF(uuid);
105                    }
106    
107                    objectOutput.writeLong(relationId);
108                    objectOutput.writeLong(companyId);
109                    objectOutput.writeLong(createDate);
110                    objectOutput.writeLong(userId1);
111                    objectOutput.writeLong(userId2);
112                    objectOutput.writeInt(type);
113            }
114    
115            public String uuid;
116            public long relationId;
117            public long companyId;
118            public long createDate;
119            public long userId1;
120            public long userId2;
121            public int type;
122    }