From afdb3c077f9f762f85be2656015609179eff8510 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 24 Aug 2013 12:42:09 +0200 Subject: [PATCH] Add isRoot() method to Album, only dump album ID in sone.xml if the parent is not the root. --- src/main/java/net/pterodactylus/sone/data/Album.java | 10 ++++++++++ src/main/resources/templates/insert/sone.xml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) 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> -- 2.7.4