Class Account


  • public final class Account
    extends Object
    Information about a single user.

    A user may have multiple identities they can use to login to Gerrit (see ExternalId), but in such cases they always map back to a single Account entity.

    Entities "owned" by an Account (that is, their primary key contains the Account.Id key as part of their key structure):

    • ExternalId: OpenID identities and email addresses known to be registered to this user. Multiple records can exist when the user has more than one public identity, such as a work and a personal email address.
    • AccountGroupMember: membership of the user in a specific human managed AccountGroup. Multiple records can exist when the user is a member of more than one group.
    • AccountSshKey: user's public SSH keys, for authentication through the internal SSH daemon. One record per SSH key uploaded by the user, keys are checked in random order until a match is found.
    • DiffPreferencesInfo: user's preferences for rendering side-to-side and unified diff
    • Constructor Detail

      • Account

        protected Account()
    • Method Detail

      • getId

        public Account.Id getId()
        Get local id of this account, to link with in other entities
      • getFullName

        public String getFullName()
        Get the full name of the user ("Given-name Surname" style).
      • setFullName

        public void setFullName​(String name)
        Set the full name of the user ("Given-name Surname" style).
      • getPreferredEmail

        public String getPreferredEmail()
        Email address the user prefers to be contacted through.
      • setPreferredEmail

        public void setPreferredEmail​(String addr)
        Set the email address the user prefers to be contacted through.
      • getName

        public String getName()
        Formats an account name.

        The return value goes into NoteDb commits and audit logs, so it should not be changed.

        This method deliberately does not use Anonymous Coward because it can be changed using a gerrit.config option which is a problem for NoteDb commits that still refer to a previously defined value.

        Returns:
        the fullname, if present, otherwise the preferred email, if present, as a last resort a generic string containing the accountId.
      • getNameEmail

        public String getNameEmail​(String anonymousCowardName)
        Get the name and email address.

        Example output:

        • A U. Thor <[email protected]>: full populated
        • A U. Thor (12): missing email address
        • Anonymous Coward <[email protected]>: missing name
        • Anonymous Coward (12): missing name and email address
      • getRegisteredOn

        public Timestamp getRegisteredOn()
        Get the date and time the user first registered.
      • getMetaId

        public String getMetaId()
      • setMetaId

        public void setMetaId​(String metaId)
      • isActive

        public boolean isActive()
      • setActive

        public void setActive​(boolean active)
      • getStatus

        public String getStatus()
      • setStatus

        public void setStatus​(String status)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object