PortletPreferencesImpl prefs =
(PortletPreferencesImpl)prefsPool.get(pk);
if (prefs == null) {
PortletPreferences portletPreferences = null;
Portlet portlet = null;
// if (groupId != null) {
// portlet = PortletManagerUtil.getPortletById(
// companyId, groupId, pk.portletId);
// }
// else {
portlet = PortletManagerUtil.getPortletById(
companyId, pk.portletId);
// }
try {
portletPreferences =
PortletPreferencesUtil.findByPrimaryKey(pk);
}
catch (NoSuchPortletPreferencesException nsppe) {
portletPreferences = PortletPreferencesUtil.create(pk);
portletPreferences.setPreferences(
portlet.getDefaultPreferences());
PortletPreferencesUtil.update(portletPreferences);
}
prefs = PortletPreferencesSerializer.fromXML(
companyId, pk, portletPreferences.getPreferences());
prefsPool.put(pk, prefs);
}
return (PortletPreferencesImpl)prefs.clone();