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