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.wiki.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.wiki.model.WikiNode;
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 WikiNode in entity cache.
034     *
035     * @author Brian Wing Shun Chan
036     * @see WikiNode
037     * @generated
038     */
039    @ProviderType
040    public class WikiNodeCacheModel implements CacheModel<WikiNode>, Externalizable {
041            @Override
042            public String toString() {
043                    StringBundler sb = new StringBundler(31);
044    
045                    sb.append("{uuid=");
046                    sb.append(uuid);
047                    sb.append(", nodeId=");
048                    sb.append(nodeId);
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(", name=");
062                    sb.append(name);
063                    sb.append(", description=");
064                    sb.append(description);
065                    sb.append(", lastPostDate=");
066                    sb.append(lastPostDate);
067                    sb.append(", status=");
068                    sb.append(status);
069                    sb.append(", statusByUserId=");
070                    sb.append(statusByUserId);
071                    sb.append(", statusByUserName=");
072                    sb.append(statusByUserName);
073                    sb.append(", statusDate=");
074                    sb.append(statusDate);
075                    sb.append("}");
076    
077                    return sb.toString();
078            }
079    
080            @Override
081            public WikiNode toEntityModel() {
082                    WikiNodeImpl wikiNodeImpl = new WikiNodeImpl();
083    
084                    if (uuid == null) {
085                            wikiNodeImpl.setUuid(StringPool.BLANK);
086                    }
087                    else {
088                            wikiNodeImpl.setUuid(uuid);
089                    }
090    
091                    wikiNodeImpl.setNodeId(nodeId);
092                    wikiNodeImpl.setGroupId(groupId);
093                    wikiNodeImpl.setCompanyId(companyId);
094                    wikiNodeImpl.setUserId(userId);
095    
096                    if (userName == null) {
097                            wikiNodeImpl.setUserName(StringPool.BLANK);
098                    }
099                    else {
100                            wikiNodeImpl.setUserName(userName);
101                    }
102    
103                    if (createDate == Long.MIN_VALUE) {
104                            wikiNodeImpl.setCreateDate(null);
105                    }
106                    else {
107                            wikiNodeImpl.setCreateDate(new Date(createDate));
108                    }
109    
110                    if (modifiedDate == Long.MIN_VALUE) {
111                            wikiNodeImpl.setModifiedDate(null);
112                    }
113                    else {
114                            wikiNodeImpl.setModifiedDate(new Date(modifiedDate));
115                    }
116    
117                    if (name == null) {
118                            wikiNodeImpl.setName(StringPool.BLANK);
119                    }
120                    else {
121                            wikiNodeImpl.setName(name);
122                    }
123    
124                    if (description == null) {
125                            wikiNodeImpl.setDescription(StringPool.BLANK);
126                    }
127                    else {
128                            wikiNodeImpl.setDescription(description);
129                    }
130    
131                    if (lastPostDate == Long.MIN_VALUE) {
132                            wikiNodeImpl.setLastPostDate(null);
133                    }
134                    else {
135                            wikiNodeImpl.setLastPostDate(new Date(lastPostDate));
136                    }
137    
138                    wikiNodeImpl.setStatus(status);
139                    wikiNodeImpl.setStatusByUserId(statusByUserId);
140    
141                    if (statusByUserName == null) {
142                            wikiNodeImpl.setStatusByUserName(StringPool.BLANK);
143                    }
144                    else {
145                            wikiNodeImpl.setStatusByUserName(statusByUserName);
146                    }
147    
148                    if (statusDate == Long.MIN_VALUE) {
149                            wikiNodeImpl.setStatusDate(null);
150                    }
151                    else {
152                            wikiNodeImpl.setStatusDate(new Date(statusDate));
153                    }
154    
155                    wikiNodeImpl.resetOriginalValues();
156    
157                    return wikiNodeImpl;
158            }
159    
160            @Override
161            public void readExternal(ObjectInput objectInput) throws IOException {
162                    uuid = objectInput.readUTF();
163                    nodeId = objectInput.readLong();
164                    groupId = objectInput.readLong();
165                    companyId = objectInput.readLong();
166                    userId = objectInput.readLong();
167                    userName = objectInput.readUTF();
168                    createDate = objectInput.readLong();
169                    modifiedDate = objectInput.readLong();
170                    name = objectInput.readUTF();
171                    description = objectInput.readUTF();
172                    lastPostDate = objectInput.readLong();
173                    status = objectInput.readInt();
174                    statusByUserId = objectInput.readLong();
175                    statusByUserName = objectInput.readUTF();
176                    statusDate = objectInput.readLong();
177            }
178    
179            @Override
180            public void writeExternal(ObjectOutput objectOutput)
181                    throws IOException {
182                    if (uuid == null) {
183                            objectOutput.writeUTF(StringPool.BLANK);
184                    }
185                    else {
186                            objectOutput.writeUTF(uuid);
187                    }
188    
189                    objectOutput.writeLong(nodeId);
190                    objectOutput.writeLong(groupId);
191                    objectOutput.writeLong(companyId);
192                    objectOutput.writeLong(userId);
193    
194                    if (userName == null) {
195                            objectOutput.writeUTF(StringPool.BLANK);
196                    }
197                    else {
198                            objectOutput.writeUTF(userName);
199                    }
200    
201                    objectOutput.writeLong(createDate);
202                    objectOutput.writeLong(modifiedDate);
203    
204                    if (name == null) {
205                            objectOutput.writeUTF(StringPool.BLANK);
206                    }
207                    else {
208                            objectOutput.writeUTF(name);
209                    }
210    
211                    if (description == null) {
212                            objectOutput.writeUTF(StringPool.BLANK);
213                    }
214                    else {
215                            objectOutput.writeUTF(description);
216                    }
217    
218                    objectOutput.writeLong(lastPostDate);
219                    objectOutput.writeInt(status);
220                    objectOutput.writeLong(statusByUserId);
221    
222                    if (statusByUserName == null) {
223                            objectOutput.writeUTF(StringPool.BLANK);
224                    }
225                    else {
226                            objectOutput.writeUTF(statusByUserName);
227                    }
228    
229                    objectOutput.writeLong(statusDate);
230            }
231    
232            public String uuid;
233            public long nodeId;
234            public long groupId;
235            public long companyId;
236            public long userId;
237            public String userName;
238            public long createDate;
239            public long modifiedDate;
240            public String name;
241            public String description;
242            public long lastPostDate;
243            public int status;
244            public long statusByUserId;
245            public String statusByUserName;
246            public long statusDate;
247    }