@Override public Image updateImpl(com.liferay.portal.model.Image image) throws SystemException { image = toUnwrappedModel(image); boolean isNew = image.isNew(); Session session = null; try { session = openSession(); if (image.isNew()) { session.save(image); image.setNew(false); } else { session.merge(image); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); if (isNew || !ImageModelImpl.COLUMN_BITMASK_ENABLED) { FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); } EntityCacheUtil.putResult( ImageModelImpl.ENTITY_CACHE_ENABLED, ImageImpl.class, image.getPrimaryKey(), image); return image; }
/** * Adds the image to the database. Also notifies the appropriate model listeners. * * @param image the image * @return the image that was added */ @Indexable(type = IndexableType.REINDEX) @Override public Image addImage(Image image) { image.setNew(true); return imagePersistence.update(image); }
/** * Creates a new image with the primary key. Does not add the image to the database. * * @param imageId the primary key for the new image * @return the new image */ public Image create(long imageId) { Image image = new ImageImpl(); image.setNew(true); image.setPrimaryKey(imageId); return image; }