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.journal.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.journal.model.JournalTemplate;
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 JournalTemplate in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see JournalTemplate
035     * @generated
036     */
037    public class JournalTemplateCacheModel implements CacheModel<JournalTemplate>,
038            Externalizable {
039            @Override
040            public String toString() {
041                    StringBundler sb = new StringBundler(37);
042    
043                    sb.append("{uuid=");
044                    sb.append(uuid);
045                    sb.append(", id=");
046                    sb.append(id);
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(", templateId=");
060                    sb.append(templateId);
061                    sb.append(", structureId=");
062                    sb.append(structureId);
063                    sb.append(", name=");
064                    sb.append(name);
065                    sb.append(", description=");
066                    sb.append(description);
067                    sb.append(", xsl=");
068                    sb.append(xsl);
069                    sb.append(", langType=");
070                    sb.append(langType);
071                    sb.append(", cacheable=");
072                    sb.append(cacheable);
073                    sb.append(", smallImage=");
074                    sb.append(smallImage);
075                    sb.append(", smallImageId=");
076                    sb.append(smallImageId);
077                    sb.append(", smallImageURL=");
078                    sb.append(smallImageURL);
079                    sb.append("}");
080    
081                    return sb.toString();
082            }
083    
084            public JournalTemplate toEntityModel() {
085                    JournalTemplateImpl journalTemplateImpl = new JournalTemplateImpl();
086    
087                    if (uuid == null) {
088                            journalTemplateImpl.setUuid(StringPool.BLANK);
089                    }
090                    else {
091                            journalTemplateImpl.setUuid(uuid);
092                    }
093    
094                    journalTemplateImpl.setId(id);
095                    journalTemplateImpl.setGroupId(groupId);
096                    journalTemplateImpl.setCompanyId(companyId);
097                    journalTemplateImpl.setUserId(userId);
098    
099                    if (userName == null) {
100                            journalTemplateImpl.setUserName(StringPool.BLANK);
101                    }
102                    else {
103                            journalTemplateImpl.setUserName(userName);
104                    }
105    
106                    if (createDate == Long.MIN_VALUE) {
107                            journalTemplateImpl.setCreateDate(null);
108                    }
109                    else {
110                            journalTemplateImpl.setCreateDate(new Date(createDate));
111                    }
112    
113                    if (modifiedDate == Long.MIN_VALUE) {
114                            journalTemplateImpl.setModifiedDate(null);
115                    }
116                    else {
117                            journalTemplateImpl.setModifiedDate(new Date(modifiedDate));
118                    }
119    
120                    if (templateId == null) {
121                            journalTemplateImpl.setTemplateId(StringPool.BLANK);
122                    }
123                    else {
124                            journalTemplateImpl.setTemplateId(templateId);
125                    }
126    
127                    if (structureId == null) {
128                            journalTemplateImpl.setStructureId(StringPool.BLANK);
129                    }
130                    else {
131                            journalTemplateImpl.setStructureId(structureId);
132                    }
133    
134                    if (name == null) {
135                            journalTemplateImpl.setName(StringPool.BLANK);
136                    }
137                    else {
138                            journalTemplateImpl.setName(name);
139                    }
140    
141                    if (description == null) {
142                            journalTemplateImpl.setDescription(StringPool.BLANK);
143                    }
144                    else {
145                            journalTemplateImpl.setDescription(description);
146                    }
147    
148                    if (xsl == null) {
149                            journalTemplateImpl.setXsl(StringPool.BLANK);
150                    }
151                    else {
152                            journalTemplateImpl.setXsl(xsl);
153                    }
154    
155                    if (langType == null) {
156                            journalTemplateImpl.setLangType(StringPool.BLANK);
157                    }
158                    else {
159                            journalTemplateImpl.setLangType(langType);
160                    }
161    
162                    journalTemplateImpl.setCacheable(cacheable);
163                    journalTemplateImpl.setSmallImage(smallImage);
164                    journalTemplateImpl.setSmallImageId(smallImageId);
165    
166                    if (smallImageURL == null) {
167                            journalTemplateImpl.setSmallImageURL(StringPool.BLANK);
168                    }
169                    else {
170                            journalTemplateImpl.setSmallImageURL(smallImageURL);
171                    }
172    
173                    journalTemplateImpl.resetOriginalValues();
174    
175                    return journalTemplateImpl;
176            }
177    
178            public void readExternal(ObjectInput objectInput) throws IOException {
179                    uuid = objectInput.readUTF();
180                    id = objectInput.readLong();
181                    groupId = objectInput.readLong();
182                    companyId = objectInput.readLong();
183                    userId = objectInput.readLong();
184                    userName = objectInput.readUTF();
185                    createDate = objectInput.readLong();
186                    modifiedDate = objectInput.readLong();
187                    templateId = objectInput.readUTF();
188                    structureId = objectInput.readUTF();
189                    name = objectInput.readUTF();
190                    description = objectInput.readUTF();
191                    xsl = objectInput.readUTF();
192                    langType = objectInput.readUTF();
193                    cacheable = objectInput.readBoolean();
194                    smallImage = objectInput.readBoolean();
195                    smallImageId = objectInput.readLong();
196                    smallImageURL = objectInput.readUTF();
197            }
198    
199            public void writeExternal(ObjectOutput objectOutput)
200                    throws IOException {
201                    if (uuid == null) {
202                            objectOutput.writeUTF(StringPool.BLANK);
203                    }
204                    else {
205                            objectOutput.writeUTF(uuid);
206                    }
207    
208                    objectOutput.writeLong(id);
209                    objectOutput.writeLong(groupId);
210                    objectOutput.writeLong(companyId);
211                    objectOutput.writeLong(userId);
212    
213                    if (userName == null) {
214                            objectOutput.writeUTF(StringPool.BLANK);
215                    }
216                    else {
217                            objectOutput.writeUTF(userName);
218                    }
219    
220                    objectOutput.writeLong(createDate);
221                    objectOutput.writeLong(modifiedDate);
222    
223                    if (templateId == null) {
224                            objectOutput.writeUTF(StringPool.BLANK);
225                    }
226                    else {
227                            objectOutput.writeUTF(templateId);
228                    }
229    
230                    if (structureId == null) {
231                            objectOutput.writeUTF(StringPool.BLANK);
232                    }
233                    else {
234                            objectOutput.writeUTF(structureId);
235                    }
236    
237                    if (name == null) {
238                            objectOutput.writeUTF(StringPool.BLANK);
239                    }
240                    else {
241                            objectOutput.writeUTF(name);
242                    }
243    
244                    if (description == null) {
245                            objectOutput.writeUTF(StringPool.BLANK);
246                    }
247                    else {
248                            objectOutput.writeUTF(description);
249                    }
250    
251                    if (xsl == null) {
252                            objectOutput.writeUTF(StringPool.BLANK);
253                    }
254                    else {
255                            objectOutput.writeUTF(xsl);
256                    }
257    
258                    if (langType == null) {
259                            objectOutput.writeUTF(StringPool.BLANK);
260                    }
261                    else {
262                            objectOutput.writeUTF(langType);
263                    }
264    
265                    objectOutput.writeBoolean(cacheable);
266                    objectOutput.writeBoolean(smallImage);
267                    objectOutput.writeLong(smallImageId);
268    
269                    if (smallImageURL == null) {
270                            objectOutput.writeUTF(StringPool.BLANK);
271                    }
272                    else {
273                            objectOutput.writeUTF(smallImageURL);
274                    }
275            }
276    
277            public String uuid;
278            public long id;
279            public long groupId;
280            public long companyId;
281            public long userId;
282            public String userName;
283            public long createDate;
284            public long modifiedDate;
285            public String templateId;
286            public String structureId;
287            public String name;
288            public String description;
289            public String xsl;
290            public String langType;
291            public boolean cacheable;
292            public boolean smallImage;
293            public long smallImageId;
294            public String smallImageURL;
295    }