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 booleancanRead(ProjectState state, org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevCommit commit)booleancanRead(ProjectState state, org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevCommit commit, org.eclipse.jgit.lib.Ref ref)RestView<ProjectResource>list()Create a view to list the contents of the collection.CommitResourceparse(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:RestCollectionCreate 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:
listin 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:RestCollectionParse a path component into a resource handle.- Specified by:
parsein interfaceRestCollection<ProjectResource,CommitResource>- Parameters:
parent- the handle to the collection.id- string identifier supplied by the client. In a URL such as/changes/1234/abandonthis 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.RestApiExceptionIOException
-
views
public DynamicMap<RestView<CommitResource>> views()
Description copied from interface:RestCollectionGet the views that support this collection.Within a resource the views are accessed as
RESOURCE/plugin~view.- Specified by:
viewsin 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 if
commitis visible to the caller andcommitis 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 if
commitis visible to the caller. - Throws:
IOException
-
-