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