From: David ‘Bombe’ Roden Date: Sat, 24 Aug 2013 10:42:09 +0000 (+0200) Subject: Add isRoot() method to Album, only dump album ID in sone.xml if the parent is not... X-Git-Tag: 0.8.7^2~29 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=afdb3c077f9f762f85be2656015609179eff8510;p=Sone.git Add isRoot() method to Album, only dump album ID in sone.xml if the parent is not the root. --- diff --git a/src/main/java/net/pterodactylus/sone/data/Album.java b/src/main/java/net/pterodactylus/sone/data/Album.java index 0c8780c..8238b3f 100644 --- a/src/main/java/net/pterodactylus/sone/data/Album.java +++ b/src/main/java/net/pterodactylus/sone/data/Album.java @@ -408,6 +408,16 @@ public class Album implements Identified, Fingerprintable { } /** + * Returns whether this album is an identitiy’s root album. + * + * @return {@code true} if this album is an identity’s root album, {@code + * false} otherwise + */ + public boolean isRoot() { + return parent == null; + } + + /** * Returns the parent album of this album. * * @return The parent album of this album, or {@code null} if this album diff --git a/src/main/resources/templates/insert/sone.xml b/src/main/resources/templates/insert/sone.xml index 511cbf2..3d456d4 100644 --- a/src/main/resources/templates/insert/sone.xml +++ b/src/main/resources/templates/insert/sone.xml @@ -67,7 +67,7 @@ <%/first> <%album.id|xml> - <%ifnull !album.parent> + <%if !album.parent.root> <%album.parent.id|xml> <%/if> <%album.title|xml>