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