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.JournalContentSearch;
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 JournalContentSearch in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see JournalContentSearch
035     * @generated
036     */
037    @ProviderType
038    public class JournalContentSearchCacheModel implements CacheModel<JournalContentSearch>,
039            Externalizable {
040            @Override
041            public String toString() {
042                    StringBundler sb = new StringBundler(15);
043    
044                    sb.append("{contentSearchId=");
045                    sb.append(contentSearchId);
046                    sb.append(", groupId=");
047                    sb.append(groupId);
048                    sb.append(", companyId=");
049                    sb.append(companyId);
050                    sb.append(", privateLayout=");
051                    sb.append(privateLayout);
052                    sb.append(", layoutId=");
053                    sb.append(layoutId);
054                    sb.append(", portletId=");
055                    sb.append(portletId);
056                    sb.append(", articleId=");
057                    sb.append(articleId);
058                    sb.append("}");
059    
060                    return sb.toString();
061            }
062    
063            @Override
064            public JournalContentSearch toEntityModel() {
065                    JournalContentSearchImpl journalContentSearchImpl = new JournalContentSearchImpl();
066    
067                    journalContentSearchImpl.setContentSearchId(contentSearchId);
068                    journalContentSearchImpl.setGroupId(groupId);
069                    journalContentSearchImpl.setCompanyId(companyId);
070                    journalContentSearchImpl.setPrivateLayout(privateLayout);
071                    journalContentSearchImpl.setLayoutId(layoutId);
072    
073                    if (portletId == null) {
074                            journalContentSearchImpl.setPortletId(StringPool.BLANK);
075                    }
076                    else {
077                            journalContentSearchImpl.setPortletId(portletId);
078                    }
079    
080                    if (articleId == null) {
081                            journalContentSearchImpl.setArticleId(StringPool.BLANK);
082                    }
083                    else {
084                            journalContentSearchImpl.setArticleId(articleId);
085                    }
086    
087                    journalContentSearchImpl.resetOriginalValues();
088    
089                    return journalContentSearchImpl;
090            }
091    
092            @Override
093            public void readExternal(ObjectInput objectInput) throws IOException {
094                    contentSearchId = objectInput.readLong();
095                    groupId = objectInput.readLong();
096                    companyId = objectInput.readLong();
097                    privateLayout = objectInput.readBoolean();
098                    layoutId = objectInput.readLong();
099                    portletId = objectInput.readUTF();
100                    articleId = objectInput.readUTF();
101            }
102    
103            @Override
104            public void writeExternal(ObjectOutput objectOutput)
105                    throws IOException {
106                    objectOutput.writeLong(contentSearchId);
107                    objectOutput.writeLong(groupId);
108                    objectOutput.writeLong(companyId);
109                    objectOutput.writeBoolean(privateLayout);
110                    objectOutput.writeLong(layoutId);
111    
112                    if (portletId == null) {
113                            objectOutput.writeUTF(StringPool.BLANK);
114                    }
115                    else {
116                            objectOutput.writeUTF(portletId);
117                    }
118    
119                    if (articleId == null) {
120                            objectOutput.writeUTF(StringPool.BLANK);
121                    }
122                    else {
123                            objectOutput.writeUTF(articleId);
124                    }
125            }
126    
127            public long contentSearchId;
128            public long groupId;
129            public long companyId;
130            public boolean privateLayout;
131            public long layoutId;
132            public String portletId;
133            public String articleId;
134    }