001    /**
002     * Copyright (c) 2000-2012 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.PortletPreferences;
021    
022    import java.io.Serializable;
023    
024    /**
025     * The cache model class for representing PortletPreferences in entity cache.
026     *
027     * @author Brian Wing Shun Chan
028     * @see PortletPreferences
029     * @generated
030     */
031    public class PortletPreferencesCacheModel implements CacheModel<PortletPreferences>,
032            Serializable {
033            @Override
034            public String toString() {
035                    StringBundler sb = new StringBundler(13);
036    
037                    sb.append("{portletPreferencesId=");
038                    sb.append(portletPreferencesId);
039                    sb.append(", ownerId=");
040                    sb.append(ownerId);
041                    sb.append(", ownerType=");
042                    sb.append(ownerType);
043                    sb.append(", plid=");
044                    sb.append(plid);
045                    sb.append(", portletId=");
046                    sb.append(portletId);
047                    sb.append(", preferences=");
048                    sb.append(preferences);
049                    sb.append("}");
050    
051                    return sb.toString();
052            }
053    
054            public PortletPreferences toEntityModel() {
055                    PortletPreferencesImpl portletPreferencesImpl = new PortletPreferencesImpl();
056    
057                    portletPreferencesImpl.setPortletPreferencesId(portletPreferencesId);
058                    portletPreferencesImpl.setOwnerId(ownerId);
059                    portletPreferencesImpl.setOwnerType(ownerType);
060                    portletPreferencesImpl.setPlid(plid);
061    
062                    if (portletId == null) {
063                            portletPreferencesImpl.setPortletId(StringPool.BLANK);
064                    }
065                    else {
066                            portletPreferencesImpl.setPortletId(portletId);
067                    }
068    
069                    if (preferences == null) {
070                            portletPreferencesImpl.setPreferences(StringPool.BLANK);
071                    }
072                    else {
073                            portletPreferencesImpl.setPreferences(preferences);
074                    }
075    
076                    portletPreferencesImpl.resetOriginalValues();
077    
078                    return portletPreferencesImpl;
079            }
080    
081            public long portletPreferencesId;
082            public long ownerId;
083            public int ownerType;
084            public long plid;
085            public String portletId;
086            public String preferences;
087    }