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