From e4ea8adf94edc8df204ccd8c796feea186162ad3 Mon Sep 17 00:00:00 2001 From: North Date: Tue, 2 Jul 2013 00:32:25 +0300 Subject: [PATCH] added method for updating expansions database --- Mage.Common/src/mage/interfaces/MageServer.java | 4 ++++ .../main/java/mage/server/MageServerImpl.java | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Mage.Common/src/mage/interfaces/MageServer.java b/Mage.Common/src/mage/interfaces/MageServer.java index 3944a38167..58551a4368 100644 --- a/Mage.Common/src/mage/interfaces/MageServer.java +++ b/Mage.Common/src/mage/interfaces/MageServer.java @@ -30,6 +30,7 @@ package mage.interfaces; import mage.MageException; import mage.cards.decks.DeckCardLists; +import mage.cards.repository.ExpansionInfo; import mage.game.GameException; import mage.game.match.MatchOptions; import mage.game.tournament.TournamentOptions; @@ -50,6 +51,9 @@ public interface MageServer { boolean registerAdmin(String password, String sessionId, MageVersion version) throws MageException; void deregisterClient(String sessionId) throws MageException; + // update methods + List getMissingExpansionData(List codes); + // user methods boolean setUserData(String userName, String sessionId, UserDataView userDataView) throws MageException; void sendFeedbackMessage(String sessionId, String username, String title, String type, String message, String email) throws MageException; diff --git a/Mage.Server/src/main/java/mage/server/MageServerImpl.java b/Mage.Server/src/main/java/mage/server/MageServerImpl.java index 6f2ef6c808..216ae8c889 100644 --- a/Mage.Server/src/main/java/mage/server/MageServerImpl.java +++ b/Mage.Server/src/main/java/mage/server/MageServerImpl.java @@ -30,6 +30,8 @@ package mage.server; import mage.MageException; import mage.cards.decks.DeckCardLists; +import mage.cards.repository.ExpansionInfo; +import mage.cards.repository.ExpansionRepository; import mage.game.GameException; import mage.game.match.MatchOptions; import mage.game.tournament.TournamentOptions; @@ -59,9 +61,6 @@ import java.util.Locale; import java.util.UUID; import java.util.concurrent.ExecutorService; - -//import mage.interfaces.Server; - /** * * @author BetaSteward_at_googlemail.com, noxx @@ -914,4 +913,15 @@ public class MageServerImpl implements MageServer { } return action.negativeResult(); } + + @Override + public List getMissingExpansionData(List codes) { + List result = new ArrayList(); + for (ExpansionInfo expansionInfo : ExpansionRepository.instance.getAll()) { + if (!codes.contains(expansionInfo.getCode())) { + result .add(expansionInfo); + } + } + return result; + } }