From 3049b7e396ce20b5b6600ae2791334a6babb414e Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 3 Dec 2014 06:23:44 +0100 Subject: [PATCH] Use local Sone for loading the Sone in the database. --- .../net/pterodactylus/sone/database/LocalSoneDatabase.java | 2 +- .../net/pterodactylus/sone/database/memory/MemoryDatabase.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/database/LocalSoneDatabase.java b/src/main/java/net/pterodactylus/sone/database/LocalSoneDatabase.java index 036c607..0240080 100644 --- a/src/main/java/net/pterodactylus/sone/database/LocalSoneDatabase.java +++ b/src/main/java/net/pterodactylus/sone/database/LocalSoneDatabase.java @@ -14,7 +14,7 @@ import com.google.common.base.Optional; public interface LocalSoneDatabase { Optional getLocalSone(String localSoneId); - Sone registerLocalSone(OwnIdentity ownIdentity); + LocalSone registerLocalSone(OwnIdentity ownIdentity); String getLastInsertFingerprint(Sone sone); void setLastInsertFingerprint(Sone sone, String lastInsertFingerprint); diff --git a/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java b/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java index 128a4bd..7ad40e0 100644 --- a/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java +++ b/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java @@ -173,14 +173,14 @@ public class MemoryDatabase extends AbstractService implements Database { } @Override - public Sone registerLocalSone(OwnIdentity ownIdentity) { - final Sone localSone = loadLocalSone(ownIdentity); + public LocalSone registerLocalSone(OwnIdentity ownIdentity) { + final LocalSone localSone = loadLocalSone(ownIdentity); localSones.add(ownIdentity.getId()); return localSone; } - private Sone loadLocalSone(OwnIdentity ownIdentity) { - Sone localSone = newSoneBuilder().local().from(ownIdentity).build(); + private LocalSone loadLocalSone(OwnIdentity ownIdentity) { + LocalSone localSone = (LocalSone) newSoneBuilder().local().from(ownIdentity).build(); localSone.setLatestEdition( Optional.fromNullable( Longs.tryParse(ownIdentity.getProperty(LATEST_EDITION_PROPERTY))) @@ -192,7 +192,7 @@ public class MemoryDatabase extends AbstractService implements Database { return localSone; } - public void loadSone(Sone sone) { + public void loadSone(LocalSone sone) { long soneTime = configurationLoader.getLocalSoneTime(sone.getId()); if (soneTime == -1) { return; -- 2.7.4