Skip to content

Instantly share code, notes, and snippets.

@milendyankov
Last active June 17, 2020 19:24
Show Gist options
  • Save milendyankov/5f87861c943c9ba776f86af83dbcca23 to your computer and use it in GitHub Desktop.
Save milendyankov/5f87861c943c9ba776f86af83dbcca23 to your computer and use it in GitHub Desktop.
import javax.portlet.PortletPreferences;
import com.liferay.portal.kernel.util.PortalUtil;
import com.liferay.portal.kernel.util.PortletKeys;
import com.liferay.portal.kernel.service.PortalPreferencesLocalServiceUtil;
companyId = PortalUtil.getDefaultCompanyId()
PortletPreferences portalPreferences = PortalPreferencesLocalServiceUtil.getPreferences(PortletKeys.PREFS_OWNER_ID_DEFAULT, PortletKeys.PREFS_OWNER_TYPE_COMPANY);
PortletPreferences companyPreferences = PortalPreferencesLocalServiceUtil.getPreferences(companyId, PortletKeys.PREFS_OWNER_TYPE_COMPANY);
Map<String, String[]> preferencesMap = portalPreferences.getMap();
preferencesMap.putAll(companyPreferences.getMap())
preferencesMap.each{ key, value ->
println key + ": " + value
println " -------------------------------------------------- "
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment