001
014
015 package com.liferay.portlet.softwarecatalog.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.softwarecatalog.model.SCProductEntry;
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 SCProductEntryCacheModel implements CacheModel<SCProductEntry>,
041 Externalizable {
042 @Override
043 public String toString() {
044 StringBundler sb = new StringBundler(33);
045
046 sb.append("{productEntryId=");
047 sb.append(productEntryId);
048 sb.append(", groupId=");
049 sb.append(groupId);
050 sb.append(", companyId=");
051 sb.append(companyId);
052 sb.append(", userId=");
053 sb.append(userId);
054 sb.append(", userName=");
055 sb.append(userName);
056 sb.append(", createDate=");
057 sb.append(createDate);
058 sb.append(", modifiedDate=");
059 sb.append(modifiedDate);
060 sb.append(", name=");
061 sb.append(name);
062 sb.append(", type=");
063 sb.append(type);
064 sb.append(", tags=");
065 sb.append(tags);
066 sb.append(", shortDescription=");
067 sb.append(shortDescription);
068 sb.append(", longDescription=");
069 sb.append(longDescription);
070 sb.append(", pageURL=");
071 sb.append(pageURL);
072 sb.append(", author=");
073 sb.append(author);
074 sb.append(", repoGroupId=");
075 sb.append(repoGroupId);
076 sb.append(", repoArtifactId=");
077 sb.append(repoArtifactId);
078 sb.append("}");
079
080 return sb.toString();
081 }
082
083 @Override
084 public SCProductEntry toEntityModel() {
085 SCProductEntryImpl scProductEntryImpl = new SCProductEntryImpl();
086
087 scProductEntryImpl.setProductEntryId(productEntryId);
088 scProductEntryImpl.setGroupId(groupId);
089 scProductEntryImpl.setCompanyId(companyId);
090 scProductEntryImpl.setUserId(userId);
091
092 if (userName == null) {
093 scProductEntryImpl.setUserName(StringPool.BLANK);
094 }
095 else {
096 scProductEntryImpl.setUserName(userName);
097 }
098
099 if (createDate == Long.MIN_VALUE) {
100 scProductEntryImpl.setCreateDate(null);
101 }
102 else {
103 scProductEntryImpl.setCreateDate(new Date(createDate));
104 }
105
106 if (modifiedDate == Long.MIN_VALUE) {
107 scProductEntryImpl.setModifiedDate(null);
108 }
109 else {
110 scProductEntryImpl.setModifiedDate(new Date(modifiedDate));
111 }
112
113 if (name == null) {
114 scProductEntryImpl.setName(StringPool.BLANK);
115 }
116 else {
117 scProductEntryImpl.setName(name);
118 }
119
120 if (type == null) {
121 scProductEntryImpl.setType(StringPool.BLANK);
122 }
123 else {
124 scProductEntryImpl.setType(type);
125 }
126
127 if (tags == null) {
128 scProductEntryImpl.setTags(StringPool.BLANK);
129 }
130 else {
131 scProductEntryImpl.setTags(tags);
132 }
133
134 if (shortDescription == null) {
135 scProductEntryImpl.setShortDescription(StringPool.BLANK);
136 }
137 else {
138 scProductEntryImpl.setShortDescription(shortDescription);
139 }
140
141 if (longDescription == null) {
142 scProductEntryImpl.setLongDescription(StringPool.BLANK);
143 }
144 else {
145 scProductEntryImpl.setLongDescription(longDescription);
146 }
147
148 if (pageURL == null) {
149 scProductEntryImpl.setPageURL(StringPool.BLANK);
150 }
151 else {
152 scProductEntryImpl.setPageURL(pageURL);
153 }
154
155 if (author == null) {
156 scProductEntryImpl.setAuthor(StringPool.BLANK);
157 }
158 else {
159 scProductEntryImpl.setAuthor(author);
160 }
161
162 if (repoGroupId == null) {
163 scProductEntryImpl.setRepoGroupId(StringPool.BLANK);
164 }
165 else {
166 scProductEntryImpl.setRepoGroupId(repoGroupId);
167 }
168
169 if (repoArtifactId == null) {
170 scProductEntryImpl.setRepoArtifactId(StringPool.BLANK);
171 }
172 else {
173 scProductEntryImpl.setRepoArtifactId(repoArtifactId);
174 }
175
176 scProductEntryImpl.resetOriginalValues();
177
178 return scProductEntryImpl;
179 }
180
181 @Override
182 public void readExternal(ObjectInput objectInput) throws IOException {
183 productEntryId = objectInput.readLong();
184 groupId = objectInput.readLong();
185 companyId = objectInput.readLong();
186 userId = objectInput.readLong();
187 userName = objectInput.readUTF();
188 createDate = objectInput.readLong();
189 modifiedDate = objectInput.readLong();
190 name = objectInput.readUTF();
191 type = objectInput.readUTF();
192 tags = objectInput.readUTF();
193 shortDescription = objectInput.readUTF();
194 longDescription = objectInput.readUTF();
195 pageURL = objectInput.readUTF();
196 author = objectInput.readUTF();
197 repoGroupId = objectInput.readUTF();
198 repoArtifactId = objectInput.readUTF();
199 }
200
201 @Override
202 public void writeExternal(ObjectOutput objectOutput)
203 throws IOException {
204 objectOutput.writeLong(productEntryId);
205 objectOutput.writeLong(groupId);
206 objectOutput.writeLong(companyId);
207 objectOutput.writeLong(userId);
208
209 if (userName == null) {
210 objectOutput.writeUTF(StringPool.BLANK);
211 }
212 else {
213 objectOutput.writeUTF(userName);
214 }
215
216 objectOutput.writeLong(createDate);
217 objectOutput.writeLong(modifiedDate);
218
219 if (name == null) {
220 objectOutput.writeUTF(StringPool.BLANK);
221 }
222 else {
223 objectOutput.writeUTF(name);
224 }
225
226 if (type == null) {
227 objectOutput.writeUTF(StringPool.BLANK);
228 }
229 else {
230 objectOutput.writeUTF(type);
231 }
232
233 if (tags == null) {
234 objectOutput.writeUTF(StringPool.BLANK);
235 }
236 else {
237 objectOutput.writeUTF(tags);
238 }
239
240 if (shortDescription == null) {
241 objectOutput.writeUTF(StringPool.BLANK);
242 }
243 else {
244 objectOutput.writeUTF(shortDescription);
245 }
246
247 if (longDescription == null) {
248 objectOutput.writeUTF(StringPool.BLANK);
249 }
250 else {
251 objectOutput.writeUTF(longDescription);
252 }
253
254 if (pageURL == null) {
255 objectOutput.writeUTF(StringPool.BLANK);
256 }
257 else {
258 objectOutput.writeUTF(pageURL);
259 }
260
261 if (author == null) {
262 objectOutput.writeUTF(StringPool.BLANK);
263 }
264 else {
265 objectOutput.writeUTF(author);
266 }
267
268 if (repoGroupId == null) {
269 objectOutput.writeUTF(StringPool.BLANK);
270 }
271 else {
272 objectOutput.writeUTF(repoGroupId);
273 }
274
275 if (repoArtifactId == null) {
276 objectOutput.writeUTF(StringPool.BLANK);
277 }
278 else {
279 objectOutput.writeUTF(repoArtifactId);
280 }
281 }
282
283 public long productEntryId;
284 public long groupId;
285 public long companyId;
286 public long userId;
287 public String userName;
288 public long createDate;
289 public long modifiedDate;
290 public String name;
291 public String type;
292 public String tags;
293 public String shortDescription;
294 public String longDescription;
295 public String pageURL;
296 public String author;
297 public String repoGroupId;
298 public String repoArtifactId;
299 }