}
}
protected com.liferay.portal.model.Portlet update(
com.liferay.portal.model.Portlet portlet) throws SystemException {
Session session = null;
try {
if (portlet.isNew() || portlet.isModified()) {
session = openSession();
if (portlet.isNew()) {
PortletHBM portletHBM = new PortletHBM(portlet.getPortletId(),
portlet.getGroupId(), portlet.getCompanyId(),
portlet.getDefaultPreferences(),
portlet.getNarrow(), portlet.getRoles(),
portlet.getActive());
session.save(portletHBM);
session.flush();
}
else {
try {
PortletHBM portletHBM = (PortletHBM)session.load(PortletHBM.class,
portlet.getPrimaryKey());
portletHBM.setDefaultPreferences(portlet.getDefaultPreferences());
portletHBM.setNarrow(portlet.getNarrow());
portletHBM.setRoles(portlet.getRoles());
portletHBM.setActive(portlet.getActive());
session.flush();
}
catch (ObjectNotFoundException onfe) {
PortletHBM portletHBM = new PortletHBM(portlet.getPortletId(),
portlet.getGroupId(), portlet.getCompanyId(),
portlet.getDefaultPreferences(),
portlet.getNarrow(), portlet.getRoles(),
portlet.getActive());
session.save(portletHBM);
session.flush();
}
}
portlet.setNew(false);
portlet.setModified(false);