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.journal.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.journal.model.JournalArticleResource;
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 JournalArticleResource in entity cache.
030     *
031     * @author Brian Wing Shun Chan
032     * @see JournalArticleResource
033     * @generated
034     */
035    public class JournalArticleResourceCacheModel implements CacheModel<JournalArticleResource>,
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(", groupId=");
046                    sb.append(groupId);
047                    sb.append(", articleId=");
048                    sb.append(articleId);
049                    sb.append("}");
050    
051                    return sb.toString();
052            }
053    
054            public JournalArticleResource toEntityModel() {
055                    JournalArticleResourceImpl journalArticleResourceImpl = new JournalArticleResourceImpl();
056    
057                    if (uuid == null) {
058                            journalArticleResourceImpl.setUuid(StringPool.BLANK);
059                    }
060                    else {
061                            journalArticleResourceImpl.setUuid(uuid);
062                    }
063    
064                    journalArticleResourceImpl.setResourcePrimKey(resourcePrimKey);
065                    journalArticleResourceImpl.setGroupId(groupId);
066    
067                    if (articleId == null) {
068                            journalArticleResourceImpl.setArticleId(StringPool.BLANK);
069                    }
070                    else {
071                            journalArticleResourceImpl.setArticleId(articleId);
072                    }
073    
074                    journalArticleResourceImpl.resetOriginalValues();
075    
076                    return journalArticleResourceImpl;
077            }
078    
079            public void readExternal(ObjectInput objectInput) throws IOException {
080                    uuid = objectInput.readUTF();
081                    resourcePrimKey = objectInput.readLong();
082                    groupId = objectInput.readLong();
083                    articleId = 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(groupId);
097    
098                    if (articleId == null) {
099                            objectOutput.writeUTF(StringPool.BLANK);
100                    }
101                    else {
102                            objectOutput.writeUTF(articleId);
103                    }
104            }
105    
106            public String uuid;
107            public long resourcePrimKey;
108            public long groupId;
109            public String articleId;
110    }