public Image updateImage(long imageId, byte[] bytes, String type, int height, int width, int size) throws PortalException, SystemException { Image image = imagePersistence.fetchByPrimaryKey(imageId); if (image == null) { image = imagePersistence.create(imageId); } image.setModifiedDate(new Date()); image.setType(type); image.setHeight(height); image.setWidth(width); image.setSize(size); Hook hook = HookFactory.getInstance(); hook.updateImage(image, type, bytes); imagePersistence.update(image, false); WebServerServletTokenUtil.resetToken(imageId); return image; }
@Override public void deleteImage(long imageId) throws PortalException, SystemException { if (imageId <= 0) { return; } /*if (PropsValues.IMAGE_HOOK_IMPL.equals( DatabaseHook.class.getName()) && (imagePersistence.getListeners().length == 0)) { runSQL("delete from Image where imageId = " + imageId); imagePersistence.clearCache(); } else {*/ try { Image image = getImage(imageId); imagePersistence.remove(imageId); Hook hook = HookFactory.getInstance(); hook.deleteImage(image); } catch (NoSuchImageException nsie) { } // } }