- /**
- * Adds the given image to this album.
- *
- * @param image
- * The image to add
- */
- public void addImage(Image image) {
- Validation.begin().isNotNull("Image", image).check().isNotNull("Image Owner", image.getSone()).check().isEqual("Image Owner", image.getSone(), sone).check();
- if (image.getAlbum() != null) {
- image.getAlbum().removeImage(image);
- }
- image.setAlbum(this);
- if (!images.contains(image)) {
- images.add(image);
- }
- }
-
- /**
- * Removes the given image from this album.
- *
- * @param image
- * The image to remove
- */
- public void removeImage(Image image) {
- Validation.begin().isNotNull("Image", image).check().isEqual("Image Owner", image.getSone(), sone).check();
- images.remove(image);
- }
-
- /**
- * Returns the album image of this album, or {@code null} if no album image
- * has been set.
- *
- * @return The image to show when this album is listed
- */
- public Image getAlbumImage() {
- if (albumImage == -1) {
- return null;
- }
- return images.get(albumImage);
- }