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