From e13a779a8c3958c1f9fdd79f6d1dc22a44ac3b84 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 22 Oct 2013 08:10:20 +0200 Subject: [PATCH] Store parent album ID in abstract album. --- src/main/java/net/pterodactylus/sone/data/impl/AbstractAlbum.java | 6 ++++-- src/main/java/net/pterodactylus/sone/data/impl/DefaultAlbum.java | 4 +--- 2 files changed, 5 insertions(+), 5 deletions(-) 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 -- 2.7.4