From: David ‘Bombe’ Roden Date: Tue, 22 Oct 2013 06:10:20 +0000 (+0200) Subject: Store parent album ID in abstract album. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=e13a779a8c3958c1f9fdd79f6d1dc22a44ac3b84;p=Sone.git Store parent album ID in abstract album. --- diff --git a/src/main/java/net/pterodactylus/sone/data/impl/AbstractAlbum.java b/src/main/java/net/pterodactylus/sone/data/impl/AbstractAlbum.java index dce51ad..efc2168 100644 --- a/src/main/java/net/pterodactylus/sone/data/impl/AbstractAlbum.java +++ b/src/main/java/net/pterodactylus/sone/data/impl/AbstractAlbum.java @@ -37,12 +37,14 @@ import com.google.common.hash.Hashing; public abstract class AbstractAlbum implements Album { protected final String id; + protected final String parentId; protected String title; protected String description; protected String albumImage; - protected AbstractAlbum(String id) { + protected AbstractAlbum(String id, String parentId) { this.id = checkNotNull(id, "id must not be null"); + this.parentId = parentId; } @Override @@ -57,7 +59,7 @@ public abstract class AbstractAlbum implements Album { @Override public boolean isRoot() { - return getParent() == null; + return parentId == null; } @Override diff --git a/src/main/java/net/pterodactylus/sone/data/impl/DefaultAlbum.java b/src/main/java/net/pterodactylus/sone/data/impl/DefaultAlbum.java index 0006dc4..295555d 100644 --- a/src/main/java/net/pterodactylus/sone/data/impl/DefaultAlbum.java +++ b/src/main/java/net/pterodactylus/sone/data/impl/DefaultAlbum.java @@ -39,13 +39,11 @@ public class DefaultAlbum extends AbstractAlbum { private final Database database; private final Sone sone; /* TODO - only store sone ID. */ - private final String parentId; protected DefaultAlbum(Database database, String id, Sone sone, String parentId) { - super(id); + super(id, parentId); this.database = database; this.sone = sone; - this.parentId = parentId; } @Override