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.SCFrameworkVersion;
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 SCFrameworkVersion in entity cache.
034     *
035     * @author Brian Wing Shun Chan
036     * @see SCFrameworkVersion
037     * @generated
038     */
039    @ProviderType
040    public class SCFrameworkVersionCacheModel implements CacheModel<SCFrameworkVersion>,
041            Externalizable {
042            @Override
043            public String toString() {
044                    StringBundler sb = new StringBundler(23);
045    
046                    sb.append("{frameworkVersionId=");
047                    sb.append(frameworkVersionId);
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(", url=");
063                    sb.append(url);
064                    sb.append(", active=");
065                    sb.append(active);
066                    sb.append(", priority=");
067                    sb.append(priority);
068                    sb.append("}");
069    
070                    return sb.toString();
071            }
072    
073            @Override
074            public SCFrameworkVersion toEntityModel() {
075                    SCFrameworkVersionImpl scFrameworkVersionImpl = new SCFrameworkVersionImpl();
076    
077                    scFrameworkVersionImpl.setFrameworkVersionId(frameworkVersionId);
078                    scFrameworkVersionImpl.setGroupId(groupId);
079                    scFrameworkVersionImpl.setCompanyId(companyId);
080                    scFrameworkVersionImpl.setUserId(userId);
081    
082                    if (userName == null) {
083                            scFrameworkVersionImpl.setUserName(StringPool.BLANK);
084                    }
085                    else {
086                            scFrameworkVersionImpl.setUserName(userName);
087                    }
088    
089                    if (createDate == Long.MIN_VALUE) {
090                            scFrameworkVersionImpl.setCreateDate(null);
091                    }
092                    else {
093                            scFrameworkVersionImpl.setCreateDate(new Date(createDate));
094                    }
095    
096                    if (modifiedDate == Long.MIN_VALUE) {
097                            scFrameworkVersionImpl.setModifiedDate(null);
098                    }
099                    else {
100                            scFrameworkVersionImpl.setModifiedDate(new Date(modifiedDate));
101                    }
102    
103                    if (name == null) {
104                            scFrameworkVersionImpl.setName(StringPool.BLANK);
105                    }
106                    else {
107                            scFrameworkVersionImpl.setName(name);
108                    }
109    
110                    if (url == null) {
111                            scFrameworkVersionImpl.setUrl(StringPool.BLANK);
112                    }
113                    else {
114                            scFrameworkVersionImpl.setUrl(url);
115                    }
116    
117                    scFrameworkVersionImpl.setActive(active);
118                    scFrameworkVersionImpl.setPriority(priority);
119    
120                    scFrameworkVersionImpl.resetOriginalValues();
121    
122                    return scFrameworkVersionImpl;
123            }
124    
125            @Override
126            public void readExternal(ObjectInput objectInput) throws IOException {
127                    frameworkVersionId = objectInput.readLong();
128                    groupId = objectInput.readLong();
129                    companyId = objectInput.readLong();
130                    userId = objectInput.readLong();
131                    userName = objectInput.readUTF();
132                    createDate = objectInput.readLong();
133                    modifiedDate = objectInput.readLong();
134                    name = objectInput.readUTF();
135                    url = objectInput.readUTF();
136                    active = objectInput.readBoolean();
137                    priority = objectInput.readInt();
138            }
139    
140            @Override
141            public void writeExternal(ObjectOutput objectOutput)
142                    throws IOException {
143                    objectOutput.writeLong(frameworkVersionId);
144                    objectOutput.writeLong(groupId);
145                    objectOutput.writeLong(companyId);
146                    objectOutput.writeLong(userId);
147    
148                    if (userName == null) {
149                            objectOutput.writeUTF(StringPool.BLANK);
150                    }
151                    else {
152                            objectOutput.writeUTF(userName);
153                    }
154    
155                    objectOutput.writeLong(createDate);
156                    objectOutput.writeLong(modifiedDate);
157    
158                    if (name == null) {
159                            objectOutput.writeUTF(StringPool.BLANK);
160                    }
161                    else {
162                            objectOutput.writeUTF(name);
163                    }
164    
165                    if (url == null) {
166                            objectOutput.writeUTF(StringPool.BLANK);
167                    }
168                    else {
169                            objectOutput.writeUTF(url);
170                    }
171    
172                    objectOutput.writeBoolean(active);
173                    objectOutput.writeInt(priority);
174            }
175    
176            public long frameworkVersionId;
177            public long groupId;
178            public long companyId;
179            public long userId;
180            public String userName;
181            public long createDate;
182            public long modifiedDate;
183            public String name;
184            public String url;
185            public boolean active;
186            public int priority;
187    }