public final class Account extends Object
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):
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
Modifier and Type | Class and Description |
---|---|
static class |
Account.Id
Key local to Gerrit to identify a user.
|
Modifier and Type | Field and Description |
---|---|
protected Account.Id |
accountId |
protected String |
fullName
Full name of the user ("Given-name Surname" style).
|
protected boolean |
inactive
Is this user inactive? This is used to avoid showing some users (eg.
|
protected String |
preferredEmail
Email address the user prefers to be contacted through.
|
protected Timestamp |
registeredOn
Date and time the user registered with the review server.
|
protected String |
status
The user-settable status of this account (e.g.
|
static String |
USER_NAME_PATTERN
Regular expression that
userName must match. |
static String |
USER_NAME_PATTERN_FIRST |
static String |
USER_NAME_PATTERN_LAST |
static String |
USER_NAME_PATTERN_REST |
protected String |
userName
computed the username selected from the identities.
|
Modifier | Constructor and Description |
---|---|
protected |
Account() |
|
Account(Account.Id newId,
Timestamp registeredOn)
Create a new account.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
String |
getFullName()
Get the full name of the user ("Given-name Surname" style).
|
GeneralPreferencesInfo |
getGeneralPreferencesInfo() |
Account.Id |
getId()
Get local id of this account, to link with in other entities
|
String |
getName(String anonymousCowardName)
Formats an account name.
|
String |
getNameEmail(String anonymousCowardName)
Get the name and email address.
|
String |
getPreferredEmail()
Email address the user prefers to be contacted through.
|
Timestamp |
getRegisteredOn()
Get the date and time the user first registered.
|
String |
getStatus() |
String |
getUserName() |
int |
hashCode() |
boolean |
isActive() |
void |
setActive(boolean active) |
void |
setFullName(String name)
Set the full name of the user ("Given-name Surname" style).
|
void |
setGeneralPreferences(GeneralPreferencesInfo p) |
void |
setPreferredEmail(String addr)
Set the email address the user prefers to be contacted through.
|
void |
setStatus(String status) |
void |
setUserName(String userName)
Update the computed user name property.
|
public static final String USER_NAME_PATTERN_FIRST
public static final String USER_NAME_PATTERN_REST
public static final String USER_NAME_PATTERN_LAST
public static final String USER_NAME_PATTERN
userName
must match.protected Account.Id accountId
protected Timestamp registeredOn
protected String fullName
protected String preferredEmail
protected boolean inactive
protected String status
protected String userName
protected Account()
public Account(Account.Id newId, Timestamp registeredOn)
newId
- unique id, see ReviewDb.nextAccountId()
.registeredOn
- when the account was registered.public Account.Id getId()
public String getFullName()
public void setFullName(String name)
public String getPreferredEmail()
public void setPreferredEmail(String addr)
public String getName(String anonymousCowardName)
If the account has a full name, it returns only the full name. Otherwise it returns a longer form that includes the email address.
public String getNameEmail(String anonymousCowardName)
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
public Timestamp getRegisteredOn()
public GeneralPreferencesInfo getGeneralPreferencesInfo()
public void setGeneralPreferences(GeneralPreferencesInfo p)
public boolean isActive()
public void setActive(boolean active)
public String getStatus()
public void setStatus(String status)
public String getUserName()
public void setUserName(String userName)