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