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