Package com.google.gerrit.server.account
Class AccountState
- java.lang.Object
-
- com.google.gerrit.server.account.AccountState
-
public class AccountState extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static com.google.common.base.Function<AccountState,Account.Id>
ACCOUNT_ID_FUNCTION
-
Constructor Summary
Constructors Constructor Description AccountState(AllUsersName allUsersName, Account account, Collection<ExternalId> externalIds, Map<WatchConfig.ProjectWatchKey,Set<WatchConfig.NotifyType>> projectWatches)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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.AllUsersName
getAllUsersNameForIndexing()
static Set<String>
getEmails(Collection<ExternalId> ids)
Collection<ExternalId>
getExternalIds()
The external identities that identify the account holder.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.
-
-
-
Field Detail
-
ACCOUNT_ID_FUNCTION
public static final com.google.common.base.Function<AccountState,Account.Id> ACCOUNT_ID_FUNCTION
-
-
Constructor Detail
-
AccountState
public AccountState(AllUsersName allUsersName, Account account, Collection<ExternalId> externalIds, Map<WatchConfig.ProjectWatchKey,Set<WatchConfig.NotifyType>> projectWatches)
-
-
Method Detail
-
getAllUsersNameForIndexing
public AllUsersName getAllUsersNameForIndexing()
-
getAccount
public Account getAccount()
Get the cached account metadata.
-
getUserName
public String getUserName()
Get the username, if one has been declared for this user.The username is the
ExternalId
using the schemeExternalId.SCHEME_USERNAME
.
-
getExternalIds
public Collection<ExternalId> getExternalIds()
The external identities that identify the account holder.
-
getProjectWatches
public Map<WatchConfig.ProjectWatchKey,Set<WatchConfig.NotifyType>> getProjectWatches()
The project watches of the account.
-
getUserName
public static String getUserName(Collection<ExternalId> ids)
-
getEmails
public static Set<String> getEmails(Collection<ExternalId> ids)
-
get
public <T> T get(CurrentUser.PropertyKey<T> key)
Lookup a previously stored property.All properties are automatically cleared when the account cache invalidates the
AccountState
. This method is thread-safe.- Parameters:
key
- unique property key.- Returns:
- previously stored value, or
null
.
-
put
public <T> void put(CurrentUser.PropertyKey<T> key, T value)
Store a property for later retrieval.This method is thread-safe.
- Parameters:
key
- unique property key.value
- value to store; ornull
to clear the value.
-
-