}
/**
+ * Deletes the given album. The owner of the album has to be a local Sone,
+ * and the album has to be {@link Album#isEmpty() empty} to be deleted.
+ *
+ * @param album
+ * The album to remove
+ */
+ public void deleteAlbum(Album album) {
+ Validation.begin().isNotNull("Album", album).check().is("Local Sone", isLocalSone(album.getSone())).check();
+ if (!album.isEmpty()) {
+ return;
+ }
+ if (album.getParent() == null) {
+ album.getSone().removeAlbum(album);
+ } else {
+ album.getParent().removeAlbum(album);
+ }
+ synchronized (albums) {
+ albums.remove(album.getId());
+ }
+ saveSone(album.getSone());
+ }
+
+ /**
* Creates a new image.
*
* @param sone
synchronized (images) {
images.put(image.getId(), image);
}
+ imageInserter.insertImage(temporaryImage, image);
return image;
}
* @param temporaryImage
* The temporary image to delete
*/
- public void deteleTemporaryImage(TemporaryImage temporaryImage) {
+ public void deleteTemporaryImage(TemporaryImage temporaryImage) {
Validation.begin().isNotNull("Temporary Image", temporaryImage).check();
deleteTemporaryImage(temporaryImage.getId());
}
synchronized (temporaryImages) {
temporaryImages.remove(imageId);
}
+ Image image = getImage(imageId, false);
+ if (image != null) {
+ imageInserter.cancelImageInsert(image);
+ }
}
/**