Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. /*
  2. * Read Preference of portlet placed on another page.
  3. *Example -1 : If Preferences of portlet is unique per layout
  4. */
  5. PortletPreferences pageCommentsPref = null;
  6. String portletId = PortletKeys.PAGE_COMMENTS;
  7. String defaultPreferences = null;
  8. long plid = GetterUtil.getLong(serviceContext.getPlid());//Plid of page where portlet is placed
  9. try {
  10. /*
  11. * Preferences are unique per layout . Preferences won't be shared between pages
  12. */
  13. pageCommentsPref = portletPreferencesLocalService.getPreferences(companyId, 0,
  14. PortletKeys.PREFS_OWNER_TYPE_LAYOUT, plid, portletId, defaultPreferences);
  15.  
  16. } catch (SystemException e) {
  17. _log.error(e.getMessage());
  18. }
  19.  
  20.  
  21. /*
  22. * Read Preference of portlet placed on another page.
  23. * Example -2 : If Preference of portlet is unique per layout
  24. */
  25. PortletPreferences blogPreferences = null;
  26. long ownerId = groupId;
  27. String defaultPreferences = null;
  28. /*
  29. *Preferences are unique per group. If multiple blog portlet places in group at multiple pages
  30. then preferences will be shated between them.
  31. */
  32. String portletId = PortletKeys.BLOGS;
  33. long plid=PortletKeys.PREFS_PLID_SHARED //Plid 0 because preferences are unique per group
  34.  
  35. try {
  36. blogPreferences = portletPreferencesLocalService.getPreferences(companyId, ownerId,
  37. PortletKeys.PREFS_OWNER_TYPE_GROUP, plid, portletId, defaultPreferences);
  38.  
  39.  
  40. } catch (SystemException e) {
  41. _log.error(e.getMessage());
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement