public class AccountsCollection extends java.lang.Object implements RestCollection<TopLevelResource,AccountResource>, AcceptsCreate<TopLevelResource>
Modifier and Type | Method and 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.
|
IdentifiedUser |
parse(java.lang.String id)
Parses a account ID from a request body and returns the user.
|
AccountResource |
parse(TopLevelResource root,
IdString id)
Parse a path component into a resource handle.
|
IdentifiedUser |
parseId(java.lang.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,
java.lang.String id)
Like
parse(String) , but also sets the CurrentUser.getRealUser() on the result. |
DynamicMap<RestView<AccountResource>> |
views()
Get the views that support this collection.
|
public AccountResource parse(TopLevelResource root, IdString id) throws ResourceNotFoundException, AuthException, com.google.gwtorm.server.OrmException, java.io.IOException, org.eclipse.jgit.errors.ConfigInvalidException
RestCollection
parse
in interface RestCollection<TopLevelResource,AccountResource>
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"
.ResourceNotFoundException
- the object does not exist, or the caller is not permitted to
know if the resource exists.AuthException
com.google.gwtorm.server.OrmException
java.io.IOException
org.eclipse.jgit.errors.ConfigInvalidException
public IdentifiedUser parse(java.lang.String id) throws AuthException, UnprocessableEntityException, com.google.gwtorm.server.OrmException, java.io.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
java.io.IOException
org.eclipse.jgit.errors.ConfigInvalidException
public IdentifiedUser parseId(java.lang.String id) throws AuthException, com.google.gwtorm.server.OrmException, java.io.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
java.io.IOException
public IdentifiedUser parseOnBehalfOf(CurrentUser caller, java.lang.String id) throws AuthException, UnprocessableEntityException, com.google.gwtorm.server.OrmException, java.io.IOException, org.eclipse.jgit.errors.ConfigInvalidException
parse(String)
, but also sets the CurrentUser.getRealUser()
on the result.AuthException
UnprocessableEntityException
com.google.gwtorm.server.OrmException
java.io.IOException
org.eclipse.jgit.errors.ConfigInvalidException
public RestView<TopLevelResource> list() throws ResourceNotFoundException
RestCollection
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.
list
in interface RestCollection<TopLevelResource,AccountResource>
ResourceNotFoundException
- if the collection cannot be listed.public DynamicMap<RestView<AccountResource>> views()
RestCollection
Within a resource the views are accessed as RESOURCE/plugin~view
.
views
in interface RestCollection<TopLevelResource,AccountResource>
public CreateAccount create(TopLevelResource parent, IdString username)
AcceptsCreate
create
in interface AcceptsCreate<TopLevelResource>
parent
- parent collection handle.username
- id of the resource being created.