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