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.BookmarksFolder;
022    
023    import java.io.Serializable;
024    
025    import java.util.Date;
026    
027    /**
028     * The cache model class for representing BookmarksFolder in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see BookmarksFolder
032     * @generated
033     */
034    public class BookmarksFolderCacheModel implements CacheModel<BookmarksFolder>,
035            Serializable {
036            @Override
037            public String toString() {
038                    StringBundler sb = new StringBundler(25);
039    
040                    sb.append("{uuid=");
041                    sb.append(uuid);
042                    sb.append(", folderId=");
043                    sb.append(folderId);
044                    sb.append(", groupId=");
045                    sb.append(groupId);
046                    sb.append(", companyId=");
047                    sb.append(companyId);
048                    sb.append(", userId=");
049                    sb.append(userId);
050                    sb.append(", userName=");
051                    sb.append(userName);
052                    sb.append(", createDate=");
053                    sb.append(createDate);
054                    sb.append(", modifiedDate=");
055                    sb.append(modifiedDate);
056                    sb.append(", resourceBlockId=");
057                    sb.append(resourceBlockId);
058                    sb.append(", parentFolderId=");
059                    sb.append(parentFolderId);
060                    sb.append(", name=");
061                    sb.append(name);
062                    sb.append(", description=");
063                    sb.append(description);
064                    sb.append("}");
065    
066                    return sb.toString();
067            }
068    
069            public BookmarksFolder toEntityModel() {
070                    BookmarksFolderImpl bookmarksFolderImpl = new BookmarksFolderImpl();
071    
072                    if (uuid == null) {
073                            bookmarksFolderImpl.setUuid(StringPool.BLANK);
074                    }
075                    else {
076                            bookmarksFolderImpl.setUuid(uuid);
077                    }
078    
079                    bookmarksFolderImpl.setFolderId(folderId);
080                    bookmarksFolderImpl.setGroupId(groupId);
081                    bookmarksFolderImpl.setCompanyId(companyId);
082                    bookmarksFolderImpl.setUserId(userId);
083    
084                    if (userName == null) {
085                            bookmarksFolderImpl.setUserName(StringPool.BLANK);
086                    }
087                    else {
088                            bookmarksFolderImpl.setUserName(userName);
089                    }
090    
091                    if (createDate == Long.MIN_VALUE) {
092                            bookmarksFolderImpl.setCreateDate(null);
093                    }
094                    else {
095                            bookmarksFolderImpl.setCreateDate(new Date(createDate));
096                    }
097    
098                    if (modifiedDate == Long.MIN_VALUE) {
099                            bookmarksFolderImpl.setModifiedDate(null);
100                    }
101                    else {
102                            bookmarksFolderImpl.setModifiedDate(new Date(modifiedDate));
103                    }
104    
105                    bookmarksFolderImpl.setResourceBlockId(resourceBlockId);
106                    bookmarksFolderImpl.setParentFolderId(parentFolderId);
107    
108                    if (name == null) {
109                            bookmarksFolderImpl.setName(StringPool.BLANK);
110                    }
111                    else {
112                            bookmarksFolderImpl.setName(name);
113                    }
114    
115                    if (description == null) {
116                            bookmarksFolderImpl.setDescription(StringPool.BLANK);
117                    }
118                    else {
119                            bookmarksFolderImpl.setDescription(description);
120                    }
121    
122                    bookmarksFolderImpl.resetOriginalValues();
123    
124                    return bookmarksFolderImpl;
125            }
126    
127            public String uuid;
128            public long folderId;
129            public long groupId;
130            public long companyId;
131            public long userId;
132            public String userName;
133            public long createDate;
134            public long modifiedDate;
135            public long resourceBlockId;
136            public long parentFolderId;
137            public String name;
138            public String description;
139    }