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