import java.util.UUID;
import net.pterodactylus.sone.data.Album;
+import net.pterodactylus.sone.data.IdBuilder;
import net.pterodactylus.sone.data.Image;
import net.pterodactylus.sone.data.Sone;
*/
public class AlbumImpl implements Album {
+ private final IdBuilder idBuilder = new IdBuilder();
+
/** The ID of this album. */
private final String id;
@Override
public String getId() {
+ return idBuilder.buildId(sone.getId(), id);
+ }
+
+ @Override
+ public String getInternalId() {
return id;
}
checkArgument(equals(album.getParent()), "album must belong to this album");
int oldIndex = albums.indexOf(album);
if (oldIndex <= 0) {
- return null;
+ return album;
}
albums.remove(oldIndex);
albums.add(oldIndex - 1, album);
checkArgument(equals(album.getParent()), "album must belong to this album");
int oldIndex = albums.indexOf(album);
if ((oldIndex < 0) || (oldIndex >= (albums.size() - 1))) {
- return null;
+ return album;
}
albums.remove(oldIndex);
albums.add(oldIndex + 1, album);
checkArgument(image.getAlbum().equals(this), "image must belong to this album");
int oldIndex = imageIds.indexOf(image.getId());
if (oldIndex <= 0) {
- return null;
+ return image;
}
imageIds.remove(image.getId());
imageIds.add(oldIndex - 1, image.getId());
checkArgument(image.getAlbum().equals(this), "image must belong to this album");
int oldIndex = imageIds.indexOf(image.getId());
if ((oldIndex == -1) || (oldIndex >= (imageIds.size() - 1))) {
- return null;
+ return image;
}
imageIds.remove(image.getId());
imageIds.add(oldIndex + 1, image.getId());