*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/** Creates a new album with a random ID. */
public AlbumImpl(Sone sone) {
this(sone, UUID.randomUUID().toString());
/** Creates a new album with a random ID. */
public AlbumImpl(Sone sone) {
this(sone, UUID.randomUUID().toString());
checkArgument(equals(album.getParent()), "album must belong to this album");
int oldIndex = albums.indexOf(album);
if (oldIndex <= 0) {
checkArgument(equals(album.getParent()), "album must belong to this album");
int oldIndex = albums.indexOf(album);
if (oldIndex <= 0) {
checkArgument(equals(album.getParent()), "album must belong to this album");
int oldIndex = albums.indexOf(album);
if ((oldIndex < 0) || (oldIndex >= (albums.size() - 1))) {
checkArgument(equals(album.getParent()), "album must belong to this album");
int oldIndex = albums.indexOf(album);
if ((oldIndex < 0) || (oldIndex >= (albums.size() - 1))) {
if (!imageIds.contains(image.getId())) {
imageIds.add(image.getId());
images.put(image.getId(), image);
if (!imageIds.contains(image.getId())) {
imageIds.add(image.getId());
images.put(image.getId(), image);
checkArgument(image.getSone().equals(sone), "image must belong to the same Sone as this album");
imageIds.remove(image.getId());
images.remove(image.getId());
checkArgument(image.getSone().equals(sone), "image must belong to the same Sone as this album");
imageIds.remove(image.getId());
images.remove(image.getId());
public Album update() throws IllegalStateException {
if (title.isPresent() && title.get().trim().isEmpty()) {
throw new AlbumTitleMustNotBeEmpty();
public Album update() throws IllegalStateException {
if (title.isPresent() && title.get().trim().isEmpty()) {
throw new AlbumTitleMustNotBeEmpty();
hash.putString("ID(").putString(id).putString(")");
hash.putString("Title(").putString(title).putString(")");
hash.putString("Description(").putString(description).putString(")");
hash.putString("ID(").putString(id).putString(")");
hash.putString("Title(").putString(title).putString(")");
hash.putString("Description(").putString(description).putString(")");