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.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
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(25);
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("}");
096
097 return sb.toString();
098 }
099
100 @Override
101 public AssetVocabulary toEntityModel() {
102 AssetVocabularyImpl assetVocabularyImpl = new AssetVocabularyImpl();
103
104 if (uuid == null) {
105 assetVocabularyImpl.setUuid(StringPool.BLANK);
106 }
107 else {
108 assetVocabularyImpl.setUuid(uuid);
109 }
110
111 assetVocabularyImpl.setVocabularyId(vocabularyId);
112 assetVocabularyImpl.setGroupId(groupId);
113 assetVocabularyImpl.setCompanyId(companyId);
114 assetVocabularyImpl.setUserId(userId);
115
116 if (userName == null) {
117 assetVocabularyImpl.setUserName(StringPool.BLANK);
118 }
119 else {
120 assetVocabularyImpl.setUserName(userName);
121 }
122
123 if (createDate == Long.MIN_VALUE) {
124 assetVocabularyImpl.setCreateDate(null);
125 }
126 else {
127 assetVocabularyImpl.setCreateDate(new Date(createDate));
128 }
129
130 if (modifiedDate == Long.MIN_VALUE) {
131 assetVocabularyImpl.setModifiedDate(null);
132 }
133 else {
134 assetVocabularyImpl.setModifiedDate(new Date(modifiedDate));
135 }
136
137 if (name == null) {
138 assetVocabularyImpl.setName(StringPool.BLANK);
139 }
140 else {
141 assetVocabularyImpl.setName(name);
142 }
143
144 if (title == null) {
145 assetVocabularyImpl.setTitle(StringPool.BLANK);
146 }
147 else {
148 assetVocabularyImpl.setTitle(title);
149 }
150
151 if (description == null) {
152 assetVocabularyImpl.setDescription(StringPool.BLANK);
153 }
154 else {
155 assetVocabularyImpl.setDescription(description);
156 }
157
158 if (settings == null) {
159 assetVocabularyImpl.setSettings(StringPool.BLANK);
160 }
161 else {
162 assetVocabularyImpl.setSettings(settings);
163 }
164
165 assetVocabularyImpl.resetOriginalValues();
166
167 return assetVocabularyImpl;
168 }
169
170 @Override
171 public void readExternal(ObjectInput objectInput) throws IOException {
172 uuid = objectInput.readUTF();
173 vocabularyId = objectInput.readLong();
174 groupId = objectInput.readLong();
175 companyId = objectInput.readLong();
176 userId = objectInput.readLong();
177 userName = objectInput.readUTF();
178 createDate = objectInput.readLong();
179 modifiedDate = objectInput.readLong();
180 name = objectInput.readUTF();
181 title = objectInput.readUTF();
182 description = objectInput.readUTF();
183 settings = objectInput.readUTF();
184 }
185
186 @Override
187 public void writeExternal(ObjectOutput objectOutput)
188 throws IOException {
189 if (uuid == null) {
190 objectOutput.writeUTF(StringPool.BLANK);
191 }
192 else {
193 objectOutput.writeUTF(uuid);
194 }
195
196 objectOutput.writeLong(vocabularyId);
197 objectOutput.writeLong(groupId);
198 objectOutput.writeLong(companyId);
199 objectOutput.writeLong(userId);
200
201 if (userName == null) {
202 objectOutput.writeUTF(StringPool.BLANK);
203 }
204 else {
205 objectOutput.writeUTF(userName);
206 }
207
208 objectOutput.writeLong(createDate);
209 objectOutput.writeLong(modifiedDate);
210
211 if (name == null) {
212 objectOutput.writeUTF(StringPool.BLANK);
213 }
214 else {
215 objectOutput.writeUTF(name);
216 }
217
218 if (title == null) {
219 objectOutput.writeUTF(StringPool.BLANK);
220 }
221 else {
222 objectOutput.writeUTF(title);
223 }
224
225 if (description == null) {
226 objectOutput.writeUTF(StringPool.BLANK);
227 }
228 else {
229 objectOutput.writeUTF(description);
230 }
231
232 if (settings == null) {
233 objectOutput.writeUTF(StringPool.BLANK);
234 }
235 else {
236 objectOutput.writeUTF(settings);
237 }
238 }
239
240 public String uuid;
241 public long vocabularyId;
242 public long groupId;
243 public long companyId;
244 public long userId;
245 public String userName;
246 public long createDate;
247 public long modifiedDate;
248 public String name;
249 public String title;
250 public String description;
251 public String settings;
252 }