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.HashUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.model.CacheModel;
023    
024    import com.liferay.portlet.journal.model.JournalContentSearch;
025    
026    import java.io.Externalizable;
027    import java.io.IOException;
028    import java.io.ObjectInput;
029    import java.io.ObjectOutput;
030    
031    /**
032     * The cache model class for representing JournalContentSearch in entity cache.
033     *
034     * @author Brian Wing Shun Chan
035     * @see JournalContentSearch
036     * @generated
037     */
038    @ProviderType
039    public class JournalContentSearchCacheModel implements CacheModel<JournalContentSearch>,
040            Externalizable {
041            @Override
042            public boolean equals(Object obj) {
043                    if (this == obj) {
044                            return true;
045                    }
046    
047                    if (!(obj instanceof JournalContentSearchCacheModel)) {
048                            return false;
049                    }
050    
051                    JournalContentSearchCacheModel journalContentSearchCacheModel = (JournalContentSearchCacheModel)obj;
052    
053                    if (contentSearchId == journalContentSearchCacheModel.contentSearchId) {
054                            return true;
055                    }
056    
057                    return false;
058            }
059    
060            @Override
061            public int hashCode() {
062                    return HashUtil.hash(0, contentSearchId);
063            }
064    
065            @Override
066            public String toString() {
067                    StringBundler sb = new StringBundler(15);
068    
069                    sb.append("{contentSearchId=");
070                    sb.append(contentSearchId);
071                    sb.append(", groupId=");
072                    sb.append(groupId);
073                    sb.append(", companyId=");
074                    sb.append(companyId);
075                    sb.append(", privateLayout=");
076                    sb.append(privateLayout);
077                    sb.append(", layoutId=");
078                    sb.append(layoutId);
079                    sb.append(", portletId=");
080                    sb.append(portletId);
081                    sb.append(", articleId=");
082                    sb.append(articleId);
083                    sb.append("}");
084    
085                    return sb.toString();
086            }
087    
088            @Override
089            public JournalContentSearch toEntityModel() {
090                    JournalContentSearchImpl journalContentSearchImpl = new JournalContentSearchImpl();
091    
092                    journalContentSearchImpl.setContentSearchId(contentSearchId);
093                    journalContentSearchImpl.setGroupId(groupId);
094                    journalContentSearchImpl.setCompanyId(companyId);
095                    journalContentSearchImpl.setPrivateLayout(privateLayout);
096                    journalContentSearchImpl.setLayoutId(layoutId);
097    
098                    if (portletId == null) {
099                            journalContentSearchImpl.setPortletId(StringPool.BLANK);
100                    }
101                    else {
102                            journalContentSearchImpl.setPortletId(portletId);
103                    }
104    
105                    if (articleId == null) {
106                            journalContentSearchImpl.setArticleId(StringPool.BLANK);
107                    }
108                    else {
109                            journalContentSearchImpl.setArticleId(articleId);
110                    }
111    
112                    journalContentSearchImpl.resetOriginalValues();
113    
114                    return journalContentSearchImpl;
115            }
116    
117            @Override
118            public void readExternal(ObjectInput objectInput) throws IOException {
119                    contentSearchId = objectInput.readLong();
120                    groupId = objectInput.readLong();
121                    companyId = objectInput.readLong();
122                    privateLayout = objectInput.readBoolean();
123                    layoutId = objectInput.readLong();
124                    portletId = objectInput.readUTF();
125                    articleId = objectInput.readUTF();
126            }
127    
128            @Override
129            public void writeExternal(ObjectOutput objectOutput)
130                    throws IOException {
131                    objectOutput.writeLong(contentSearchId);
132                    objectOutput.writeLong(groupId);
133                    objectOutput.writeLong(companyId);
134                    objectOutput.writeBoolean(privateLayout);
135                    objectOutput.writeLong(layoutId);
136    
137                    if (portletId == null) {
138                            objectOutput.writeUTF(StringPool.BLANK);
139                    }
140                    else {
141                            objectOutput.writeUTF(portletId);
142                    }
143    
144                    if (articleId == null) {
145                            objectOutput.writeUTF(StringPool.BLANK);
146                    }
147                    else {
148                            objectOutput.writeUTF(articleId);
149                    }
150            }
151    
152            public long contentSearchId;
153            public long groupId;
154            public long companyId;
155            public boolean privateLayout;
156            public long layoutId;
157            public String portletId;
158            public String articleId;
159    }