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