public class AccountState
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static com.google.common.base.Function<AccountState,Account.Id> |
ACCOUNT_ID_FUNCTION |
Constructor and Description |
---|
AccountState(Account account,
java.util.Set<AccountGroup.UUID> actualGroups,
java.util.Collection<ExternalId> externalIds,
java.util.Map<WatchConfig.ProjectWatchKey,java.util.Set<WatchConfig.NotifyType>> projectWatches) |
Modifier and Type | Method and Description |
---|---|
boolean |
checkPassword(java.lang.String password,
java.lang.String username) |
<T> T |
get(CurrentUser.PropertyKey<T> key)
Lookup a previously stored property.
|
Account |
getAccount()
Get the cached account metadata.
|
static java.util.Set<java.lang.String> |
getEmails(java.util.Collection<ExternalId> ids) |
java.util.Collection<ExternalId> |
getExternalIds()
The external identities that identify the account holder.
|
java.util.Set<AccountGroup.UUID> |
getInternalGroups()
The set of groups maintained directly within the Gerrit database.
|
java.util.Map<WatchConfig.ProjectWatchKey,java.util.Set<WatchConfig.NotifyType>> |
getProjectWatches()
The project watches of the account.
|
java.lang.String |
getUserName()
Get the username, if one has been declared for this user.
|
static java.lang.String |
getUserName(java.util.Collection<ExternalId> ids) |
<T> void |
put(CurrentUser.PropertyKey<T> key,
T value)
Store a property for later retrieval.
|
public static final com.google.common.base.Function<AccountState,Account.Id> ACCOUNT_ID_FUNCTION
public AccountState(Account account, java.util.Set<AccountGroup.UUID> actualGroups, java.util.Collection<ExternalId> externalIds, java.util.Map<WatchConfig.ProjectWatchKey,java.util.Set<WatchConfig.NotifyType>> projectWatches)
public Account getAccount()
public java.lang.String getUserName()
The username is the ExternalId
using the scheme ExternalId.SCHEME_USERNAME
.
public boolean checkPassword(java.lang.String password, java.lang.String username)
public java.util.Collection<ExternalId> getExternalIds()
public java.util.Map<WatchConfig.ProjectWatchKey,java.util.Set<WatchConfig.NotifyType>> getProjectWatches()
public java.util.Set<AccountGroup.UUID> getInternalGroups()
public static java.lang.String getUserName(java.util.Collection<ExternalId> ids)
public static java.util.Set<java.lang.String> getEmails(java.util.Collection<ExternalId> ids)
public <T> T get(CurrentUser.PropertyKey<T> key)
All properties are automatically cleared when the account cache invalidates the AccountState
. This method is thread-safe.
key
- unique property key.null
.public <T> void put(CurrentUser.PropertyKey<T> key, T value)
This method is thread-safe.
key
- unique property key.value
- value to store; or null
to clear the value.