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.portal.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.model.CacheModel;
020    import com.liferay.portal.kernel.model.LayoutSet;
021    import com.liferay.portal.kernel.model.MVCCModel;
022    import com.liferay.portal.kernel.util.HashUtil;
023    import com.liferay.portal.kernel.util.StringBundler;
024    import com.liferay.portal.kernel.util.StringPool;
025    
026    import java.io.Externalizable;
027    import java.io.IOException;
028    import java.io.ObjectInput;
029    import java.io.ObjectOutput;
030    
031    import java.util.Date;
032    
033    /**
034     * The cache model class for representing LayoutSet in entity cache.
035     *
036     * @author Brian Wing Shun Chan
037     * @see LayoutSet
038     * @generated
039     */
040    @ProviderType
041    public class LayoutSetCacheModel implements CacheModel<LayoutSet>,
042            Externalizable, MVCCModel {
043            @Override
044            public boolean equals(Object obj) {
045                    if (this == obj) {
046                            return true;
047                    }
048    
049                    if (!(obj instanceof LayoutSetCacheModel)) {
050                            return false;
051                    }
052    
053                    LayoutSetCacheModel layoutSetCacheModel = (LayoutSetCacheModel)obj;
054    
055                    if ((layoutSetId == layoutSetCacheModel.layoutSetId) &&
056                                    (mvccVersion == layoutSetCacheModel.mvccVersion)) {
057                            return true;
058                    }
059    
060                    return false;
061            }
062    
063            @Override
064            public int hashCode() {
065                    int hashCode = HashUtil.hash(0, layoutSetId);
066    
067                    return HashUtil.hash(hashCode, mvccVersion);
068            }
069    
070            @Override
071            public long getMvccVersion() {
072                    return mvccVersion;
073            }
074    
075            @Override
076            public void setMvccVersion(long mvccVersion) {
077                    this.mvccVersion = mvccVersion;
078            }
079    
080            @Override
081            public String toString() {
082                    StringBundler sb = new StringBundler(31);
083    
084                    sb.append("{mvccVersion=");
085                    sb.append(mvccVersion);
086                    sb.append(", layoutSetId=");
087                    sb.append(layoutSetId);
088                    sb.append(", groupId=");
089                    sb.append(groupId);
090                    sb.append(", companyId=");
091                    sb.append(companyId);
092                    sb.append(", createDate=");
093                    sb.append(createDate);
094                    sb.append(", modifiedDate=");
095                    sb.append(modifiedDate);
096                    sb.append(", privateLayout=");
097                    sb.append(privateLayout);
098                    sb.append(", logoId=");
099                    sb.append(logoId);
100                    sb.append(", themeId=");
101                    sb.append(themeId);
102                    sb.append(", colorSchemeId=");
103                    sb.append(colorSchemeId);
104                    sb.append(", css=");
105                    sb.append(css);
106                    sb.append(", pageCount=");
107                    sb.append(pageCount);
108                    sb.append(", settings=");
109                    sb.append(settings);
110                    sb.append(", layoutSetPrototypeUuid=");
111                    sb.append(layoutSetPrototypeUuid);
112                    sb.append(", layoutSetPrototypeLinkEnabled=");
113                    sb.append(layoutSetPrototypeLinkEnabled);
114                    sb.append("}");
115    
116                    return sb.toString();
117            }
118    
119            @Override
120            public LayoutSet toEntityModel() {
121                    LayoutSetImpl layoutSetImpl = new LayoutSetImpl();
122    
123                    layoutSetImpl.setMvccVersion(mvccVersion);
124                    layoutSetImpl.setLayoutSetId(layoutSetId);
125                    layoutSetImpl.setGroupId(groupId);
126                    layoutSetImpl.setCompanyId(companyId);
127    
128                    if (createDate == Long.MIN_VALUE) {
129                            layoutSetImpl.setCreateDate(null);
130                    }
131                    else {
132                            layoutSetImpl.setCreateDate(new Date(createDate));
133                    }
134    
135                    if (modifiedDate == Long.MIN_VALUE) {
136                            layoutSetImpl.setModifiedDate(null);
137                    }
138                    else {
139                            layoutSetImpl.setModifiedDate(new Date(modifiedDate));
140                    }
141    
142                    layoutSetImpl.setPrivateLayout(privateLayout);
143                    layoutSetImpl.setLogoId(logoId);
144    
145                    if (themeId == null) {
146                            layoutSetImpl.setThemeId(StringPool.BLANK);
147                    }
148                    else {
149                            layoutSetImpl.setThemeId(themeId);
150                    }
151    
152                    if (colorSchemeId == null) {
153                            layoutSetImpl.setColorSchemeId(StringPool.BLANK);
154                    }
155                    else {
156                            layoutSetImpl.setColorSchemeId(colorSchemeId);
157                    }
158    
159                    if (css == null) {
160                            layoutSetImpl.setCss(StringPool.BLANK);
161                    }
162                    else {
163                            layoutSetImpl.setCss(css);
164                    }
165    
166                    layoutSetImpl.setPageCount(pageCount);
167    
168                    if (settings == null) {
169                            layoutSetImpl.setSettings(StringPool.BLANK);
170                    }
171                    else {
172                            layoutSetImpl.setSettings(settings);
173                    }
174    
175                    if (layoutSetPrototypeUuid == null) {
176                            layoutSetImpl.setLayoutSetPrototypeUuid(StringPool.BLANK);
177                    }
178                    else {
179                            layoutSetImpl.setLayoutSetPrototypeUuid(layoutSetPrototypeUuid);
180                    }
181    
182                    layoutSetImpl.setLayoutSetPrototypeLinkEnabled(layoutSetPrototypeLinkEnabled);
183    
184                    layoutSetImpl.resetOriginalValues();
185    
186                    layoutSetImpl.setCompanyFallbackVirtualHostname(_companyFallbackVirtualHostname);
187    
188                    layoutSetImpl.setVirtualHostname(_virtualHostname);
189    
190                    return layoutSetImpl;
191            }
192    
193            @Override
194            public void readExternal(ObjectInput objectInput)
195                    throws ClassNotFoundException, IOException {
196                    mvccVersion = objectInput.readLong();
197    
198                    layoutSetId = objectInput.readLong();
199    
200                    groupId = objectInput.readLong();
201    
202                    companyId = objectInput.readLong();
203                    createDate = objectInput.readLong();
204                    modifiedDate = objectInput.readLong();
205    
206                    privateLayout = objectInput.readBoolean();
207    
208                    logoId = objectInput.readLong();
209                    themeId = objectInput.readUTF();
210                    colorSchemeId = objectInput.readUTF();
211                    css = objectInput.readUTF();
212    
213                    pageCount = objectInput.readInt();
214                    settings = objectInput.readUTF();
215                    layoutSetPrototypeUuid = objectInput.readUTF();
216    
217                    layoutSetPrototypeLinkEnabled = objectInput.readBoolean();
218    
219                    _companyFallbackVirtualHostname = (java.lang.String)objectInput.readObject();
220                    _virtualHostname = (java.lang.String)objectInput.readObject();
221            }
222    
223            @Override
224            public void writeExternal(ObjectOutput objectOutput)
225                    throws IOException {
226                    objectOutput.writeLong(mvccVersion);
227    
228                    objectOutput.writeLong(layoutSetId);
229    
230                    objectOutput.writeLong(groupId);
231    
232                    objectOutput.writeLong(companyId);
233                    objectOutput.writeLong(createDate);
234                    objectOutput.writeLong(modifiedDate);
235    
236                    objectOutput.writeBoolean(privateLayout);
237    
238                    objectOutput.writeLong(logoId);
239    
240                    if (themeId == null) {
241                            objectOutput.writeUTF(StringPool.BLANK);
242                    }
243                    else {
244                            objectOutput.writeUTF(themeId);
245                    }
246    
247                    if (colorSchemeId == null) {
248                            objectOutput.writeUTF(StringPool.BLANK);
249                    }
250                    else {
251                            objectOutput.writeUTF(colorSchemeId);
252                    }
253    
254                    if (css == null) {
255                            objectOutput.writeUTF(StringPool.BLANK);
256                    }
257                    else {
258                            objectOutput.writeUTF(css);
259                    }
260    
261                    objectOutput.writeInt(pageCount);
262    
263                    if (settings == null) {
264                            objectOutput.writeUTF(StringPool.BLANK);
265                    }
266                    else {
267                            objectOutput.writeUTF(settings);
268                    }
269    
270                    if (layoutSetPrototypeUuid == null) {
271                            objectOutput.writeUTF(StringPool.BLANK);
272                    }
273                    else {
274                            objectOutput.writeUTF(layoutSetPrototypeUuid);
275                    }
276    
277                    objectOutput.writeBoolean(layoutSetPrototypeLinkEnabled);
278    
279                    objectOutput.writeObject(_companyFallbackVirtualHostname);
280                    objectOutput.writeObject(_virtualHostname);
281            }
282    
283            public long mvccVersion;
284            public long layoutSetId;
285            public long groupId;
286            public long companyId;
287            public long createDate;
288            public long modifiedDate;
289            public boolean privateLayout;
290            public long logoId;
291            public String themeId;
292            public String colorSchemeId;
293            public String css;
294            public int pageCount;
295            public String settings;
296            public String layoutSetPrototypeUuid;
297            public boolean layoutSetPrototypeLinkEnabled;
298            public java.lang.String _companyFallbackVirtualHostname;
299            public java.lang.String _virtualHostname;
300    }