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