X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2Fimpl%2FDefaultSone.java;h=87ad6bf76a3a0ff5702d723babbe505cc8e7fb8f;hb=580798bbd8b962fce6a7a8559c250a8b4d65f1ed;hp=61bd5304f69e33b7f1314e41fd21f51447ba7dfa;hpb=b0b2fab321503c410c530dad259878b6c754d4d9;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/data/impl/DefaultSone.java b/src/main/java/net/pterodactylus/sone/data/impl/DefaultSone.java index 61bd530..87ad6bf 100644 --- a/src/main/java/net/pterodactylus/sone/data/impl/DefaultSone.java +++ b/src/main/java/net/pterodactylus/sone/data/impl/DefaultSone.java @@ -37,6 +37,7 @@ import net.pterodactylus.sone.data.Profile; import net.pterodactylus.sone.data.Reply; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.database.AlbumBuilder; +import net.pterodactylus.sone.database.Database; import net.pterodactylus.sone.freenet.wot.Identity; import net.pterodactylus.util.logging.Logging; @@ -55,6 +56,9 @@ public class DefaultSone implements Sone { /** The logger. */ private static final Logger logger = Logging.getLogger(DefaultSone.class); + /** The database. */ + private final Database database; + /** The ID of this Sone. */ private final String id; @@ -105,7 +109,7 @@ public class DefaultSone implements Sone { private final Set likedReplyIds = new CopyOnWriteArraySet(); /** The root album containing all albums. */ - private final DefaultAlbum rootAlbum = new DefaultAlbum(this, null); + private final Album rootAlbum; /** Sone-specific options. */ private Options options = new Options(); @@ -118,9 +122,11 @@ public class DefaultSone implements Sone { * @param local * {@code true} if the Sone is a local Sone, {@code false} otherwise */ - public DefaultSone(String id, boolean local) { + public DefaultSone(Database database, String id, boolean local) { + this.database = database; this.id = id; this.local = local; + rootAlbum = new DefaultAlbumBuilder(database, this, null).randomId().build(); } // @@ -667,7 +673,7 @@ public class DefaultSone implements Sone { @Override public AlbumBuilder newAlbumBuilder() { - return new DefaultAlbumBuilder(this, rootAlbum); + return new DefaultAlbumBuilder(database, this, rootAlbum.getId()); } //