001
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
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 }