Class PortletPreferencesImpl
- java.lang.Object
-
- org.silverpeas.core.web.portlets.context.window.impl.PortletPreferencesImpl
-
- All Implemented Interfaces:
com.sun.portal.portletcontainer.common.PreferencesValidatorSetter
,javax.portlet.PortletPreferences
public class PortletPreferencesImpl extends Object implements javax.portlet.PortletPreferences, com.sun.portal.portletcontainer.common.PreferencesValidatorSetter
ThePortletPreferencesImpl
is the default implementation for thePortletPreferences
interface. This implementation uses the portlet window preference registry as the backend storage of the preferences data. This implementation caches the preferences and only write to the registry when the method store() is called. The registry is expected to have the following structure defined:- See Also:
PortletPreferences
-
-
Field Summary
Fields Modifier and Type Field Description protected Map
defaultMap
protected Set
modifiedList
protected Map
predefinedPrefReadOnlyMap
protected Map
userPrefMap
-
Constructor Summary
Constructors Constructor Description PortletPreferencesImpl(javax.servlet.http.HttpServletRequest request, PortletRegistryContext portletRegistryContext, com.sun.portal.container.EntityID entityID, String userID, ResourceBundle bundle, boolean isReadOnly)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected HashMap
cloneMap(Map original)
Clone a map.Map<String,String[]>
getMap()
Enumeration<String>
getNames()
String
getValue(String key, String def)
String[]
getValues(String key, String[] def)
boolean
isReadOnly(String key)
protected void
loadPrefMap(String prefName, String def)
Loads a particular predefined preferences from the preference registry and store it in the predefinedPrefMap.void
reset(String key)
protected void
savePrefMap()
Writes all the changes made to the predefined preferences back to registry and reset the modifiedList.void
setPreferencesValidator(javax.portlet.PreferencesValidator pv)
void
setValue(String key, String value)
void
setValues(String key, String[] values)
void
store()
-
-
-
Constructor Detail
-
PortletPreferencesImpl
public PortletPreferencesImpl(javax.servlet.http.HttpServletRequest request, PortletRegistryContext portletRegistryContext, com.sun.portal.container.EntityID entityID, String userID, ResourceBundle bundle, boolean isReadOnly)
-
-
Method Detail
-
isReadOnly
public boolean isReadOnly(String key)
- Specified by:
isReadOnly
in interfacejavax.portlet.PortletPreferences
-
getValue
public String getValue(String key, String def)
- Specified by:
getValue
in interfacejavax.portlet.PortletPreferences
-
getValues
public String[] getValues(String key, String[] def)
- Specified by:
getValues
in interfacejavax.portlet.PortletPreferences
-
setValue
public void setValue(String key, String value) throws javax.portlet.ReadOnlyException
- Specified by:
setValue
in interfacejavax.portlet.PortletPreferences
- Throws:
javax.portlet.ReadOnlyException
-
setValues
public void setValues(String key, String[] values) throws javax.portlet.ReadOnlyException
- Specified by:
setValues
in interfacejavax.portlet.PortletPreferences
- Throws:
javax.portlet.ReadOnlyException
-
getNames
public Enumeration<String> getNames()
- Specified by:
getNames
in interfacejavax.portlet.PortletPreferences
-
getMap
public Map<String,String[]> getMap()
- Specified by:
getMap
in interfacejavax.portlet.PortletPreferences
-
reset
public void reset(String key) throws javax.portlet.ReadOnlyException
- Specified by:
reset
in interfacejavax.portlet.PortletPreferences
- Throws:
javax.portlet.ReadOnlyException
-
store
public void store() throws IOException, javax.portlet.ValidatorException
- Specified by:
store
in interfacejavax.portlet.PortletPreferences
- Throws:
IOException
javax.portlet.ValidatorException
-
setPreferencesValidator
public void setPreferencesValidator(javax.portlet.PreferencesValidator pv)
- Specified by:
setPreferencesValidator
in interfacecom.sun.portal.portletcontainer.common.PreferencesValidatorSetter
-
loadPrefMap
protected void loadPrefMap(String prefName, String def)
Loads a particular predefined preferences from the preference registry and store it in the predefinedPrefMap.
-
savePrefMap
protected void savePrefMap()
Writes all the changes made to the predefined preferences back to registry and reset the modifiedList.
-
-