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