protected static com.liferay.portal.model.PortletPreferences update(
com.liferay.portal.model.PortletPreferences portletPreferences)
throws com.liferay.portal.SystemException {
PortletPreferencesPersistence persistence = (PortletPreferencesPersistence)InstancePool.get(PERSISTENCE);
ModelListener listener = null;
if (Validator.isNotNull(LISTENER)) {
try {
listener = (ModelListener)Class.forName(LISTENER).newInstance();
}
catch (Exception e) {
Logger.error(PortletPreferencesUtil.class,e.getMessage(),e);
}
}
boolean isNew = portletPreferences.isNew();
if (listener != null) {
if (isNew) {
listener.onBeforeCreate(portletPreferences);
}
else {
listener.onBeforeUpdate(portletPreferences);
}
}
portletPreferences = persistence.update(portletPreferences);
if (listener != null) {
if (isNew) {
listener.onAfterCreate(portletPreferences);
}
else {
listener.onAfterUpdate(portletPreferences);
}
}
return portletPreferences;
}