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.portal.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    import com.liferay.portal.model.MembershipRequest;
021    
022    import java.io.Externalizable;
023    import java.io.IOException;
024    import java.io.ObjectInput;
025    import java.io.ObjectOutput;
026    
027    import java.util.Date;
028    
029    /**
030     * The cache model class for representing MembershipRequest in entity cache.
031     *
032     * @author Brian Wing Shun Chan
033     * @see MembershipRequest
034     * @generated
035     */
036    public class MembershipRequestCacheModel implements CacheModel<MembershipRequest>,
037            Externalizable {
038            @Override
039            public String toString() {
040                    StringBundler sb = new StringBundler(21);
041    
042                    sb.append("{membershipRequestId=");
043                    sb.append(membershipRequestId);
044                    sb.append(", groupId=");
045                    sb.append(groupId);
046                    sb.append(", companyId=");
047                    sb.append(companyId);
048                    sb.append(", userId=");
049                    sb.append(userId);
050                    sb.append(", createDate=");
051                    sb.append(createDate);
052                    sb.append(", comments=");
053                    sb.append(comments);
054                    sb.append(", replyComments=");
055                    sb.append(replyComments);
056                    sb.append(", replyDate=");
057                    sb.append(replyDate);
058                    sb.append(", replierUserId=");
059                    sb.append(replierUserId);
060                    sb.append(", statusId=");
061                    sb.append(statusId);
062                    sb.append("}");
063    
064                    return sb.toString();
065            }
066    
067            public MembershipRequest toEntityModel() {
068                    MembershipRequestImpl membershipRequestImpl = new MembershipRequestImpl();
069    
070                    membershipRequestImpl.setMembershipRequestId(membershipRequestId);
071                    membershipRequestImpl.setGroupId(groupId);
072                    membershipRequestImpl.setCompanyId(companyId);
073                    membershipRequestImpl.setUserId(userId);
074    
075                    if (createDate == Long.MIN_VALUE) {
076                            membershipRequestImpl.setCreateDate(null);
077                    }
078                    else {
079                            membershipRequestImpl.setCreateDate(new Date(createDate));
080                    }
081    
082                    if (comments == null) {
083                            membershipRequestImpl.setComments(StringPool.BLANK);
084                    }
085                    else {
086                            membershipRequestImpl.setComments(comments);
087                    }
088    
089                    if (replyComments == null) {
090                            membershipRequestImpl.setReplyComments(StringPool.BLANK);
091                    }
092                    else {
093                            membershipRequestImpl.setReplyComments(replyComments);
094                    }
095    
096                    if (replyDate == Long.MIN_VALUE) {
097                            membershipRequestImpl.setReplyDate(null);
098                    }
099                    else {
100                            membershipRequestImpl.setReplyDate(new Date(replyDate));
101                    }
102    
103                    membershipRequestImpl.setReplierUserId(replierUserId);
104                    membershipRequestImpl.setStatusId(statusId);
105    
106                    membershipRequestImpl.resetOriginalValues();
107    
108                    return membershipRequestImpl;
109            }
110    
111            public void readExternal(ObjectInput objectInput) throws IOException {
112                    membershipRequestId = objectInput.readLong();
113                    groupId = objectInput.readLong();
114                    companyId = objectInput.readLong();
115                    userId = objectInput.readLong();
116                    createDate = objectInput.readLong();
117                    comments = objectInput.readUTF();
118                    replyComments = objectInput.readUTF();
119                    replyDate = objectInput.readLong();
120                    replierUserId = objectInput.readLong();
121                    statusId = objectInput.readInt();
122            }
123    
124            public void writeExternal(ObjectOutput objectOutput)
125                    throws IOException {
126                    objectOutput.writeLong(membershipRequestId);
127                    objectOutput.writeLong(groupId);
128                    objectOutput.writeLong(companyId);
129                    objectOutput.writeLong(userId);
130                    objectOutput.writeLong(createDate);
131    
132                    if (comments == null) {
133                            objectOutput.writeUTF(StringPool.BLANK);
134                    }
135                    else {
136                            objectOutput.writeUTF(comments);
137                    }
138    
139                    if (replyComments == null) {
140                            objectOutput.writeUTF(StringPool.BLANK);
141                    }
142                    else {
143                            objectOutput.writeUTF(replyComments);
144                    }
145    
146                    objectOutput.writeLong(replyDate);
147                    objectOutput.writeLong(replierUserId);
148                    objectOutput.writeInt(statusId);
149            }
150    
151            public long membershipRequestId;
152            public long groupId;
153            public long companyId;
154            public long userId;
155            public long createDate;
156            public String comments;
157            public String replyComments;
158            public long replyDate;
159            public long replierUserId;
160            public int statusId;
161    }