001    /**
002     * Copyright (c) 2000-2012 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.WikiPageResource;
022    
023    import java.io.Externalizable;
024    import java.io.IOException;
025    import java.io.ObjectInput;
026    import java.io.ObjectOutput;
027    
028    /**
029     * The cache model class for representing WikiPageResource in entity cache.
030     *
031     * @author Brian Wing Shun Chan
032     * @see WikiPageResource
033     * @generated
034     */
035    public class WikiPageResourceCacheModel implements CacheModel<WikiPageResource>,
036            Externalizable {
037            @Override
038            public String toString() {
039                    StringBundler sb = new StringBundler(9);
040    
041                    sb.append("{uuid=");
042                    sb.append(uuid);
043                    sb.append(", resourcePrimKey=");
044                    sb.append(resourcePrimKey);
045                    sb.append(", nodeId=");
046                    sb.append(nodeId);
047                    sb.append(", title=");
048                    sb.append(title);
049                    sb.append("}");
050    
051                    return sb.toString();
052            }
053    
054            public WikiPageResource toEntityModel() {
055                    WikiPageResourceImpl wikiPageResourceImpl = new WikiPageResourceImpl();
056    
057                    if (uuid == null) {
058                            wikiPageResourceImpl.setUuid(StringPool.BLANK);
059                    }
060                    else {
061                            wikiPageResourceImpl.setUuid(uuid);
062                    }
063    
064                    wikiPageResourceImpl.setResourcePrimKey(resourcePrimKey);
065                    wikiPageResourceImpl.setNodeId(nodeId);
066    
067                    if (title == null) {
068                            wikiPageResourceImpl.setTitle(StringPool.BLANK);
069                    }
070                    else {
071                            wikiPageResourceImpl.setTitle(title);
072                    }
073    
074                    wikiPageResourceImpl.resetOriginalValues();
075    
076                    return wikiPageResourceImpl;
077            }
078    
079            public void readExternal(ObjectInput objectInput) throws IOException {
080                    uuid = objectInput.readUTF();
081                    resourcePrimKey = objectInput.readLong();
082                    nodeId = objectInput.readLong();
083                    title = objectInput.readUTF();
084            }
085    
086            public void writeExternal(ObjectOutput objectOutput)
087                    throws IOException {
088                    if (uuid == null) {
089                            objectOutput.writeUTF(StringPool.BLANK);
090                    }
091                    else {
092                            objectOutput.writeUTF(uuid);
093                    }
094    
095                    objectOutput.writeLong(resourcePrimKey);
096                    objectOutput.writeLong(nodeId);
097    
098                    if (title == null) {
099                            objectOutput.writeUTF(StringPool.BLANK);
100                    }
101                    else {
102                            objectOutput.writeUTF(title);
103                    }
104            }
105    
106            public String uuid;
107            public long resourcePrimKey;
108            public long nodeId;
109            public String title;
110    }