Interface RepositorySupplier
- All Known Subinterfaces:
RepositoryService
public interface RepositorySupplier
Allows retrieving
repositories by their ID or
project and slug.
This is a simplification of the RepositoryService, intended to be used in cases where a component needs to
be able to look up repositories but doesn't need the full service functionality. Using this interface instead makes
such components easier to test.
Plugin developers: Plugins cannot autowire their components when importing both RepositorySupplier and
RepositoryService. In general, if a plugin needs RepositoryService methods, it should only
use the RepositoryService. This interface should be used when a plugin only needs to retrieve repositories.
-
Method Summary
Modifier and TypeMethodDescriptiongetById(int id) Retrieves aRepositoryby itsID.Retrieves aRepositoryby itsslug.
-
Method Details
-
getById
Retrieves aRepositoryby itsID.- Parameters:
id- the repository's ID- Returns:
- the request repository, or
nullif there is no repository with the specified ID - Throws:
AuthorisationException- if the current user does not have permission to access the requested repository
-
getBySlug
Retrieves aRepositoryby itsslug. Slugs are only unique within a givenProject, so theproject keyis also required.- Parameters:
projectKey- thekeyof the project to search inslug- theslugof the repository to search for- Returns:
- the repository, or
nullif no matching repository is found - Throws:
AuthorisationException- if the current user does not have permission to access the requested repositoryRepositoryMovedException- if the repository has been moved to a different project, the project key has changed or the repository slug has changed
-