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