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.JournalFolder;
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 JournalFolder in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see JournalFolder
035     * @generated
036     */
037    public class JournalFolderCacheModel implements CacheModel<JournalFolder>,
038            Externalizable {
039            @Override
040            public String toString() {
041                    StringBundler sb = new StringBundler(33);
042    
043                    sb.append("{uuid=");
044                    sb.append(uuid);
045                    sb.append(", folderId=");
046                    sb.append(folderId);
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(", parentFolderId=");
060                    sb.append(parentFolderId);
061                    sb.append(", treePath=");
062                    sb.append(treePath);
063                    sb.append(", name=");
064                    sb.append(name);
065                    sb.append(", description=");
066                    sb.append(description);
067                    sb.append(", status=");
068                    sb.append(status);
069                    sb.append(", statusByUserId=");
070                    sb.append(statusByUserId);
071                    sb.append(", statusByUserName=");
072                    sb.append(statusByUserName);
073                    sb.append(", statusDate=");
074                    sb.append(statusDate);
075                    sb.append("}");
076    
077                    return sb.toString();
078            }
079    
080            @Override
081            public JournalFolder toEntityModel() {
082                    JournalFolderImpl journalFolderImpl = new JournalFolderImpl();
083    
084                    if (uuid == null) {
085                            journalFolderImpl.setUuid(StringPool.BLANK);
086                    }
087                    else {
088                            journalFolderImpl.setUuid(uuid);
089                    }
090    
091                    journalFolderImpl.setFolderId(folderId);
092                    journalFolderImpl.setGroupId(groupId);
093                    journalFolderImpl.setCompanyId(companyId);
094                    journalFolderImpl.setUserId(userId);
095    
096                    if (userName == null) {
097                            journalFolderImpl.setUserName(StringPool.BLANK);
098                    }
099                    else {
100                            journalFolderImpl.setUserName(userName);
101                    }
102    
103                    if (createDate == Long.MIN_VALUE) {
104                            journalFolderImpl.setCreateDate(null);
105                    }
106                    else {
107                            journalFolderImpl.setCreateDate(new Date(createDate));
108                    }
109    
110                    if (modifiedDate == Long.MIN_VALUE) {
111                            journalFolderImpl.setModifiedDate(null);
112                    }
113                    else {
114                            journalFolderImpl.setModifiedDate(new Date(modifiedDate));
115                    }
116    
117                    journalFolderImpl.setParentFolderId(parentFolderId);
118    
119                    if (treePath == null) {
120                            journalFolderImpl.setTreePath(StringPool.BLANK);
121                    }
122                    else {
123                            journalFolderImpl.setTreePath(treePath);
124                    }
125    
126                    if (name == null) {
127                            journalFolderImpl.setName(StringPool.BLANK);
128                    }
129                    else {
130                            journalFolderImpl.setName(name);
131                    }
132    
133                    if (description == null) {
134                            journalFolderImpl.setDescription(StringPool.BLANK);
135                    }
136                    else {
137                            journalFolderImpl.setDescription(description);
138                    }
139    
140                    journalFolderImpl.setStatus(status);
141                    journalFolderImpl.setStatusByUserId(statusByUserId);
142    
143                    if (statusByUserName == null) {
144                            journalFolderImpl.setStatusByUserName(StringPool.BLANK);
145                    }
146                    else {
147                            journalFolderImpl.setStatusByUserName(statusByUserName);
148                    }
149    
150                    if (statusDate == Long.MIN_VALUE) {
151                            journalFolderImpl.setStatusDate(null);
152                    }
153                    else {
154                            journalFolderImpl.setStatusDate(new Date(statusDate));
155                    }
156    
157                    journalFolderImpl.resetOriginalValues();
158    
159                    return journalFolderImpl;
160            }
161    
162            @Override
163            public void readExternal(ObjectInput objectInput) throws IOException {
164                    uuid = objectInput.readUTF();
165                    folderId = objectInput.readLong();
166                    groupId = objectInput.readLong();
167                    companyId = objectInput.readLong();
168                    userId = objectInput.readLong();
169                    userName = objectInput.readUTF();
170                    createDate = objectInput.readLong();
171                    modifiedDate = objectInput.readLong();
172                    parentFolderId = objectInput.readLong();
173                    treePath = objectInput.readUTF();
174                    name = objectInput.readUTF();
175                    description = objectInput.readUTF();
176                    status = objectInput.readInt();
177                    statusByUserId = objectInput.readLong();
178                    statusByUserName = objectInput.readUTF();
179                    statusDate = objectInput.readLong();
180            }
181    
182            @Override
183            public void writeExternal(ObjectOutput objectOutput)
184                    throws IOException {
185                    if (uuid == null) {
186                            objectOutput.writeUTF(StringPool.BLANK);
187                    }
188                    else {
189                            objectOutput.writeUTF(uuid);
190                    }
191    
192                    objectOutput.writeLong(folderId);
193                    objectOutput.writeLong(groupId);
194                    objectOutput.writeLong(companyId);
195                    objectOutput.writeLong(userId);
196    
197                    if (userName == null) {
198                            objectOutput.writeUTF(StringPool.BLANK);
199                    }
200                    else {
201                            objectOutput.writeUTF(userName);
202                    }
203    
204                    objectOutput.writeLong(createDate);
205                    objectOutput.writeLong(modifiedDate);
206                    objectOutput.writeLong(parentFolderId);
207    
208                    if (treePath == null) {
209                            objectOutput.writeUTF(StringPool.BLANK);
210                    }
211                    else {
212                            objectOutput.writeUTF(treePath);
213                    }
214    
215                    if (name == null) {
216                            objectOutput.writeUTF(StringPool.BLANK);
217                    }
218                    else {
219                            objectOutput.writeUTF(name);
220                    }
221    
222                    if (description == null) {
223                            objectOutput.writeUTF(StringPool.BLANK);
224                    }
225                    else {
226                            objectOutput.writeUTF(description);
227                    }
228    
229                    objectOutput.writeInt(status);
230                    objectOutput.writeLong(statusByUserId);
231    
232                    if (statusByUserName == null) {
233                            objectOutput.writeUTF(StringPool.BLANK);
234                    }
235                    else {
236                            objectOutput.writeUTF(statusByUserName);
237                    }
238    
239                    objectOutput.writeLong(statusDate);
240            }
241    
242            public String uuid;
243            public long folderId;
244            public long groupId;
245            public long companyId;
246            public long userId;
247            public String userName;
248            public long createDate;
249            public long modifiedDate;
250            public long parentFolderId;
251            public String treePath;
252            public String name;
253            public String description;
254            public int status;
255            public long statusByUserId;
256            public String statusByUserName;
257            public long statusDate;
258    }