- /**
- * Sets the owner of the album. The owner can only be set as long as the
- * current owner is {@code null}.
- *
- * @param sone
- * The album owner
- * @return This album
- */
- public Album setSone(Sone sone) {
- Validation.begin().isNull("Current Album Owner", this.sone).isNotNull("New Album Owner", sone).check();
- this.sone = sone;
- return this;
- }
-
- /**
- * Returns the nested albums.
- *
- * @return The nested albums
- */
- public List<Album> getAlbums() {
- return new ArrayList<Album>(albums);
- }
-
- /**
- * Adds an album to this album.
- *
- * @param album
- * The album to add
- */
- public void addAlbum(Album album) {
- Validation.begin().isNotNull("Album", album).check().isEqual("Album Owner", album.sone, sone).isNull("Album Parent", album.parent).check();
- albums.add(album);
- album.setParent(this);
- }
-
- /**
- * Removes an album from this album.
- *
- * @param album
- * The album to remove
- */
- public void removeAlbum(Album album) {
- Validation.begin().isNotNull("Album", album).check().isEqual("Album Owner", album.sone, sone).isEqual("Album Parent", album.parent, this).check();
- albums.remove(album);
- album.removeParent();
- }