001    /**
002     * Copyright (c) 2000-present 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 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.SCProductVersion;
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    /**
033     * The cache model class for representing SCProductVersion in entity cache.
034     *
035     * @author Brian Wing Shun Chan
036     * @see SCProductVersion
037     * @generated
038     */
039    @ProviderType
040    public class SCProductVersionCacheModel implements CacheModel<SCProductVersion>,
041            Externalizable {
042            @Override
043            public String toString() {
044                    StringBundler sb = new StringBundler(25);
045    
046                    sb.append("{productVersionId=");
047                    sb.append(productVersionId);
048                    sb.append(", companyId=");
049                    sb.append(companyId);
050                    sb.append(", userId=");
051                    sb.append(userId);
052                    sb.append(", userName=");
053                    sb.append(userName);
054                    sb.append(", createDate=");
055                    sb.append(createDate);
056                    sb.append(", modifiedDate=");
057                    sb.append(modifiedDate);
058                    sb.append(", productEntryId=");
059                    sb.append(productEntryId);
060                    sb.append(", version=");
061                    sb.append(version);
062                    sb.append(", changeLog=");
063                    sb.append(changeLog);
064                    sb.append(", downloadPageURL=");
065                    sb.append(downloadPageURL);
066                    sb.append(", directDownloadURL=");
067                    sb.append(directDownloadURL);
068                    sb.append(", repoStoreArtifact=");
069                    sb.append(repoStoreArtifact);
070                    sb.append("}");
071    
072                    return sb.toString();
073            }
074    
075            @Override
076            public SCProductVersion toEntityModel() {
077                    SCProductVersionImpl scProductVersionImpl = new SCProductVersionImpl();
078    
079                    scProductVersionImpl.setProductVersionId(productVersionId);
080                    scProductVersionImpl.setCompanyId(companyId);
081                    scProductVersionImpl.setUserId(userId);
082    
083                    if (userName == null) {
084                            scProductVersionImpl.setUserName(StringPool.BLANK);
085                    }
086                    else {
087                            scProductVersionImpl.setUserName(userName);
088                    }
089    
090                    if (createDate == Long.MIN_VALUE) {
091                            scProductVersionImpl.setCreateDate(null);
092                    }
093                    else {
094                            scProductVersionImpl.setCreateDate(new Date(createDate));
095                    }
096    
097                    if (modifiedDate == Long.MIN_VALUE) {
098                            scProductVersionImpl.setModifiedDate(null);
099                    }
100                    else {
101                            scProductVersionImpl.setModifiedDate(new Date(modifiedDate));
102                    }
103    
104                    scProductVersionImpl.setProductEntryId(productEntryId);
105    
106                    if (version == null) {
107                            scProductVersionImpl.setVersion(StringPool.BLANK);
108                    }
109                    else {
110                            scProductVersionImpl.setVersion(version);
111                    }
112    
113                    if (changeLog == null) {
114                            scProductVersionImpl.setChangeLog(StringPool.BLANK);
115                    }
116                    else {
117                            scProductVersionImpl.setChangeLog(changeLog);
118                    }
119    
120                    if (downloadPageURL == null) {
121                            scProductVersionImpl.setDownloadPageURL(StringPool.BLANK);
122                    }
123                    else {
124                            scProductVersionImpl.setDownloadPageURL(downloadPageURL);
125                    }
126    
127                    if (directDownloadURL == null) {
128                            scProductVersionImpl.setDirectDownloadURL(StringPool.BLANK);
129                    }
130                    else {
131                            scProductVersionImpl.setDirectDownloadURL(directDownloadURL);
132                    }
133    
134                    scProductVersionImpl.setRepoStoreArtifact(repoStoreArtifact);
135    
136                    scProductVersionImpl.resetOriginalValues();
137    
138                    return scProductVersionImpl;
139            }
140    
141            @Override
142            public void readExternal(ObjectInput objectInput) throws IOException {
143                    productVersionId = objectInput.readLong();
144                    companyId = objectInput.readLong();
145                    userId = objectInput.readLong();
146                    userName = objectInput.readUTF();
147                    createDate = objectInput.readLong();
148                    modifiedDate = objectInput.readLong();
149                    productEntryId = objectInput.readLong();
150                    version = objectInput.readUTF();
151                    changeLog = objectInput.readUTF();
152                    downloadPageURL = objectInput.readUTF();
153                    directDownloadURL = objectInput.readUTF();
154                    repoStoreArtifact = objectInput.readBoolean();
155            }
156    
157            @Override
158            public void writeExternal(ObjectOutput objectOutput)
159                    throws IOException {
160                    objectOutput.writeLong(productVersionId);
161                    objectOutput.writeLong(companyId);
162                    objectOutput.writeLong(userId);
163    
164                    if (userName == null) {
165                            objectOutput.writeUTF(StringPool.BLANK);
166                    }
167                    else {
168                            objectOutput.writeUTF(userName);
169                    }
170    
171                    objectOutput.writeLong(createDate);
172                    objectOutput.writeLong(modifiedDate);
173                    objectOutput.writeLong(productEntryId);
174    
175                    if (version == null) {
176                            objectOutput.writeUTF(StringPool.BLANK);
177                    }
178                    else {
179                            objectOutput.writeUTF(version);
180                    }
181    
182                    if (changeLog == null) {
183                            objectOutput.writeUTF(StringPool.BLANK);
184                    }
185                    else {
186                            objectOutput.writeUTF(changeLog);
187                    }
188    
189                    if (downloadPageURL == null) {
190                            objectOutput.writeUTF(StringPool.BLANK);
191                    }
192                    else {
193                            objectOutput.writeUTF(downloadPageURL);
194                    }
195    
196                    if (directDownloadURL == null) {
197                            objectOutput.writeUTF(StringPool.BLANK);
198                    }
199                    else {
200                            objectOutput.writeUTF(directDownloadURL);
201                    }
202    
203                    objectOutput.writeBoolean(repoStoreArtifact);
204            }
205    
206            public long productVersionId;
207            public long companyId;
208            public long userId;
209            public String userName;
210            public long createDate;
211            public long modifiedDate;
212            public long productEntryId;
213            public String version;
214            public String changeLog;
215            public String downloadPageURL;
216            public String directDownloadURL;
217            public boolean repoStoreArtifact;
218    }