Class CommitsCollection
- java.lang.Object
-
- com.google.gerrit.server.restapi.project.CommitsCollection
-
- All Implemented Interfaces:
ChildCollection<ProjectResource,CommitResource>
,RestCollection<ProjectResource,CommitResource>
,RestView<ProjectResource>
public class CommitsCollection extends Object implements ChildCollection<ProjectResource,CommitResource>
The collection of commit IDs (ie. 40 char hex IDs)
-
-
Constructor Summary
Constructors Constructor Description CommitsCollection(DynamicMap<RestView<CommitResource>> views, GitRepositoryManager repoManager, RetryHelper retryHelper, ChangeIndexCollection indexes, Reachable reachable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canRead(ProjectState state, org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevCommit commit)
Returns true ifcommit
is visible to the caller.boolean
canRead(ProjectState state, org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevCommit commit, org.eclipse.jgit.lib.Ref ref)
Returns true ifcommit
is visible to the caller andcommit
is reachable from the given branch.RestView<ProjectResource>
list()
Create a view to list the contents of the collection.CommitResource
parse(ProjectResource parent, IdString id)
Parse a path component into a resource handle.DynamicMap<RestView<CommitResource>>
views()
Get the views that support this collection.
-
-
-
Constructor Detail
-
CommitsCollection
@Inject public CommitsCollection(DynamicMap<RestView<CommitResource>> views, GitRepositoryManager repoManager, RetryHelper retryHelper, ChangeIndexCollection indexes, Reachable reachable)
-
-
Method Detail
-
list
public RestView<ProjectResource> 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<ProjectResource,CommitResource>
- Returns:
- view to list the collection.
- Throws:
ResourceNotFoundException
- if the collection doesn't support listing.
-
parse
public CommitResource parse(ProjectResource parent, IdString id) throws RestApiException, IOException
Description copied from interface:RestCollection
Parse a path component into a resource handle.- Specified by:
parse
in interfaceRestCollection<ProjectResource,CommitResource>
- 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
-
views
public DynamicMap<RestView<CommitResource>> 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<ProjectResource,CommitResource>
- Returns:
- map of views.
-
canRead
public boolean canRead(ProjectState state, org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevCommit commit, org.eclipse.jgit.lib.Ref ref)
Returns true ifcommit
is visible to the caller andcommit
is reachable from the given branch.
-
canRead
public boolean canRead(ProjectState state, org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevCommit commit) throws IOException
Returns true ifcommit
is visible to the caller.- Throws:
IOException
-
-