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.DDMTemplate;
022    
023    import java.io.Serializable;
024    
025    import java.util.Date;
026    
027    /**
028     * The cache model class for representing DDMTemplate in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see DDMTemplate
032     * @generated
033     */
034    public class DDMTemplateCacheModel implements CacheModel<DDMTemplate>,
035            Serializable {
036            @Override
037            public String toString() {
038                    StringBundler sb = new StringBundler(31);
039    
040                    sb.append("{uuid=");
041                    sb.append(uuid);
042                    sb.append(", templateId=");
043                    sb.append(templateId);
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(", structureId=");
057                    sb.append(structureId);
058                    sb.append(", name=");
059                    sb.append(name);
060                    sb.append(", description=");
061                    sb.append(description);
062                    sb.append(", type=");
063                    sb.append(type);
064                    sb.append(", mode=");
065                    sb.append(mode);
066                    sb.append(", language=");
067                    sb.append(language);
068                    sb.append(", script=");
069                    sb.append(script);
070                    sb.append("}");
071    
072                    return sb.toString();
073            }
074    
075            public DDMTemplate toEntityModel() {
076                    DDMTemplateImpl ddmTemplateImpl = new DDMTemplateImpl();
077    
078                    if (uuid == null) {
079                            ddmTemplateImpl.setUuid(StringPool.BLANK);
080                    }
081                    else {
082                            ddmTemplateImpl.setUuid(uuid);
083                    }
084    
085                    ddmTemplateImpl.setTemplateId(templateId);
086                    ddmTemplateImpl.setGroupId(groupId);
087                    ddmTemplateImpl.setCompanyId(companyId);
088                    ddmTemplateImpl.setUserId(userId);
089    
090                    if (userName == null) {
091                            ddmTemplateImpl.setUserName(StringPool.BLANK);
092                    }
093                    else {
094                            ddmTemplateImpl.setUserName(userName);
095                    }
096    
097                    if (createDate == Long.MIN_VALUE) {
098                            ddmTemplateImpl.setCreateDate(null);
099                    }
100                    else {
101                            ddmTemplateImpl.setCreateDate(new Date(createDate));
102                    }
103    
104                    if (modifiedDate == Long.MIN_VALUE) {
105                            ddmTemplateImpl.setModifiedDate(null);
106                    }
107                    else {
108                            ddmTemplateImpl.setModifiedDate(new Date(modifiedDate));
109                    }
110    
111                    ddmTemplateImpl.setStructureId(structureId);
112    
113                    if (name == null) {
114                            ddmTemplateImpl.setName(StringPool.BLANK);
115                    }
116                    else {
117                            ddmTemplateImpl.setName(name);
118                    }
119    
120                    if (description == null) {
121                            ddmTemplateImpl.setDescription(StringPool.BLANK);
122                    }
123                    else {
124                            ddmTemplateImpl.setDescription(description);
125                    }
126    
127                    if (type == null) {
128                            ddmTemplateImpl.setType(StringPool.BLANK);
129                    }
130                    else {
131                            ddmTemplateImpl.setType(type);
132                    }
133    
134                    if (mode == null) {
135                            ddmTemplateImpl.setMode(StringPool.BLANK);
136                    }
137                    else {
138                            ddmTemplateImpl.setMode(mode);
139                    }
140    
141                    if (language == null) {
142                            ddmTemplateImpl.setLanguage(StringPool.BLANK);
143                    }
144                    else {
145                            ddmTemplateImpl.setLanguage(language);
146                    }
147    
148                    if (script == null) {
149                            ddmTemplateImpl.setScript(StringPool.BLANK);
150                    }
151                    else {
152                            ddmTemplateImpl.setScript(script);
153                    }
154    
155                    ddmTemplateImpl.resetOriginalValues();
156    
157                    return ddmTemplateImpl;
158            }
159    
160            public String uuid;
161            public long templateId;
162            public long groupId;
163            public long companyId;
164            public long userId;
165            public String userName;
166            public long createDate;
167            public long modifiedDate;
168            public long structureId;
169            public String name;
170            public String description;
171            public String type;
172            public String mode;
173            public String language;
174            public String script;
175    }