Class ProjectsCollection
- java.lang.Object
-
- com.google.gerrit.server.restapi.project.ProjectsCollection
-
- All Implemented Interfaces:
NeedsParams
,RestCollection<TopLevelResource,ProjectResource>
public class ProjectsCollection extends Object implements RestCollection<TopLevelResource,ProjectResource>, NeedsParams
-
-
Constructor Summary
Constructors Constructor Description ProjectsCollection(DynamicMap<RestView<ProjectResource>> views, com.google.inject.Provider<ListProjects> list, com.google.inject.Provider<QueryProjects> queryProjects, ProjectCache projectCache, PermissionBackend permissionBackend, com.google.inject.Provider<CurrentUser> user)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RestView<TopLevelResource>
list()
Create a view to list the contents of the collection.ProjectResource
parse(TopLevelResource parent, IdString id)
Parse a path component into a resource handle.ProjectResource
parse(String id)
Parses a project ID from a request body and returns the project.ProjectResource
parse(String id, boolean checkAccess)
Parses a project ID from a request body and returns the project.void
setParams(com.google.common.collect.ListMultimap<String,String> params)
Sets the request parameter.DynamicMap<RestView<ProjectResource>>
views()
Get the views that support this collection.
-
-
-
Constructor Detail
-
ProjectsCollection
@Inject public ProjectsCollection(DynamicMap<RestView<ProjectResource>> views, com.google.inject.Provider<ListProjects> list, com.google.inject.Provider<QueryProjects> queryProjects, ProjectCache projectCache, PermissionBackend permissionBackend, com.google.inject.Provider<CurrentUser> user)
-
-
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()
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,ProjectResource>
- Returns:
- view to list the collection.
-
parse
public ProjectResource parse(TopLevelResource parent, IdString id) throws RestApiException, IOException, PermissionBackendException
Description copied from interface:RestCollection
Parse a path component into a resource handle.- Specified by:
parse
in interfaceRestCollection<TopLevelResource,ProjectResource>
- 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.RestApiException
IOException
PermissionBackendException
-
parse
public ProjectResource parse(String id) throws RestApiException, IOException, PermissionBackendException
Parses a project ID from a request body and returns the project.- Parameters:
id
- ID of the project, can be a project name- Returns:
- the project
- Throws:
RestApiException
- thrown if the project ID cannot be resolved or if the project is not visible to the calling userIOException
- thrown when there is an error.PermissionBackendException
-
parse
public ProjectResource parse(String id, boolean checkAccess) throws RestApiException, IOException, PermissionBackendException
Parses a project ID from a request body and returns the project.- Parameters:
id
- ID of the project, can be a project namecheckAccess
- if true, check the project is accessible by the current user- Returns:
- the project
- Throws:
RestApiException
- thrown if the project ID cannot be resolved or if the project is not visible to the calling user and checkVisibility is true.IOException
- thrown when there is an error.PermissionBackendException
-
views
public DynamicMap<RestView<ProjectResource>> 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,ProjectResource>
- Returns:
- map of views.
-
-