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