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