From 93bcc92cdf6a44b32ee7bd6ff6b48624ec9589d1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 13 Apr 2011 05:54:37 +0200 Subject: [PATCH] Add method to delete image. --- src/main/java/net/pterodactylus/sone/core/Core.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 7183063..91a04d3 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -1892,6 +1892,24 @@ public class Core implements IdentityListener, UpdateListener, ImageInsertListen } /** + * Deletes the given image. This method will also delete a matching + * temporary image. + * + * @see #deleteTemporaryImage(TemporaryImage) + * @param image + * The image to delete + */ + public void deleteImage(Image image) { + Validation.begin().isNotNull("Image", image).check().is("Local Sone", isLocalSone(image.getSone())).check(); + image.getAlbum().removeImage(image); + synchronized (images) { + images.remove(image.getId()); + } + deleteTemporaryImage(image.getId()); + saveSone(image.getSone()); + } + + /** * Creates a new temporary image. * * @param mimeType -- 2.7.4