Package com.google.gerrit.server.account
Class AccountsCollection
- java.lang.Object
-
- com.google.gerrit.server.account.AccountsCollection
-
- All Implemented Interfaces:
AcceptsCreate<TopLevelResource>
,RestCollection<TopLevelResource,AccountResource>
public class AccountsCollection extends Object implements RestCollection<TopLevelResource,AccountResource>, AcceptsCreate<TopLevelResource>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CreateAccount
create(TopLevelResource parent, IdString username)
Handle creation of a child resource.RestView<TopLevelResource>
list()
Create a view to list the contents of the collection.AccountResource
parse(TopLevelResource root, IdString id)
Parse a path component into a resource handle.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)
Likeparse(String)
, but also sets theCurrentUser.getRealUser()
on the result.DynamicMap<RestView<AccountResource>>
views()
Get the views that support this collection.
-
-
-
Method Detail
-
parse
public AccountResource parse(TopLevelResource root, IdString id) throws ResourceNotFoundException, AuthException, com.google.gwtorm.server.OrmException, IOException, org.eclipse.jgit.errors.ConfigInvalidException
Description copied from interface:RestCollection
Parse a path component into a resource handle.- Specified by:
parse
in interfaceRestCollection<TopLevelResource,AccountResource>
- Parameters:
root
- the handle to the collection.id
- string identifier supplied by the client. In a URL such as/changes/1234/abandon
this string is"1234"
.- Returns:
- a resource handle for the identified object.
- Throws:
ResourceNotFoundException
- the object does not exist, or the caller is not permitted to know if the resource exists.AuthException
com.google.gwtorm.server.OrmException
IOException
org.eclipse.jgit.errors.ConfigInvalidException
-
parse
public IdentifiedUser parse(String id) throws AuthException, UnprocessableEntityException, com.google.gwtorm.server.OrmException, IOException, org.eclipse.jgit.errors.ConfigInvalidException
Parses a account ID from a request body and returns the user.- Parameters:
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 user- Returns:
- the user, never null.
- Throws:
UnprocessableEntityException
- 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
-
parseId
public IdentifiedUser parseId(String id) throws AuthException, com.google.gwtorm.server.OrmException, IOException, org.eclipse.jgit.errors.ConfigInvalidException
Parses an account ID and returns the user without making any permission check whether the current user can see the account.- Parameters:
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 user- Returns:
- the user, null if no user is found for the given account ID
- Throws:
AuthException
- 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
-
parseOnBehalfOf
public IdentifiedUser parseOnBehalfOf(CurrentUser caller, String id) throws AuthException, UnprocessableEntityException, com.google.gwtorm.server.OrmException, IOException, org.eclipse.jgit.errors.ConfigInvalidException
Likeparse(String)
, but also sets theCurrentUser.getRealUser()
on the result.- Throws:
AuthException
UnprocessableEntityException
com.google.gwtorm.server.OrmException
IOException
org.eclipse.jgit.errors.ConfigInvalidException
-
list
public RestView<TopLevelResource> list() throws ResourceNotFoundException
Description copied from interface:RestCollection
Create a view to list the contents of the collection.The returned view should accept the parent type to scope the search, and may want to take a "q" parameter option to narrow the results.
- Specified by:
list
in interfaceRestCollection<TopLevelResource,AccountResource>
- Returns:
- view to list the collection.
- Throws:
ResourceNotFoundException
- if the collection cannot be listed.
-
views
public DynamicMap<RestView<AccountResource>> views()
Description copied from interface:RestCollection
Get the views that support this collection.Within a resource the views are accessed as
RESOURCE/plugin~view
.- Specified by:
views
in interfaceRestCollection<TopLevelResource,AccountResource>
- Returns:
- map of views.
-
create
public CreateAccount create(TopLevelResource parent, IdString username)
Description copied from interface:AcceptsCreate
Handle creation of a child resource.- Specified by:
create
in interfaceAcceptsCreate<TopLevelResource>
- Parameters:
parent
- parent collection handle.username
- id of the resource being created.- Returns:
- a view to perform the creation. The create method must embed the id into the newly returned view object, as it will not be passed.
-
-