Class 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
    The PortletPreferencesImpl is the default implementation for the PortletPreferences 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 Detail

      • predefinedPrefReadOnlyMap

        protected Map predefinedPrefReadOnlyMap
      • userPrefMap

        protected Map userPrefMap
      • defaultMap

        protected Map defaultMap
      • modifiedList

        protected Set modifiedList
    • 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 interface javax.portlet.PortletPreferences
      • getValue

        public String getValue​(String key,
                               String def)
        Specified by:
        getValue in interface javax.portlet.PortletPreferences
      • getValues

        public String[] getValues​(String key,
                                  String[] def)
        Specified by:
        getValues in interface javax.portlet.PortletPreferences
      • setValue

        public void setValue​(String key,
                             String value)
                      throws javax.portlet.ReadOnlyException
        Specified by:
        setValue in interface javax.portlet.PortletPreferences
        Throws:
        javax.portlet.ReadOnlyException
      • setValues

        public void setValues​(String key,
                              String[] values)
                       throws javax.portlet.ReadOnlyException
        Specified by:
        setValues in interface javax.portlet.PortletPreferences
        Throws:
        javax.portlet.ReadOnlyException
      • getNames

        public Enumeration<String> getNames()
        Specified by:
        getNames in interface javax.portlet.PortletPreferences
      • getMap

        public Map<String,​String[]> getMap()
        Specified by:
        getMap in interface javax.portlet.PortletPreferences
      • reset

        public void reset​(String key)
                   throws javax.portlet.ReadOnlyException
        Specified by:
        reset in interface javax.portlet.PortletPreferences
        Throws:
        javax.portlet.ReadOnlyException
      • store

        public void store()
                   throws IOException,
                          javax.portlet.ValidatorException
        Specified by:
        store in interface javax.portlet.PortletPreferences
        Throws:
        IOException
        javax.portlet.ValidatorException
      • setPreferencesValidator

        public void setPreferencesValidator​(javax.portlet.PreferencesValidator pv)
        Specified by:
        setPreferencesValidator in interface com.sun.portal.portletcontainer.common.PreferencesValidatorSetter
      • cloneMap

        protected HashMap cloneMap​(Map original)
        Clone a map.
      • 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.