Class 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 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,
                                        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
      • 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)