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            public MBBan toEntityModel() {
066                    MBBanImpl mbBanImpl = new MBBanImpl();
067    
068                    if (uuid == null) {
069                            mbBanImpl.setUuid(StringPool.BLANK);
070                    }
071                    else {
072                            mbBanImpl.setUuid(uuid);
073                    }
074    
075                    mbBanImpl.setBanId(banId);
076                    mbBanImpl.setGroupId(groupId);
077                    mbBanImpl.setCompanyId(companyId);
078                    mbBanImpl.setUserId(userId);
079    
080                    if (userName == null) {
081                            mbBanImpl.setUserName(StringPool.BLANK);
082                    }
083                    else {
084                            mbBanImpl.setUserName(userName);
085                    }
086    
087                    if (createDate == Long.MIN_VALUE) {
088                            mbBanImpl.setCreateDate(null);
089                    }
090                    else {
091                            mbBanImpl.setCreateDate(new Date(createDate));
092                    }
093    
094                    if (modifiedDate == Long.MIN_VALUE) {
095                            mbBanImpl.setModifiedDate(null);
096                    }
097                    else {
098                            mbBanImpl.setModifiedDate(new Date(modifiedDate));
099                    }
100    
101                    mbBanImpl.setBanUserId(banUserId);
102    
103                    mbBanImpl.resetOriginalValues();
104    
105                    return mbBanImpl;
106            }
107    
108            public void readExternal(ObjectInput objectInput) throws IOException {
109                    uuid = objectInput.readUTF();
110                    banId = objectInput.readLong();
111                    groupId = objectInput.readLong();
112                    companyId = objectInput.readLong();
113                    userId = objectInput.readLong();
114                    userName = objectInput.readUTF();
115                    createDate = objectInput.readLong();
116                    modifiedDate = objectInput.readLong();
117                    banUserId = objectInput.readLong();
118            }
119    
120            public void writeExternal(ObjectOutput objectOutput)
121                    throws IOException {
122                    if (uuid == null) {
123                            objectOutput.writeUTF(StringPool.BLANK);
124                    }
125                    else {
126                            objectOutput.writeUTF(uuid);
127                    }
128    
129                    objectOutput.writeLong(banId);
130                    objectOutput.writeLong(groupId);
131                    objectOutput.writeLong(companyId);
132                    objectOutput.writeLong(userId);
133    
134                    if (userName == null) {
135                            objectOutput.writeUTF(StringPool.BLANK);
136                    }
137                    else {
138                            objectOutput.writeUTF(userName);
139                    }
140    
141                    objectOutput.writeLong(createDate);
142                    objectOutput.writeLong(modifiedDate);
143                    objectOutput.writeLong(banUserId);
144            }
145    
146            public String uuid;
147            public long banId;
148            public long groupId;
149            public long companyId;
150            public long userId;
151            public String userName;
152            public long createDate;
153            public long modifiedDate;
154            public long banUserId;
155    }