public class ProjectsCollection extends Object implements RestCollection<TopLevelResource,ProjectResource>, NeedsParams
| Constructor and 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) |
| Modifier and Type | Method and Description |
|---|---|
RestView<TopLevelResource> |
list()
Create a view to list the contents of the collection.
|
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.
|
ProjectResource |
parse(TopLevelResource parent,
IdString id)
Parse a path component into a resource handle.
|
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.
|
@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)
public void setParams(com.google.common.collect.ListMultimap<String,String> params) throws BadRequestException
NeedsParamssetParams in interface NeedsParamsparams - the request parameterBadRequestExceptionpublic RestView<TopLevelResource> list()
RestCollectionThe 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,ProjectResource>public ProjectResource parse(TopLevelResource parent, IdString id) throws RestApiException, IOException, PermissionBackendException
RestCollectionparse in interface RestCollection<TopLevelResource,ProjectResource>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".ResourceNotFoundException - the object does not exist, or the caller is not permitted to
know if the resource exists.RestApiExceptionIOExceptionPermissionBackendExceptionpublic ProjectResource parse(String id) throws RestApiException, IOException, PermissionBackendException
id - ID of the project, can be a project nameRestApiException - 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.PermissionBackendExceptionpublic ProjectResource parse(String id, boolean checkAccess) throws RestApiException, IOException, PermissionBackendException
id - ID of the project, can be a project namecheckAccess - if true, check the project is accessible by the current userRestApiException - 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.PermissionBackendExceptionpublic DynamicMap<RestView<ProjectResource>> views()
RestCollectionWithin a resource the views are accessed as RESOURCE/plugin~view.
views in interface RestCollection<TopLevelResource,ProjectResource>