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.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.asset.model.AssetVocabulary;
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                    vocabularyId = objectInput.readLong();
183                    groupId = objectInput.readLong();
184                    companyId = objectInput.readLong();
185                    userId = objectInput.readLong();
186                    userName = objectInput.readUTF();
187                    createDate = objectInput.readLong();
188                    modifiedDate = objectInput.readLong();
189                    name = objectInput.readUTF();
190                    title = objectInput.readUTF();
191                    description = objectInput.readUTF();
192                    settings = objectInput.readUTF();
193                    lastPublishDate = objectInput.readLong();
194            }
195    
196            @Override
197            public void writeExternal(ObjectOutput objectOutput)
198                    throws IOException {
199                    if (uuid == null) {
200                            objectOutput.writeUTF(StringPool.BLANK);
201                    }
202                    else {
203                            objectOutput.writeUTF(uuid);
204                    }
205    
206                    objectOutput.writeLong(vocabularyId);
207                    objectOutput.writeLong(groupId);
208                    objectOutput.writeLong(companyId);
209                    objectOutput.writeLong(userId);
210    
211                    if (userName == null) {
212                            objectOutput.writeUTF(StringPool.BLANK);
213                    }
214                    else {
215                            objectOutput.writeUTF(userName);
216                    }
217    
218                    objectOutput.writeLong(createDate);
219                    objectOutput.writeLong(modifiedDate);
220    
221                    if (name == null) {
222                            objectOutput.writeUTF(StringPool.BLANK);
223                    }
224                    else {
225                            objectOutput.writeUTF(name);
226                    }
227    
228                    if (title == null) {
229                            objectOutput.writeUTF(StringPool.BLANK);
230                    }
231                    else {
232                            objectOutput.writeUTF(title);
233                    }
234    
235                    if (description == null) {
236                            objectOutput.writeUTF(StringPool.BLANK);
237                    }
238                    else {
239                            objectOutput.writeUTF(description);
240                    }
241    
242                    if (settings == null) {
243                            objectOutput.writeUTF(StringPool.BLANK);
244                    }
245                    else {
246                            objectOutput.writeUTF(settings);
247                    }
248    
249                    objectOutput.writeLong(lastPublishDate);
250            }
251    
252            public String uuid;
253            public long vocabularyId;
254            public long groupId;
255            public long companyId;
256            public long userId;
257            public String userName;
258            public long createDate;
259            public long modifiedDate;
260            public String name;
261            public String title;
262            public String description;
263            public String settings;
264            public long lastPublishDate;
265    }