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