001
014
015 package com.liferay.portlet;
016
017 import java.io.IOException;
018 import java.io.Serializable;
019
020 import java.util.Enumeration;
021 import java.util.Map;
022
023 import javax.portlet.PortletPreferences;
024 import javax.portlet.ReadOnlyException;
025 import javax.portlet.ValidatorException;
026
027
030 public class PortletPreferencesWrapper
031 implements PortletPreferences, Serializable {
032
033 public PortletPreferencesWrapper(PortletPreferences portletPreferences) {
034 _portletPreferences = portletPreferences;
035 }
036
037
040 public PortletPreferencesWrapper(
041 PortletPreferences portletPreferences, String lifecycle) {
042
043 _portletPreferences = portletPreferences;
044 }
045
046 @Override
047 public boolean equals(Object obj) {
048 if (this == obj) {
049 return true;
050 }
051
052 if (!(obj instanceof PortletPreferencesWrapper)) {
053 return false;
054 }
055
056 PortletPreferencesWrapper portletPreferencesWrapper =
057 (PortletPreferencesWrapper)obj;
058
059 if (getPortletPreferencesImpl().equals(
060 portletPreferencesWrapper.getPortletPreferencesImpl())) {
061
062 return true;
063 }
064 else {
065 return false;
066 }
067 }
068
069 @Override
070 public Map<String, String[]> getMap() {
071 return _portletPreferences.getMap();
072 }
073
074 @Override
075 public Enumeration<String> getNames() {
076 return _portletPreferences.getNames();
077 }
078
079 public PortletPreferencesImpl getPortletPreferencesImpl() {
080 return (PortletPreferencesImpl)_portletPreferences;
081 }
082
083
086 public PortletPreferencesImpl getPreferencesImpl() {
087 return getPortletPreferencesImpl();
088 }
089
090 @Override
091 public String getValue(String key, String def) {
092 return _portletPreferences.getValue(key, def);
093 }
094
095 @Override
096 public String[] getValues(String key, String[] def) {
097 return _portletPreferences.getValues(key, def);
098 }
099
100 @Override
101 public int hashCode() {
102 return _portletPreferences.hashCode();
103 }
104
105 @Override
106 public boolean isReadOnly(String key) {
107 return _portletPreferences.isReadOnly(key);
108 }
109
110 @Override
111 public void reset(String key) throws ReadOnlyException {
112 _portletPreferences.reset(key);
113 }
114
115 @Override
116 public void setValue(String key, String value) throws ReadOnlyException {
117 _portletPreferences.setValue(key, value);
118 }
119
120 @Override
121 public void setValues(String key, String[] values)
122 throws ReadOnlyException {
123
124 _portletPreferences.setValues(key, values);
125 }
126
127 @Override
128 public void store() throws IOException, ValidatorException {
129
130
131
132 throw new IllegalStateException(
133 "Preferences cannot be stored inside a render call");
134 }
135
136 private PortletPreferences _portletPreferences;
137
138 }