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