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.WikiPage;
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 WikiPage in entity cache.
034     *
035     * @author Brian Wing Shun Chan
036     * @see WikiPage
037     * @generated
038     */
039    @ProviderType
040    public class WikiPageCacheModel implements CacheModel<WikiPage>, Externalizable {
041            @Override
042            public String toString() {
043                    StringBundler sb = new StringBundler(47);
044    
045                    sb.append("{uuid=");
046                    sb.append(uuid);
047                    sb.append(", pageId=");
048                    sb.append(pageId);
049                    sb.append(", resourcePrimKey=");
050                    sb.append(resourcePrimKey);
051                    sb.append(", groupId=");
052                    sb.append(groupId);
053                    sb.append(", companyId=");
054                    sb.append(companyId);
055                    sb.append(", userId=");
056                    sb.append(userId);
057                    sb.append(", userName=");
058                    sb.append(userName);
059                    sb.append(", createDate=");
060                    sb.append(createDate);
061                    sb.append(", modifiedDate=");
062                    sb.append(modifiedDate);
063                    sb.append(", nodeId=");
064                    sb.append(nodeId);
065                    sb.append(", title=");
066                    sb.append(title);
067                    sb.append(", version=");
068                    sb.append(version);
069                    sb.append(", minorEdit=");
070                    sb.append(minorEdit);
071                    sb.append(", content=");
072                    sb.append(content);
073                    sb.append(", summary=");
074                    sb.append(summary);
075                    sb.append(", format=");
076                    sb.append(format);
077                    sb.append(", head=");
078                    sb.append(head);
079                    sb.append(", parentTitle=");
080                    sb.append(parentTitle);
081                    sb.append(", redirectTitle=");
082                    sb.append(redirectTitle);
083                    sb.append(", status=");
084                    sb.append(status);
085                    sb.append(", statusByUserId=");
086                    sb.append(statusByUserId);
087                    sb.append(", statusByUserName=");
088                    sb.append(statusByUserName);
089                    sb.append(", statusDate=");
090                    sb.append(statusDate);
091                    sb.append("}");
092    
093                    return sb.toString();
094            }
095    
096            @Override
097            public WikiPage toEntityModel() {
098                    WikiPageImpl wikiPageImpl = new WikiPageImpl();
099    
100                    if (uuid == null) {
101                            wikiPageImpl.setUuid(StringPool.BLANK);
102                    }
103                    else {
104                            wikiPageImpl.setUuid(uuid);
105                    }
106    
107                    wikiPageImpl.setPageId(pageId);
108                    wikiPageImpl.setResourcePrimKey(resourcePrimKey);
109                    wikiPageImpl.setGroupId(groupId);
110                    wikiPageImpl.setCompanyId(companyId);
111                    wikiPageImpl.setUserId(userId);
112    
113                    if (userName == null) {
114                            wikiPageImpl.setUserName(StringPool.BLANK);
115                    }
116                    else {
117                            wikiPageImpl.setUserName(userName);
118                    }
119    
120                    if (createDate == Long.MIN_VALUE) {
121                            wikiPageImpl.setCreateDate(null);
122                    }
123                    else {
124                            wikiPageImpl.setCreateDate(new Date(createDate));
125                    }
126    
127                    if (modifiedDate == Long.MIN_VALUE) {
128                            wikiPageImpl.setModifiedDate(null);
129                    }
130                    else {
131                            wikiPageImpl.setModifiedDate(new Date(modifiedDate));
132                    }
133    
134                    wikiPageImpl.setNodeId(nodeId);
135    
136                    if (title == null) {
137                            wikiPageImpl.setTitle(StringPool.BLANK);
138                    }
139                    else {
140                            wikiPageImpl.setTitle(title);
141                    }
142    
143                    wikiPageImpl.setVersion(version);
144                    wikiPageImpl.setMinorEdit(minorEdit);
145    
146                    if (content == null) {
147                            wikiPageImpl.setContent(StringPool.BLANK);
148                    }
149                    else {
150                            wikiPageImpl.setContent(content);
151                    }
152    
153                    if (summary == null) {
154                            wikiPageImpl.setSummary(StringPool.BLANK);
155                    }
156                    else {
157                            wikiPageImpl.setSummary(summary);
158                    }
159    
160                    if (format == null) {
161                            wikiPageImpl.setFormat(StringPool.BLANK);
162                    }
163                    else {
164                            wikiPageImpl.setFormat(format);
165                    }
166    
167                    wikiPageImpl.setHead(head);
168    
169                    if (parentTitle == null) {
170                            wikiPageImpl.setParentTitle(StringPool.BLANK);
171                    }
172                    else {
173                            wikiPageImpl.setParentTitle(parentTitle);
174                    }
175    
176                    if (redirectTitle == null) {
177                            wikiPageImpl.setRedirectTitle(StringPool.BLANK);
178                    }
179                    else {
180                            wikiPageImpl.setRedirectTitle(redirectTitle);
181                    }
182    
183                    wikiPageImpl.setStatus(status);
184                    wikiPageImpl.setStatusByUserId(statusByUserId);
185    
186                    if (statusByUserName == null) {
187                            wikiPageImpl.setStatusByUserName(StringPool.BLANK);
188                    }
189                    else {
190                            wikiPageImpl.setStatusByUserName(statusByUserName);
191                    }
192    
193                    if (statusDate == Long.MIN_VALUE) {
194                            wikiPageImpl.setStatusDate(null);
195                    }
196                    else {
197                            wikiPageImpl.setStatusDate(new Date(statusDate));
198                    }
199    
200                    wikiPageImpl.resetOriginalValues();
201    
202                    return wikiPageImpl;
203            }
204    
205            @Override
206            public void readExternal(ObjectInput objectInput) throws IOException {
207                    uuid = objectInput.readUTF();
208                    pageId = objectInput.readLong();
209                    resourcePrimKey = objectInput.readLong();
210                    groupId = objectInput.readLong();
211                    companyId = objectInput.readLong();
212                    userId = objectInput.readLong();
213                    userName = objectInput.readUTF();
214                    createDate = objectInput.readLong();
215                    modifiedDate = objectInput.readLong();
216                    nodeId = objectInput.readLong();
217                    title = objectInput.readUTF();
218                    version = objectInput.readDouble();
219                    minorEdit = objectInput.readBoolean();
220                    content = objectInput.readUTF();
221                    summary = objectInput.readUTF();
222                    format = objectInput.readUTF();
223                    head = objectInput.readBoolean();
224                    parentTitle = objectInput.readUTF();
225                    redirectTitle = objectInput.readUTF();
226                    status = objectInput.readInt();
227                    statusByUserId = objectInput.readLong();
228                    statusByUserName = objectInput.readUTF();
229                    statusDate = objectInput.readLong();
230            }
231    
232            @Override
233            public void writeExternal(ObjectOutput objectOutput)
234                    throws IOException {
235                    if (uuid == null) {
236                            objectOutput.writeUTF(StringPool.BLANK);
237                    }
238                    else {
239                            objectOutput.writeUTF(uuid);
240                    }
241    
242                    objectOutput.writeLong(pageId);
243                    objectOutput.writeLong(resourcePrimKey);
244                    objectOutput.writeLong(groupId);
245                    objectOutput.writeLong(companyId);
246                    objectOutput.writeLong(userId);
247    
248                    if (userName == null) {
249                            objectOutput.writeUTF(StringPool.BLANK);
250                    }
251                    else {
252                            objectOutput.writeUTF(userName);
253                    }
254    
255                    objectOutput.writeLong(createDate);
256                    objectOutput.writeLong(modifiedDate);
257                    objectOutput.writeLong(nodeId);
258    
259                    if (title == null) {
260                            objectOutput.writeUTF(StringPool.BLANK);
261                    }
262                    else {
263                            objectOutput.writeUTF(title);
264                    }
265    
266                    objectOutput.writeDouble(version);
267                    objectOutput.writeBoolean(minorEdit);
268    
269                    if (content == null) {
270                            objectOutput.writeUTF(StringPool.BLANK);
271                    }
272                    else {
273                            objectOutput.writeUTF(content);
274                    }
275    
276                    if (summary == null) {
277                            objectOutput.writeUTF(StringPool.BLANK);
278                    }
279                    else {
280                            objectOutput.writeUTF(summary);
281                    }
282    
283                    if (format == null) {
284                            objectOutput.writeUTF(StringPool.BLANK);
285                    }
286                    else {
287                            objectOutput.writeUTF(format);
288                    }
289    
290                    objectOutput.writeBoolean(head);
291    
292                    if (parentTitle == null) {
293                            objectOutput.writeUTF(StringPool.BLANK);
294                    }
295                    else {
296                            objectOutput.writeUTF(parentTitle);
297                    }
298    
299                    if (redirectTitle == null) {
300                            objectOutput.writeUTF(StringPool.BLANK);
301                    }
302                    else {
303                            objectOutput.writeUTF(redirectTitle);
304                    }
305    
306                    objectOutput.writeInt(status);
307                    objectOutput.writeLong(statusByUserId);
308    
309                    if (statusByUserName == null) {
310                            objectOutput.writeUTF(StringPool.BLANK);
311                    }
312                    else {
313                            objectOutput.writeUTF(statusByUserName);
314                    }
315    
316                    objectOutput.writeLong(statusDate);
317            }
318    
319            public String uuid;
320            public long pageId;
321            public long resourcePrimKey;
322            public long groupId;
323            public long companyId;
324            public long userId;
325            public String userName;
326            public long createDate;
327            public long modifiedDate;
328            public long nodeId;
329            public String title;
330            public double version;
331            public boolean minorEdit;
332            public String content;
333            public String summary;
334            public String format;
335            public boolean head;
336            public String parentTitle;
337            public String redirectTitle;
338            public int status;
339            public long statusByUserId;
340            public String statusByUserName;
341            public long statusDate;
342    }