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