001
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
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 @Override
073 public AssetVocabulary toEntityModel() {
074 AssetVocabularyImpl assetVocabularyImpl = new AssetVocabularyImpl();
075
076 if (uuid == null) {
077 assetVocabularyImpl.setUuid(StringPool.BLANK);
078 }
079 else {
080 assetVocabularyImpl.setUuid(uuid);
081 }
082
083 assetVocabularyImpl.setVocabularyId(vocabularyId);
084 assetVocabularyImpl.setGroupId(groupId);
085 assetVocabularyImpl.setCompanyId(companyId);
086 assetVocabularyImpl.setUserId(userId);
087
088 if (userName == null) {
089 assetVocabularyImpl.setUserName(StringPool.BLANK);
090 }
091 else {
092 assetVocabularyImpl.setUserName(userName);
093 }
094
095 if (createDate == Long.MIN_VALUE) {
096 assetVocabularyImpl.setCreateDate(null);
097 }
098 else {
099 assetVocabularyImpl.setCreateDate(new Date(createDate));
100 }
101
102 if (modifiedDate == Long.MIN_VALUE) {
103 assetVocabularyImpl.setModifiedDate(null);
104 }
105 else {
106 assetVocabularyImpl.setModifiedDate(new Date(modifiedDate));
107 }
108
109 if (name == null) {
110 assetVocabularyImpl.setName(StringPool.BLANK);
111 }
112 else {
113 assetVocabularyImpl.setName(name);
114 }
115
116 if (title == null) {
117 assetVocabularyImpl.setTitle(StringPool.BLANK);
118 }
119 else {
120 assetVocabularyImpl.setTitle(title);
121 }
122
123 if (description == null) {
124 assetVocabularyImpl.setDescription(StringPool.BLANK);
125 }
126 else {
127 assetVocabularyImpl.setDescription(description);
128 }
129
130 if (settings == null) {
131 assetVocabularyImpl.setSettings(StringPool.BLANK);
132 }
133 else {
134 assetVocabularyImpl.setSettings(settings);
135 }
136
137 assetVocabularyImpl.resetOriginalValues();
138
139 return assetVocabularyImpl;
140 }
141
142 @Override
143 public void readExternal(ObjectInput objectInput) throws IOException {
144 uuid = objectInput.readUTF();
145 vocabularyId = objectInput.readLong();
146 groupId = objectInput.readLong();
147 companyId = objectInput.readLong();
148 userId = objectInput.readLong();
149 userName = objectInput.readUTF();
150 createDate = objectInput.readLong();
151 modifiedDate = objectInput.readLong();
152 name = objectInput.readUTF();
153 title = objectInput.readUTF();
154 description = objectInput.readUTF();
155 settings = objectInput.readUTF();
156 }
157
158 @Override
159 public void writeExternal(ObjectOutput objectOutput)
160 throws IOException {
161 if (uuid == null) {
162 objectOutput.writeUTF(StringPool.BLANK);
163 }
164 else {
165 objectOutput.writeUTF(uuid);
166 }
167
168 objectOutput.writeLong(vocabularyId);
169 objectOutput.writeLong(groupId);
170 objectOutput.writeLong(companyId);
171 objectOutput.writeLong(userId);
172
173 if (userName == null) {
174 objectOutput.writeUTF(StringPool.BLANK);
175 }
176 else {
177 objectOutput.writeUTF(userName);
178 }
179
180 objectOutput.writeLong(createDate);
181 objectOutput.writeLong(modifiedDate);
182
183 if (name == null) {
184 objectOutput.writeUTF(StringPool.BLANK);
185 }
186 else {
187 objectOutput.writeUTF(name);
188 }
189
190 if (title == null) {
191 objectOutput.writeUTF(StringPool.BLANK);
192 }
193 else {
194 objectOutput.writeUTF(title);
195 }
196
197 if (description == null) {
198 objectOutput.writeUTF(StringPool.BLANK);
199 }
200 else {
201 objectOutput.writeUTF(description);
202 }
203
204 if (settings == null) {
205 objectOutput.writeUTF(StringPool.BLANK);
206 }
207 else {
208 objectOutput.writeUTF(settings);
209 }
210 }
211
212 public String uuid;
213 public long vocabularyId;
214 public long groupId;
215 public long companyId;
216 public long userId;
217 public String userName;
218 public long createDate;
219 public long modifiedDate;
220 public String name;
221 public String title;
222 public String description;
223 public String settings;
224 }