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