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.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            public JournalContentSearch toEntityModel() {
061                    JournalContentSearchImpl journalContentSearchImpl = new JournalContentSearchImpl();
062    
063                    journalContentSearchImpl.setContentSearchId(contentSearchId);
064                    journalContentSearchImpl.setGroupId(groupId);
065                    journalContentSearchImpl.setCompanyId(companyId);
066                    journalContentSearchImpl.setPrivateLayout(privateLayout);
067                    journalContentSearchImpl.setLayoutId(layoutId);
068    
069                    if (portletId == null) {
070                            journalContentSearchImpl.setPortletId(StringPool.BLANK);
071                    }
072                    else {
073                            journalContentSearchImpl.setPortletId(portletId);
074                    }
075    
076                    if (articleId == null) {
077                            journalContentSearchImpl.setArticleId(StringPool.BLANK);
078                    }
079                    else {
080                            journalContentSearchImpl.setArticleId(articleId);
081                    }
082    
083                    journalContentSearchImpl.resetOriginalValues();
084    
085                    return journalContentSearchImpl;
086            }
087    
088            public void readExternal(ObjectInput objectInput) throws IOException {
089                    contentSearchId = objectInput.readLong();
090                    groupId = objectInput.readLong();
091                    companyId = objectInput.readLong();
092                    privateLayout = objectInput.readBoolean();
093                    layoutId = objectInput.readLong();
094                    portletId = objectInput.readUTF();
095                    articleId = objectInput.readUTF();
096            }
097    
098            public void writeExternal(ObjectOutput objectOutput)
099                    throws IOException {
100                    objectOutput.writeLong(contentSearchId);
101                    objectOutput.writeLong(groupId);
102                    objectOutput.writeLong(companyId);
103                    objectOutput.writeBoolean(privateLayout);
104                    objectOutput.writeLong(layoutId);
105    
106                    if (portletId == null) {
107                            objectOutput.writeUTF(StringPool.BLANK);
108                    }
109                    else {
110                            objectOutput.writeUTF(portletId);
111                    }
112    
113                    if (articleId == null) {
114                            objectOutput.writeUTF(StringPool.BLANK);
115                    }
116                    else {
117                            objectOutput.writeUTF(articleId);
118                    }
119            }
120    
121            public long contentSearchId;
122            public long groupId;
123            public long companyId;
124            public boolean privateLayout;
125            public long layoutId;
126            public String portletId;
127            public String articleId;
128    }