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