Class BitbucketApiServiceImpl
- java.lang.Object
-
- com.atlassian.bamboo.plugins.bitbucket.impl.BitbucketApiServiceImpl
-
- All Implemented Interfaces:
BitbucketApiService,org.springframework.beans.factory.DisposableBean
public class BitbucketApiServiceImpl extends Object implements BitbucketApiService, org.springframework.beans.factory.DisposableBean
-
-
Constructor Summary
Constructors Constructor Description BitbucketApiServiceImpl(com.atlassian.sal.api.message.I18nResolver i18nResolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeleteComment(String username, String password, String repositorySlug, String commitId, String commentId)Delete commit comment.voiddestroy()@NotNull BitbucketPageEntity<BitbucketNodeEntity>findBranches(@NotNull String owner, @NotNull String slug, @NotNull String username, @Nullable String password, @Nullable String queryString, int start, int limit)@NotNull BitbucketPageEntity<BitbucketResourceEntity>findPublicRepositories(@NotNull String username, @Nullable String queryString, int start, int limit)Return a filtered list of public repositories that user has access to.@NotNull BitbucketPageEntity<BitbucketResourceEntity>findRepositories(@NotNull String username, @NotNull String password, @Nullable String queryString, int start, int limit)Return a filtered list of accessible to Bitbucket user.@NotNull BitbucketNodeEntitygetBranch(@NotNull String owner, @NotNull String slug, @NotNull String branch, String username, String password)Returns a branch of a repository if it exists, throws exception (404) if not.@NotNull List<BitbucketNodeEntity>getBranches(@NotNull String owner, @NotNull String slug, @NotNull String username, @Nullable String password)JAXB binding cannot be used in this method as Bitbucket returns JSON with node names containing characters which cannot be used as XML element names.List<String>getCommentIds(String username, String password, String repositorySlug, String commitId)Fetch comment ids by commit id.List<String>getCommits(String username, String password, String repositorySlug, int limit)Fetch repository commits.@NotNull BitbucketNodeEntitygetDefaultBranch(@NotNull String owner, @NotNull String slug, @Nullable String username, @Nullable String password)Fetch default branch of a repository.@NotNull List<BitbucketResourceEntity>getPublicRepositories(@NotNull String username)Return a list of all public repositories that user has access to.@NotNull List<BitbucketResourceEntity>getPublicRepositories(@NotNull String username, @Nullable String queryString)Return a list of all public repositories that user has access to.@NotNull List<BitbucketResourceEntity>getRepositories(@NotNull String username, @NotNull String password)Retrieve list of all repositories accessible to Bitbucket user@NotNull List<BitbucketResourceEntity>getRepositories(@NotNull String username, @NotNull String password, @Nullable String queryString)Retrieve list of all repositories accessible to Bitbucket user@NotNull BitbucketResourceEntitygetRepository(@NotNull String owner, @NotNull String slug, @Nullable String username, @Nullable String password)Retrieve data about single Bitbucket repository.@Nullable StringgetUuidForWorkspaceOrUsername(@NotNull String identifier, @Nullable String secret)Fetch UUID for given identifier.voidupdateBuildStatus(@NotNull String owner, @NotNull String slug, @NotNull String revision, @NotNull RestBuildStatus buildStatus, @NotNull String username, @NotNull String password)Send build status update to Bitbucket server
-
-
-
Method Detail
-
destroy
public void destroy()
- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean
-
findPublicRepositories
@NotNull public @NotNull BitbucketPageEntity<BitbucketResourceEntity> findPublicRepositories(@NotNull @NotNull String username, @Nullable @Nullable String queryString, int start, int limit) throws BitbucketApiException
Description copied from interface:BitbucketApiServiceReturn a filtered list of public repositories that user has access to. The length of the list is limited.- Specified by:
findPublicRepositoriesin interfaceBitbucketApiService- Throws:
BitbucketApiException
-
getPublicRepositories
@NotNull public @NotNull List<BitbucketResourceEntity> getPublicRepositories(@NotNull @NotNull String username, @Nullable @Nullable String queryString) throws BitbucketApiException
Description copied from interface:BitbucketApiServiceReturn a list of all public repositories that user has access to.- Specified by:
getPublicRepositoriesin interfaceBitbucketApiService- Throws:
BitbucketApiException
-
getPublicRepositories
@NotNull public @NotNull List<BitbucketResourceEntity> getPublicRepositories(@NotNull @NotNull String username) throws BitbucketApiException
Description copied from interface:BitbucketApiServiceReturn a list of all public repositories that user has access to.- Specified by:
getPublicRepositoriesin interfaceBitbucketApiService- Throws:
BitbucketApiException
-
findRepositories
@NotNull public @NotNull BitbucketPageEntity<BitbucketResourceEntity> findRepositories(@NotNull @NotNull String username, @NotNull @NotNull String password, @Nullable @Nullable String queryString, int start, int limit) throws BitbucketApiException
Description copied from interface:BitbucketApiServiceReturn a filtered list of accessible to Bitbucket user. The length of the list is limited.- Specified by:
findRepositoriesin interfaceBitbucketApiService- Throws:
BitbucketApiException
-
getRepositories
@NotNull public @NotNull List<BitbucketResourceEntity> getRepositories(@NotNull @NotNull String username, @NotNull @NotNull String password) throws BitbucketApiException
Description copied from interface:BitbucketApiServiceRetrieve list of all repositories accessible to Bitbucket user- Specified by:
getRepositoriesin interfaceBitbucketApiService- Returns:
- Throws:
BitbucketApiException
-
getRepositories
@NotNull public @NotNull List<BitbucketResourceEntity> getRepositories(@NotNull @NotNull String username, @NotNull @NotNull String password, @Nullable @Nullable String queryString) throws BitbucketApiException
Description copied from interface:BitbucketApiServiceRetrieve list of all repositories accessible to Bitbucket user- Specified by:
getRepositoriesin interfaceBitbucketApiService- Throws:
BitbucketApiException
-
findBranches
@NotNull public @NotNull BitbucketPageEntity<BitbucketNodeEntity> findBranches(@NotNull @NotNull String owner, @NotNull @NotNull String slug, @NotNull @NotNull String username, @Nullable @Nullable String password, @Nullable @Nullable String queryString, int start, int limit) throws BitbucketApiException
- Specified by:
findBranchesin interfaceBitbucketApiService- Throws:
BitbucketApiException
-
getBranches
@NotNull public @NotNull List<BitbucketNodeEntity> getBranches(@NotNull @NotNull String owner, @NotNull @NotNull String slug, @NotNull @NotNull String username, @Nullable @Nullable String password) throws BitbucketApiException
JAXB binding cannot be used in this method as Bitbucket returns JSON with node names containing characters which cannot be used as XML element names. Internals of JAXB - JSON parsing use XML DOM as intermediate format so it obviously fails.- Specified by:
getBranchesin interfaceBitbucketApiService- Parameters:
owner-slug-username-password-- Returns:
- Throws:
BitbucketApiException
-
getBranch
@NotNull public @NotNull BitbucketNodeEntity getBranch(@NotNull @NotNull String owner, @NotNull @NotNull String slug, @NotNull @NotNull String branch, String username, String password) throws BitbucketApiException
Description copied from interface:BitbucketApiServiceReturns a branch of a repository if it exists, throws exception (404) if not.- Specified by:
getBranchin interfaceBitbucketApiService- Throws:
BitbucketApiException
-
getRepository
@NotNull public @NotNull BitbucketResourceEntity getRepository(@NotNull @NotNull String owner, @NotNull @NotNull String slug, @Nullable @Nullable String username, @Nullable @Nullable String password) throws BitbucketApiException
Description copied from interface:BitbucketApiServiceRetrieve data about single Bitbucket repository.- Specified by:
getRepositoryin interfaceBitbucketApiService- Throws:
BitbucketApiException
-
getDefaultBranch
@NotNull public @NotNull BitbucketNodeEntity getDefaultBranch(@NotNull @NotNull String owner, @NotNull @NotNull String slug, @Nullable @Nullable String username, @Nullable @Nullable String password) throws BitbucketApiException
Description copied from interface:BitbucketApiServiceFetch default branch of a repository.- Specified by:
getDefaultBranchin interfaceBitbucketApiService- Throws:
BitbucketApiException
-
getUuidForWorkspaceOrUsername
@Nullable public @Nullable String getUuidForWorkspaceOrUsername(@NotNull @NotNull String identifier, @Nullable @Nullable String secret)
Description copied from interface:BitbucketApiServiceFetch UUID for given identifier.- Specified by:
getUuidForWorkspaceOrUsernamein interfaceBitbucketApiService- Parameters:
identifier- workspace or username or UUIDsecret- the password of the uuid account- Returns:
- uuid
-
getCommits
public List<String> getCommits(String username, String password, String repositorySlug, int limit) throws BitbucketApiException, com.opensymphony.webwork.dispatcher.json.JSONException
Description copied from interface:BitbucketApiServiceFetch repository commits.- Specified by:
getCommitsin interfaceBitbucketApiService- Throws:
BitbucketApiExceptioncom.opensymphony.webwork.dispatcher.json.JSONException
-
getCommentIds
public List<String> getCommentIds(String username, String password, String repositorySlug, String commitId) throws BitbucketApiException, com.opensymphony.webwork.dispatcher.json.JSONException
Description copied from interface:BitbucketApiServiceFetch comment ids by commit id.- Specified by:
getCommentIdsin interfaceBitbucketApiService- Throws:
BitbucketApiExceptioncom.opensymphony.webwork.dispatcher.json.JSONException
-
deleteComment
public void deleteComment(String username, String password, String repositorySlug, String commitId, String commentId)
Description copied from interface:BitbucketApiServiceDelete commit comment.- Specified by:
deleteCommentin interfaceBitbucketApiService
-
updateBuildStatus
public void updateBuildStatus(@NotNull @NotNull String owner, @NotNull @NotNull String slug, @NotNull @NotNull String revision, @NotNull @NotNull RestBuildStatus buildStatus, @NotNull @NotNull String username, @NotNull @NotNull String password) throws BitbucketApiExceptionDescription copied from interface:BitbucketApiServiceSend build status update to Bitbucket server- Specified by:
updateBuildStatusin interfaceBitbucketApiService- Parameters:
owner- repository ownerslug- repository slugrevision- changeset revisionbuildStatus- payload to be sent to Bitbucketusername- credentials used to authenticate against Bitbucketpassword- credentials used to authenticate against Bitbucket- Throws:
BitbucketApiException
-
-