001    /**
002     * Copyright (c) 2000-2013 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 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.asset.model.AssetVocabulary;
022    
023    import java.io.Externalizable;
024    import java.io.IOException;
025    import java.io.ObjectInput;
026    import java.io.ObjectOutput;
027    
028    import java.util.Date;
029    
030    /**
031     * The cache model class for representing AssetVocabulary in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see AssetVocabulary
035     * @generated
036     */
037    public class AssetVocabularyCacheModel implements CacheModel<AssetVocabulary>,
038            Externalizable {
039            @Override
040            public String toString() {
041                    StringBundler sb = new StringBundler(25);
042    
043                    sb.append("{uuid=");
044                    sb.append(uuid);
045                    sb.append(", vocabularyId=");
046                    sb.append(vocabularyId);
047                    sb.append(", groupId=");
048                    sb.append(groupId);
049                    sb.append(", companyId=");
050                    sb.append(companyId);
051                    sb.append(", userId=");
052                    sb.append(userId);
053                    sb.append(", userName=");
054                    sb.append(userName);
055                    sb.append(", createDate=");
056                    sb.append(createDate);
057                    sb.append(", modifiedDate=");
058                    sb.append(modifiedDate);
059                    sb.append(", name=");
060                    sb.append(name);
061                    sb.append(", title=");
062                    sb.append(title);
063                    sb.append(", description=");
064                    sb.append(description);
065                    sb.append(", settings=");
066                    sb.append(settings);
067                    sb.append("}");
068    
069                    return sb.toString();
070            }
071    
072            public AssetVocabulary toEntityModel() {
073                    AssetVocabularyImpl assetVocabularyImpl = new AssetVocabularyImpl();
074    
075                    if (uuid == null) {
076                            assetVocabularyImpl.setUuid(StringPool.BLANK);
077                    }
078                    else {
079                            assetVocabularyImpl.setUuid(uuid);
080                    }
081    
082                    assetVocabularyImpl.setVocabularyId(vocabularyId);
083                    assetVocabularyImpl.setGroupId(groupId);
084                    assetVocabularyImpl.setCompanyId(companyId);
085                    assetVocabularyImpl.setUserId(userId);
086    
087                    if (userName == null) {
088                            assetVocabularyImpl.setUserName(StringPool.BLANK);
089                    }
090                    else {
091                            assetVocabularyImpl.setUserName(userName);
092                    }
093    
094                    if (createDate == Long.MIN_VALUE) {
095                            assetVocabularyImpl.setCreateDate(null);
096                    }
097                    else {
098                            assetVocabularyImpl.setCreateDate(new Date(createDate));
099                    }
100    
101                    if (modifiedDate == Long.MIN_VALUE) {
102                            assetVocabularyImpl.setModifiedDate(null);
103                    }
104                    else {
105                            assetVocabularyImpl.setModifiedDate(new Date(modifiedDate));
106                    }
107    
108                    if (name == null) {
109                            assetVocabularyImpl.setName(StringPool.BLANK);
110                    }
111                    else {
112                            assetVocabularyImpl.setName(name);
113                    }
114    
115                    if (title == null) {
116                            assetVocabularyImpl.setTitle(StringPool.BLANK);
117                    }
118                    else {
119                            assetVocabularyImpl.setTitle(title);
120                    }
121    
122                    if (description == null) {
123                            assetVocabularyImpl.setDescription(StringPool.BLANK);
124                    }
125                    else {
126                            assetVocabularyImpl.setDescription(description);
127                    }
128    
129                    if (settings == null) {
130                            assetVocabularyImpl.setSettings(StringPool.BLANK);
131                    }
132                    else {
133                            assetVocabularyImpl.setSettings(settings);
134                    }
135    
136                    assetVocabularyImpl.resetOriginalValues();
137    
138                    return assetVocabularyImpl;
139            }
140    
141            public void readExternal(ObjectInput objectInput) throws IOException {
142                    uuid = objectInput.readUTF();
143                    vocabularyId = objectInput.readLong();
144                    groupId = objectInput.readLong();
145                    companyId = objectInput.readLong();
146                    userId = objectInput.readLong();
147                    userName = objectInput.readUTF();
148                    createDate = objectInput.readLong();
149                    modifiedDate = objectInput.readLong();
150                    name = objectInput.readUTF();
151                    title = objectInput.readUTF();
152                    description = objectInput.readUTF();
153                    settings = objectInput.readUTF();
154            }
155    
156            public void writeExternal(ObjectOutput objectOutput)
157                    throws IOException {
158                    if (uuid == null) {
159                            objectOutput.writeUTF(StringPool.BLANK);
160                    }
161                    else {
162                            objectOutput.writeUTF(uuid);
163                    }
164    
165                    objectOutput.writeLong(vocabularyId);
166                    objectOutput.writeLong(groupId);
167                    objectOutput.writeLong(companyId);
168                    objectOutput.writeLong(userId);
169    
170                    if (userName == null) {
171                            objectOutput.writeUTF(StringPool.BLANK);
172                    }
173                    else {
174                            objectOutput.writeUTF(userName);
175                    }
176    
177                    objectOutput.writeLong(createDate);
178                    objectOutput.writeLong(modifiedDate);
179    
180                    if (name == null) {
181                            objectOutput.writeUTF(StringPool.BLANK);
182                    }
183                    else {
184                            objectOutput.writeUTF(name);
185                    }
186    
187                    if (title == null) {
188                            objectOutput.writeUTF(StringPool.BLANK);
189                    }
190                    else {
191                            objectOutput.writeUTF(title);
192                    }
193    
194                    if (description == null) {
195                            objectOutput.writeUTF(StringPool.BLANK);
196                    }
197                    else {
198                            objectOutput.writeUTF(description);
199                    }
200    
201                    if (settings == null) {
202                            objectOutput.writeUTF(StringPool.BLANK);
203                    }
204                    else {
205                            objectOutput.writeUTF(settings);
206                    }
207            }
208    
209            public String uuid;
210            public long vocabularyId;
211            public long groupId;
212            public long companyId;
213            public long userId;
214            public String userName;
215            public long createDate;
216            public long modifiedDate;
217            public String name;
218            public String title;
219            public String description;
220            public String settings;
221    }