try
{
PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
PortletDefinition def = PortletApplicationUtils.getPortletOrClone(app, paNodeBean.getName());
PortletPreferencesProvider prefProvider = (PortletPreferencesProvider)
((AbstractAdminWebApplication) getApplication()).getServiceLocator()
.getService(CommonPortletServices.CPS_PORTLET_PREFERENCES_PROVIDER);
if (newName != null && newValue != null)
{
Preference pref = def.getPortletPreferences().addPreference(newName);
pref.addValue(newValue);
prefProvider.storeDefaults(def, pref);
newName = null;
newValue = null;
}
for (Preference pref : curPrefs)
{
prefProvider.storeDefaults(def, pref);
}
StringResourceModel resModel = new StringResourceModel("pam.details.action.status.portlet.saveOK", this, null, new Object [] { paNodeBean.getName() } );
feed.info(resModel.getString());
}