public class AccountResolver extends Object
Modifier and Type | Method and Description |
---|---|
Account |
find(String input)
Locate exactly one account matching the input string.
|
Set<Account.Id> |
findAll(String input)
Find all accounts matching the input string.
|
Set<Account.Id> |
findAllByNameOrEmail(String nameOrEmail)
Locate exactly one account matching the name or name/email string.
|
Account |
findByNameOrEmail(String nameOrEmail)
Locate exactly one account matching the name or name/email string.
|
IdentifiedUser |
parse(String id)
Parses a account ID from a request body and returns the user.
|
IdentifiedUser |
parseId(String id)
Parses an account ID and returns the user without making any permission check whether the
current user can see the account.
|
IdentifiedUser |
parseOnBehalfOf(CurrentUser caller,
String id)
Like
parse(String) , but also sets the CurrentUser.getRealUser() on the result. |
public Account find(String input) throws com.google.gwtorm.server.OrmException, IOException, org.eclipse.jgit.errors.ConfigInvalidException
input
- a string of the format "Full Name <email@example>", just the email address
("email@example"), a full name ("Full Name"), an account ID ("18419") or a user name
("username").input
is a numeric string, returns an account if and only if that
number corresponds to an actual account ID.com.google.gwtorm.server.OrmException
IOException
org.eclipse.jgit.errors.ConfigInvalidException
public Set<Account.Id> findAll(String input) throws com.google.gwtorm.server.OrmException, IOException, org.eclipse.jgit.errors.ConfigInvalidException
input
- a string of the format "Full Name <email@example>", just the email address
("email@example"), a full name ("Full Name"), an account ID ("18419") or a user name
("username").input
is a numeric
string, returns a singleton set if that number corresponds to a real account ID, and an
empty set otherwise if it does not.com.google.gwtorm.server.OrmException
IOException
org.eclipse.jgit.errors.ConfigInvalidException
public Account findByNameOrEmail(String nameOrEmail) throws com.google.gwtorm.server.OrmException, IOException
nameOrEmail
- a string of the format "Full Name <email@example>", just the email
address ("email@example"), a full name ("Full Name").com.google.gwtorm.server.OrmException
IOException
public Set<Account.Id> findAllByNameOrEmail(String nameOrEmail) throws com.google.gwtorm.server.OrmException, IOException
nameOrEmail
- a string of the format "Full Name <email@example>", just the email
address ("email@example"), a full name ("Full Name").com.google.gwtorm.server.OrmException
IOException
public IdentifiedUser parse(String id) throws AuthException, UnprocessableEntityException, com.google.gwtorm.server.OrmException, IOException, org.eclipse.jgit.errors.ConfigInvalidException
id
- ID of the account, can be a string of the format "Full Name
<[email protected]>
", just the email address, a full name if it is unique, an account ID,
a user name or "self
" for the calling userUnprocessableEntityException
- thrown if the account ID cannot be resolved or if the
account is not visible to the calling userAuthException
com.google.gwtorm.server.OrmException
IOException
org.eclipse.jgit.errors.ConfigInvalidException
public IdentifiedUser parseId(String id) throws AuthException, com.google.gwtorm.server.OrmException, IOException, org.eclipse.jgit.errors.ConfigInvalidException
id
- ID of the account, can be a string of the format "Full Name
<[email protected]>
", just the email address, a full name if it is unique, an account ID,
a user name or "self
" for the calling userAuthException
- thrown if 'self' is used as account ID and the current user is not
authenticatedcom.google.gwtorm.server.OrmException
org.eclipse.jgit.errors.ConfigInvalidException
IOException
public IdentifiedUser parseOnBehalfOf(CurrentUser caller, String id) throws AuthException, UnprocessableEntityException, com.google.gwtorm.server.OrmException, IOException, org.eclipse.jgit.errors.ConfigInvalidException
parse(String)
, but also sets the CurrentUser.getRealUser()
on the result.AuthException
UnprocessableEntityException
com.google.gwtorm.server.OrmException
IOException
org.eclipse.jgit.errors.ConfigInvalidException