}
protected com.liferay.portal.model.PortletPreferences update(
com.liferay.portal.model.PortletPreferences portletPreferences)
throws SystemException {
Session session = null;
try {
if (portletPreferences.isNew() || portletPreferences.isModified()) {
session = openSession();
if (portletPreferences.isNew()) {
PortletPreferencesHBM portletPreferencesHBM = new PortletPreferencesHBM(portletPreferences.getPortletId(),
portletPreferences.getLayoutId(),
portletPreferences.getUserId(),
portletPreferences.getPreferences());
session.save(portletPreferencesHBM);
session.flush();
}
else {
try {
PortletPreferencesHBM portletPreferencesHBM = (PortletPreferencesHBM)session.load(PortletPreferencesHBM.class,
portletPreferences.getPrimaryKey());
portletPreferencesHBM.setPreferences(portletPreferences.getPreferences());
session.flush();
}
catch (ObjectNotFoundException onfe) {
PortletPreferencesHBM portletPreferencesHBM = new PortletPreferencesHBM(portletPreferences.getPortletId(),
portletPreferences.getLayoutId(),
portletPreferences.getUserId(),
portletPreferences.getPreferences());
session.save(portletPreferencesHBM);
session.flush();
}
}
portletPreferences.setNew(false);
portletPreferences.setModified(false);