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