public class AccountState extends 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,
Set<AccountGroup.UUID> actualGroups,
Collection<ExternalId> externalIds,
Map<WatchConfig.ProjectWatchKey,Set<WatchConfig.NotifyType>> projectWatches) |
Modifier and Type | Method and Description |
---|---|
boolean |
checkPassword(String password,
String username) |
<T> T |
get(CurrentUser.PropertyKey<T> key)
Lookup a previously stored property.
|
Account |
getAccount()
Get the cached account metadata.
|
static Set<String> |
getEmails(Collection<ExternalId> ids) |
Collection<ExternalId> |
getExternalIds()
The external identities that identify the account holder.
|
Set<AccountGroup.UUID> |
getInternalGroups()
The set of groups maintained directly within the Gerrit database.
|
Map<WatchConfig.ProjectWatchKey,Set<WatchConfig.NotifyType>> |
getProjectWatches()
The project watches of the account.
|
String |
getUserName()
Get the username, if one has been declared for this user.
|
static String |
getUserName(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, Set<AccountGroup.UUID> actualGroups, Collection<ExternalId> externalIds, Map<WatchConfig.ProjectWatchKey,Set<WatchConfig.NotifyType>> projectWatches)
public Account getAccount()
public String getUserName()
The username is the ExternalId
using the scheme ExternalId.SCHEME_USERNAME
.
public Collection<ExternalId> getExternalIds()
public Map<WatchConfig.ProjectWatchKey,Set<WatchConfig.NotifyType>> getProjectWatches()
public Set<AccountGroup.UUID> getInternalGroups()
public static String getUserName(Collection<ExternalId> ids)
public static Set<String> getEmails(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.