List of usage examples for com.liferay.portal.kernel.portlet PortalPreferences getValues
public String[] getValues(String namespace, String key, String[] defaultValue);
From source file:com.liferay.journal.web.internal.display.context.JournalDisplayContext.java
License:Open Source License
public String[] getAddMenuFavItems() throws PortalException { if (_addMenuFavItems != null) { return _addMenuFavItems; }/* www .j a v a 2 s . co m*/ PortalPreferences portalPreferences = PortletPreferencesFactoryUtil.getPortalPreferences(_request); String key = JournalPortletUtil.getAddMenuFavItemKey(_liferayPortletRequest, _liferayPortletResponse); _addMenuFavItems = portalPreferences.getValues(JournalPortletKeys.JOURNAL, key, new String[0]); return _addMenuFavItems; }
From source file:com.liferay.journal.web.internal.portlet.JournalPortlet.java
License:Open Source License
public void addAddMenuFavItem(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String ddmStructureKey = ParamUtil.getString(actionRequest, "ddmStructureKey"); PortalPreferences portalPreferences = PortletPreferencesFactoryUtil.getPortalPreferences(actionRequest); String key = JournalPortletUtil.getAddMenuFavItemKey(actionRequest, actionResponse); String[] addMenuFavItems = portalPreferences.getValues(JournalPortletKeys.JOURNAL, key, new String[0]); if (addMenuFavItems.length >= _journalWebConfiguration.maxAddMenuItems()) { hideDefaultErrorMessage(actionRequest); throw new MaxAddMenuFavItemsException(); }//from w w w . j a va 2 s .co m portalPreferences.setValues(JournalPortletKeys.JOURNAL, key, ArrayUtil.append(addMenuFavItems, ddmStructureKey)); SessionMessages.add(actionRequest, _portal.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET, JournalPortletKeys.JOURNAL); }