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.asset.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.asset.kernel.model.AssetVocabulary;
020    
021    import com.liferay.portal.kernel.model.CacheModel;
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 AssetVocabulary in entity cache.
035     *
036     * @author Brian Wing Shun Chan
037     * @see AssetVocabulary
038     * @generated
039     */
040    @ProviderType
041    public class AssetVocabularyCacheModel implements CacheModel<AssetVocabulary>,
042            Externalizable {
043            @Override
044            public boolean equals(Object obj) {
045                    if (this == obj) {
046                            return true;
047                    }
048    
049                    if (!(obj instanceof AssetVocabularyCacheModel)) {
050                            return false;
051                    }
052    
053                    AssetVocabularyCacheModel assetVocabularyCacheModel = (AssetVocabularyCacheModel)obj;
054    
055                    if (vocabularyId == assetVocabularyCacheModel.vocabularyId) {
056                            return true;
057                    }
058    
059                    return false;
060            }
061    
062            @Override
063            public int hashCode() {
064                    return HashUtil.hash(0, vocabularyId);
065            }
066    
067            @Override
068            public String toString() {
069                    StringBundler sb = new StringBundler(27);
070    
071                    sb.append("{uuid=");
072                    sb.append(uuid);
073                    sb.append(", vocabularyId=");
074                    sb.append(vocabularyId);
075                    sb.append(", groupId=");
076                    sb.append(groupId);
077                    sb.append(", companyId=");
078                    sb.append(companyId);
079                    sb.append(", userId=");
080                    sb.append(userId);
081                    sb.append(", userName=");
082                    sb.append(userName);
083                    sb.append(", createDate=");
084                    sb.append(createDate);
085                    sb.append(", modifiedDate=");
086                    sb.append(modifiedDate);
087                    sb.append(", name=");
088                    sb.append(name);
089                    sb.append(", title=");
090                    sb.append(title);
091                    sb.append(", description=");
092                    sb.append(description);
093                    sb.append(", settings=");
094                    sb.append(settings);
095                    sb.append(", lastPublishDate=");
096                    sb.append(lastPublishDate);
097                    sb.append("}");
098    
099                    return sb.toString();
100            }
101    
102            @Override
103            public AssetVocabulary toEntityModel() {
104                    AssetVocabularyImpl assetVocabularyImpl = new AssetVocabularyImpl();
105    
106                    if (uuid == null) {
107                            assetVocabularyImpl.setUuid(StringPool.BLANK);
108                    }
109                    else {
110                            assetVocabularyImpl.setUuid(uuid);
111                    }
112    
113                    assetVocabularyImpl.setVocabularyId(vocabularyId);
114                    assetVocabularyImpl.setGroupId(groupId);
115                    assetVocabularyImpl.setCompanyId(companyId);
116                    assetVocabularyImpl.setUserId(userId);
117    
118                    if (userName == null) {
119                            assetVocabularyImpl.setUserName(StringPool.BLANK);
120                    }
121                    else {
122                            assetVocabularyImpl.setUserName(userName);
123                    }
124    
125                    if (createDate == Long.MIN_VALUE) {
126                            assetVocabularyImpl.setCreateDate(null);
127                    }
128                    else {
129                            assetVocabularyImpl.setCreateDate(new Date(createDate));
130                    }
131    
132                    if (modifiedDate == Long.MIN_VALUE) {
133                            assetVocabularyImpl.setModifiedDate(null);
134                    }
135                    else {
136                            assetVocabularyImpl.setModifiedDate(new Date(modifiedDate));
137                    }
138    
139                    if (name == null) {
140                            assetVocabularyImpl.setName(StringPool.BLANK);
141                    }
142                    else {
143                            assetVocabularyImpl.setName(name);
144                    }
145    
146                    if (title == null) {
147                            assetVocabularyImpl.setTitle(StringPool.BLANK);
148                    }
149                    else {
150                            assetVocabularyImpl.setTitle(title);
151                    }
152    
153                    if (description == null) {
154                            assetVocabularyImpl.setDescription(StringPool.BLANK);
155                    }
156                    else {
157                            assetVocabularyImpl.setDescription(description);
158                    }
159    
160                    if (settings == null) {
161                            assetVocabularyImpl.setSettings(StringPool.BLANK);
162                    }
163                    else {
164                            assetVocabularyImpl.setSettings(settings);
165                    }
166    
167                    if (lastPublishDate == Long.MIN_VALUE) {
168                            assetVocabularyImpl.setLastPublishDate(null);
169                    }
170                    else {
171                            assetVocabularyImpl.setLastPublishDate(new Date(lastPublishDate));
172                    }
173    
174                    assetVocabularyImpl.resetOriginalValues();
175    
176                    return assetVocabularyImpl;
177            }
178    
179            @Override
180            public void readExternal(ObjectInput objectInput) throws IOException {
181                    uuid = objectInput.readUTF();
182    
183                    vocabularyId = objectInput.readLong();
184    
185                    groupId = objectInput.readLong();
186    
187                    companyId = objectInput.readLong();
188    
189                    userId = objectInput.readLong();
190                    userName = objectInput.readUTF();
191                    createDate = objectInput.readLong();
192                    modifiedDate = objectInput.readLong();
193                    name = objectInput.readUTF();
194                    title = objectInput.readUTF();
195                    description = objectInput.readUTF();
196                    settings = objectInput.readUTF();
197                    lastPublishDate = objectInput.readLong();
198            }
199    
200            @Override
201            public void writeExternal(ObjectOutput objectOutput)
202                    throws IOException {
203                    if (uuid == null) {
204                            objectOutput.writeUTF(StringPool.BLANK);
205                    }
206                    else {
207                            objectOutput.writeUTF(uuid);
208                    }
209    
210                    objectOutput.writeLong(vocabularyId);
211    
212                    objectOutput.writeLong(groupId);
213    
214                    objectOutput.writeLong(companyId);
215    
216                    objectOutput.writeLong(userId);
217    
218                    if (userName == null) {
219                            objectOutput.writeUTF(StringPool.BLANK);
220                    }
221                    else {
222                            objectOutput.writeUTF(userName);
223                    }
224    
225                    objectOutput.writeLong(createDate);
226                    objectOutput.writeLong(modifiedDate);
227    
228                    if (name == null) {
229                            objectOutput.writeUTF(StringPool.BLANK);
230                    }
231                    else {
232                            objectOutput.writeUTF(name);
233                    }
234    
235                    if (title == null) {
236                            objectOutput.writeUTF(StringPool.BLANK);
237                    }
238                    else {
239                            objectOutput.writeUTF(title);
240                    }
241    
242                    if (description == null) {
243                            objectOutput.writeUTF(StringPool.BLANK);
244                    }
245                    else {
246                            objectOutput.writeUTF(description);
247                    }
248    
249                    if (settings == null) {
250                            objectOutput.writeUTF(StringPool.BLANK);
251                    }
252                    else {
253                            objectOutput.writeUTF(settings);
254                    }
255    
256                    objectOutput.writeLong(lastPublishDate);
257            }
258    
259            public String uuid;
260            public long vocabularyId;
261            public long groupId;
262            public long companyId;
263            public long userId;
264            public String userName;
265            public long createDate;
266            public long modifiedDate;
267            public String name;
268            public String title;
269            public String description;
270            public String settings;
271            public long lastPublishDate;
272    }