Package com.google.gerrit.server.group
Class GroupsCollection
- java.lang.Object
-
- com.google.gerrit.server.group.GroupsCollection
-
- All Implemented Interfaces:
AcceptsCreate<TopLevelResource>
,NeedsParams
,RestCollection<TopLevelResource,GroupResource>
public class GroupsCollection extends Object implements RestCollection<TopLevelResource,GroupResource>, AcceptsCreate<TopLevelResource>, NeedsParams
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CreateGroup
create(TopLevelResource root, IdString name)
Handle creation of a child resource.RestView<TopLevelResource>
list()
Create a view to list the contents of the collection.GroupResource
parse(TopLevelResource parent, IdString id)
Parse a path component into a resource handle.GroupDescription.Basic
parse(String id)
Parses a group ID from a request body and returns the group.GroupDescription.Basic
parseId(String id)
Parses a group ID and returns the group without making any permission check whether the current user can see the group.GroupDescription.Internal
parseInternal(String id)
Parses a group ID from a request body and returns the group if it is a Gerrit internal group.void
setParams(com.google.common.collect.ListMultimap<String,String> params)
Sets the request parameter.DynamicMap<RestView<GroupResource>>
views()
Get the views that support this collection.
-
-
-
Method Detail
-
setParams
public void setParams(com.google.common.collect.ListMultimap<String,String> params) throws BadRequestException
Description copied from interface:NeedsParams
Sets the request parameter.- Specified by:
setParams
in interfaceNeedsParams
- Parameters:
params
- the request parameter- Throws:
BadRequestException
-
list
public RestView<TopLevelResource> list() throws ResourceNotFoundException, AuthException
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,GroupResource>
- Returns:
- view to list the collection.
- Throws:
ResourceNotFoundException
- if the collection cannot be listed.AuthException
- if the collection requires authentication.
-
parse
public GroupResource parse(TopLevelResource parent, IdString id) throws AuthException, ResourceNotFoundException
Description copied from interface:RestCollection
Parse a path component into a resource handle.- Specified by:
parse
in interfaceRestCollection<TopLevelResource,GroupResource>
- Parameters:
parent
- 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
-
parse
public GroupDescription.Basic parse(String id) throws UnprocessableEntityException
Parses a group ID from a request body and returns the group.- Parameters:
id
- ID of the group, can be a group UUID, a group name or a legacy group ID- Returns:
- the group
- Throws:
UnprocessableEntityException
- thrown if the group ID cannot be resolved or if the group is not visible to the calling user
-
parseInternal
public GroupDescription.Internal parseInternal(String id) throws UnprocessableEntityException
Parses a group ID from a request body and returns the group if it is a Gerrit internal group.- Parameters:
id
- ID of the group, can be a group UUID, a group name or a legacy group ID- Returns:
- the group
- Throws:
UnprocessableEntityException
- thrown if the group ID cannot be resolved, if the group is not visible to the calling user or if it's an external group
-
parseId
public GroupDescription.Basic parseId(String id)
Parses a group ID and returns the group without making any permission check whether the current user can see the group.- Parameters:
id
- ID of the group, can be a group UUID, a group name or a legacy group ID- Returns:
- the group, null if no group is found for the given group ID
-
create
public CreateGroup create(TopLevelResource root, IdString name)
Description copied from interface:AcceptsCreate
Handle creation of a child resource.- Specified by:
create
in interfaceAcceptsCreate<TopLevelResource>
- Parameters:
root
- parent collection handle.name
- 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.
-
views
public DynamicMap<RestView<GroupResource>> 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,GroupResource>
- Returns:
- map of views.
-
-