JSR 168 PortletPreference concepts

javax.portlet.PortletPreference is an abstract interface in JSR168/JSR 286 API.
Preference object is attached to per user per portlet window.
Meaning, when user A saves data to preferences then this data is for User A only and for that perticular portlet window.
Internally, portal server creates a unique key using "user id+portlet window id" to store preference against a user and this is the reason that preference object are attached to per user per portlet window.
Concepts on PortletPreferences
1) Preference object can be retrieved using RenderRequest or ActionRequest.
2) Preference can only be stored in proecessAction method of portlet not in render methods (view, edit).
3) Preference object behaves differently in different portlets modes ( edit, edit_shared, configure), see more details here on Portlet Mode Access Rights.
4) User preference get lost on deleting a portlet from page.
5) User preference persisits on updating a portlet application.
I will keep on updating this post as and when i learn new fundamentals on PortletPreferences.

No comments: