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