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.DDLRecord;
022    
023    import java.io.Serializable;
024    
025    import java.util.Date;
026    
027    /**
028     * The cache model class for representing DDLRecord in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see DDLRecord
032     * @generated
033     */
034    public class DDLRecordCacheModel implements CacheModel<DDLRecord>, Serializable {
035            @Override
036            public String toString() {
037                    StringBundler sb = new StringBundler(29);
038    
039                    sb.append("{uuid=");
040                    sb.append(uuid);
041                    sb.append(", recordId=");
042                    sb.append(recordId);
043                    sb.append(", groupId=");
044                    sb.append(groupId);
045                    sb.append(", companyId=");
046                    sb.append(companyId);
047                    sb.append(", userId=");
048                    sb.append(userId);
049                    sb.append(", userName=");
050                    sb.append(userName);
051                    sb.append(", versionUserId=");
052                    sb.append(versionUserId);
053                    sb.append(", versionUserName=");
054                    sb.append(versionUserName);
055                    sb.append(", createDate=");
056                    sb.append(createDate);
057                    sb.append(", modifiedDate=");
058                    sb.append(modifiedDate);
059                    sb.append(", DDMStorageId=");
060                    sb.append(DDMStorageId);
061                    sb.append(", recordSetId=");
062                    sb.append(recordSetId);
063                    sb.append(", version=");
064                    sb.append(version);
065                    sb.append(", displayIndex=");
066                    sb.append(displayIndex);
067                    sb.append("}");
068    
069                    return sb.toString();
070            }
071    
072            public DDLRecord toEntityModel() {
073                    DDLRecordImpl ddlRecordImpl = new DDLRecordImpl();
074    
075                    if (uuid == null) {
076                            ddlRecordImpl.setUuid(StringPool.BLANK);
077                    }
078                    else {
079                            ddlRecordImpl.setUuid(uuid);
080                    }
081    
082                    ddlRecordImpl.setRecordId(recordId);
083                    ddlRecordImpl.setGroupId(groupId);
084                    ddlRecordImpl.setCompanyId(companyId);
085                    ddlRecordImpl.setUserId(userId);
086    
087                    if (userName == null) {
088                            ddlRecordImpl.setUserName(StringPool.BLANK);
089                    }
090                    else {
091                            ddlRecordImpl.setUserName(userName);
092                    }
093    
094                    ddlRecordImpl.setVersionUserId(versionUserId);
095    
096                    if (versionUserName == null) {
097                            ddlRecordImpl.setVersionUserName(StringPool.BLANK);
098                    }
099                    else {
100                            ddlRecordImpl.setVersionUserName(versionUserName);
101                    }
102    
103                    if (createDate == Long.MIN_VALUE) {
104                            ddlRecordImpl.setCreateDate(null);
105                    }
106                    else {
107                            ddlRecordImpl.setCreateDate(new Date(createDate));
108                    }
109    
110                    if (modifiedDate == Long.MIN_VALUE) {
111                            ddlRecordImpl.setModifiedDate(null);
112                    }
113                    else {
114                            ddlRecordImpl.setModifiedDate(new Date(modifiedDate));
115                    }
116    
117                    ddlRecordImpl.setDDMStorageId(DDMStorageId);
118                    ddlRecordImpl.setRecordSetId(recordSetId);
119    
120                    if (version == null) {
121                            ddlRecordImpl.setVersion(StringPool.BLANK);
122                    }
123                    else {
124                            ddlRecordImpl.setVersion(version);
125                    }
126    
127                    ddlRecordImpl.setDisplayIndex(displayIndex);
128    
129                    ddlRecordImpl.resetOriginalValues();
130    
131                    return ddlRecordImpl;
132            }
133    
134            public String uuid;
135            public long recordId;
136            public long groupId;
137            public long companyId;
138            public long userId;
139            public String userName;
140            public long versionUserId;
141            public String versionUserName;
142            public long createDate;
143            public long modifiedDate;
144            public long DDMStorageId;
145            public long recordSetId;
146            public String version;
147            public int displayIndex;
148    }