Class ExternalIds
- java.lang.Object
-
- com.google.gerrit.server.account.externalids.ExternalIds
-
public class ExternalIds extends Object
Class to access external IDs.The external IDs are either read from NoteDb or retrieved from the cache.
-
-
Constructor Summary
Constructors Constructor Description ExternalIds(ExternalIdReader externalIdReader, com.google.gerrit.server.account.externalids.ExternalIdCache externalIdCache)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.common.collect.ImmutableSet<ExternalId>
all()
Returns all external IDs.com.google.common.collect.ImmutableSet<ExternalId>
all(org.eclipse.jgit.lib.ObjectId rev)
Returns all external IDs from the specified revision of the refs/meta/external-ids branch.com.google.common.collect.SetMultimap<Account.Id,ExternalId>
allByAccount()
Returns all external IDs by account.com.google.common.collect.SetMultimap<String,ExternalId>
allByEmail()
Returns all external IDs by email.Set<ExternalId>
byAccount(Account.Id accountId)
Returns the external IDs of the specified account.Set<ExternalId>
byAccount(Account.Id accountId, String scheme)
Returns the external IDs of the specified account that have the given scheme.Set<ExternalId>
byAccount(Account.Id accountId, String scheme, org.eclipse.jgit.lib.ObjectId rev)
Returns the external IDs of the specified account that have the given scheme.Set<ExternalId>
byAccount(Account.Id accountId, org.eclipse.jgit.lib.ObjectId rev)
Returns the external IDs of the specified account.Set<ExternalId>
byEmail(String email)
Returns the external ID with the given email.com.google.common.collect.SetMultimap<String,ExternalId>
byEmails(String... emails)
Returns the external IDs for the given emails.Optional<ExternalId>
get(ExternalId.Key key)
Returns the specified external ID.Optional<ExternalId>
get(ExternalId.Key key, org.eclipse.jgit.lib.ObjectId rev)
Returns the specified external ID from the given revision.
-
-
-
Constructor Detail
-
ExternalIds
@Inject public ExternalIds(ExternalIdReader externalIdReader, com.google.gerrit.server.account.externalids.ExternalIdCache externalIdCache)
-
-
Method Detail
-
all
public com.google.common.collect.ImmutableSet<ExternalId> all() throws IOException, org.eclipse.jgit.errors.ConfigInvalidException
Returns all external IDs.- Throws:
IOException
org.eclipse.jgit.errors.ConfigInvalidException
-
all
public com.google.common.collect.ImmutableSet<ExternalId> all(org.eclipse.jgit.lib.ObjectId rev) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException
Returns all external IDs from the specified revision of the refs/meta/external-ids branch.- Throws:
IOException
org.eclipse.jgit.errors.ConfigInvalidException
-
get
public Optional<ExternalId> get(ExternalId.Key key) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException
Returns the specified external ID.- Throws:
IOException
org.eclipse.jgit.errors.ConfigInvalidException
-
get
public Optional<ExternalId> get(ExternalId.Key key, org.eclipse.jgit.lib.ObjectId rev) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException
Returns the specified external ID from the given revision.- Throws:
IOException
org.eclipse.jgit.errors.ConfigInvalidException
-
byAccount
public Set<ExternalId> byAccount(Account.Id accountId) throws IOException
Returns the external IDs of the specified account.- Throws:
IOException
-
byAccount
public Set<ExternalId> byAccount(Account.Id accountId, String scheme) throws IOException
Returns the external IDs of the specified account that have the given scheme.- Throws:
IOException
-
byAccount
public Set<ExternalId> byAccount(Account.Id accountId, org.eclipse.jgit.lib.ObjectId rev) throws IOException
Returns the external IDs of the specified account.- Throws:
IOException
-
byAccount
public Set<ExternalId> byAccount(Account.Id accountId, String scheme, org.eclipse.jgit.lib.ObjectId rev) throws IOException
Returns the external IDs of the specified account that have the given scheme.- Throws:
IOException
-
allByAccount
public com.google.common.collect.SetMultimap<Account.Id,ExternalId> allByAccount() throws IOException
Returns all external IDs by account.- Throws:
IOException
-
byEmail
public Set<ExternalId> byEmail(String email) throws IOException
Returns the external ID with the given email.Each email should belong to a single external ID only. This means if more than one external ID is returned there is an inconsistency in the external IDs.
The external IDs are retrieved from the external ID cache. Each access to the external ID cache requires reading the SHA1 of the refs/meta/external-ids branch. If external IDs for multiple emails are needed it is more efficient to use
byEmails(String...)
as this method reads the SHA1 of the refs/meta/external-ids branch only once (and not once per email).- Throws:
IOException
- See Also:
byEmails(String...)
-
byEmails
public com.google.common.collect.SetMultimap<String,ExternalId> byEmails(String... emails) throws IOException
Returns the external IDs for the given emails.Each email should belong to a single external ID only. This means if more than one external ID for an email is returned there is an inconsistency in the external IDs.
The external IDs are retrieved from the external ID cache. Each access to the external ID cache requires reading the SHA1 of the refs/meta/external-ids branch. If external IDs for multiple emails are needed it is more efficient to use this method instead of
byEmail(String)
as this method reads the SHA1 of the refs/meta/external-ids branch only once (and not once per email).- Throws:
IOException
- See Also:
byEmail(String)
-
allByEmail
public com.google.common.collect.SetMultimap<String,ExternalId> allByEmail() throws IOException
Returns all external IDs by email.- Throws:
IOException
-
-