AccountCacheImpl#ByNameLoader: Use account index to lookup usernames

If available, use the account index to find accounts by username. This
is a preparation for moving the external ids from ReviewDb into git.

Change-Id: I8fe3adc0a65e90e3e7a21641cfca7352c46a458f
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2016-07-20 11:48:23 +02:00
parent 05fa4e317f
commit 0ef591315b
3 changed files with 42 additions and 10 deletions

View File

@@ -294,12 +294,7 @@ public class PostGpgKeys implements RestModifyView<AccountResource, Input> {
msg.append("GPG key ").append(externalId)
.append(" associated with multiple accounts: ");
Joiner.on(", ").appendTo(msg,
Lists.transform(accountStates, new Function<AccountState, String>() {
@Override
public String apply(AccountState accountState) {
return accountState.getAccount().getId().toString();
}
}));
Lists.transform(accountStates, AccountState.ACCOUNT_ID_FUNCTION));
log.error(msg.toString());
throw new IllegalStateException(msg.toString());
}