From 30c38839f9f1f93d0549009daf7b7ec7f871c0f9 Mon Sep 17 00:00:00 2001 From: Nathan Curtis Date: Mon, 27 Aug 2012 14:25:22 -0700 Subject: [PATCH] Add a method for getting many external ids at once. --- .../user/depot/ExternalAuthRepository.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/com/threerings/user/depot/ExternalAuthRepository.java b/src/main/java/com/threerings/user/depot/ExternalAuthRepository.java index 1617564..05318b2 100644 --- a/src/main/java/com/threerings/user/depot/ExternalAuthRepository.java +++ b/src/main/java/com/threerings/user/depot/ExternalAuthRepository.java @@ -93,6 +93,22 @@ public class ExternalAuthRepository extends DepotRepository return ids; } + /** + * Loads a mapping of (ooouser id -> exid) for all members in the supplied list that are found + * in the database. + */ + public Map loadExternalIds (ExternalAuther auther, Collection oooIds) + { + Preconditions.checkNotNull(auther); + Map ids = Maps.newHashMap(); + for (ExternalAuthRecord exrec : from(ExternalAuthRecord.class).where( + ExternalAuthRecord.AUTHER.eq(auther), + ExternalAuthRecord.USER_ID.in(oooIds)).select()) { + ids.put(exrec.userId, exrec.externalId); + } + return ids; + } + /** * Creates a mapping for the specified user to the supplied external credentials. */