public final class Account
extends java.lang.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.
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 | Constructor and Description |
---|---|
protected |
Account() |
|
Account(Account.Id newId,
java.sql.Timestamp registeredOn)
Create a new account.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getFullName()
Get the full name of the user ("Given-name Surname" style).
|
Account.Id |
getId()
Get local id of this account, to link with in other entities
|
java.lang.String |
getMetaId() |
java.lang.String |
getName()
Formats an account name.
|
static java.lang.String |
getName(Account.Id accountId) |
java.lang.String |
getNameEmail(java.lang.String anonymousCowardName)
Get the name and email address.
|
java.lang.String |
getPreferredEmail()
Email address the user prefers to be contacted through.
|
java.sql.Timestamp |
getRegisteredOn()
Get the date and time the user first registered.
|
java.lang.String |
getStatus() |
int |
hashCode() |
static Account.Id |
id(int id) |
boolean |
isActive() |
void |
setActive(boolean active) |
void |
setFullName(java.lang.String name)
Set the full name of the user ("Given-name Surname" style).
|
void |
setMetaId(java.lang.String metaId) |
void |
setPreferredEmail(java.lang.String addr)
Set the email address the user prefers to be contacted through.
|
void |
setStatus(java.lang.String status) |
java.lang.String |
toString() |
protected Account()
public Account(Account.Id newId, java.sql.Timestamp registeredOn)
newId
- unique id, see Sequences.nextAccountId()
.registeredOn
- when the account was registered.public static Account.Id id(int id)
public Account.Id getId()
public java.lang.String getFullName()
public void setFullName(java.lang.String name)
public java.lang.String getPreferredEmail()
public void setPreferredEmail(java.lang.String addr)
public java.lang.String getName()
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.
public static java.lang.String getName(Account.Id accountId)
public java.lang.String getNameEmail(java.lang.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 java.sql.Timestamp getRegisteredOn()
public java.lang.String getMetaId()
public void setMetaId(java.lang.String metaId)
public boolean isActive()
public void setActive(boolean active)
public java.lang.String getStatus()
public void setStatus(java.lang.String status)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object