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.Portlet;
021    
022    import java.io.Serializable;
023    
024    /**
025     * The cache model class for representing Portlet in entity cache.
026     *
027     * @author Brian Wing Shun Chan
028     * @see Portlet
029     * @generated
030     */
031    public class PortletCacheModel implements CacheModel<Portlet>, Serializable {
032            @Override
033            public String toString() {
034                    StringBundler sb = new StringBundler(11);
035    
036                    sb.append("{id=");
037                    sb.append(id);
038                    sb.append(", companyId=");
039                    sb.append(companyId);
040                    sb.append(", portletId=");
041                    sb.append(portletId);
042                    sb.append(", roles=");
043                    sb.append(roles);
044                    sb.append(", active=");
045                    sb.append(active);
046                    sb.append("}");
047    
048                    return sb.toString();
049            }
050    
051            public Portlet toEntityModel() {
052                    PortletImpl portletImpl = new PortletImpl();
053    
054                    portletImpl.setId(id);
055                    portletImpl.setCompanyId(companyId);
056    
057                    if (portletId == null) {
058                            portletImpl.setPortletId(StringPool.BLANK);
059                    }
060                    else {
061                            portletImpl.setPortletId(portletId);
062                    }
063    
064                    if (roles == null) {
065                            portletImpl.setRoles(StringPool.BLANK);
066                    }
067                    else {
068                            portletImpl.setRoles(roles);
069                    }
070    
071                    portletImpl.setActive(active);
072    
073                    portletImpl.resetOriginalValues();
074    
075                    return portletImpl;
076            }
077    
078            public long id;
079            public long companyId;
080            public String portletId;
081            public String roles;
082            public boolean active;
083    }