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 void
deleteComment(String username, String password, String repositorySlug, String commitId, String commentId)
Delete commit comment.void
destroy()
@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 BitbucketNodeEntity
getBranch(@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 BitbucketNodeEntity
getDefaultBranch(@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 BitbucketResourceEntity
getRepository(@NotNull String owner, @NotNull String slug, @Nullable String username, @Nullable String password)
Retrieve data about single Bitbucket repository.@Nullable String
getUuidForWorkspaceOrUsername(@NotNull String identifier, @Nullable String secret)
Fetch UUID for given identifier.void
updateBuildStatus(@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:
destroy
in 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:BitbucketApiService
Return a filtered list of public repositories that user has access to. The length of the list is limited.- Specified by:
findPublicRepositories
in interfaceBitbucketApiService
- Throws:
BitbucketApiException
-
getPublicRepositories
@NotNull public @NotNull List<BitbucketResourceEntity> getPublicRepositories(@NotNull @NotNull String username, @Nullable @Nullable String queryString) throws BitbucketApiException
Description copied from interface:BitbucketApiService
Return a list of all public repositories that user has access to.- Specified by:
getPublicRepositories
in interfaceBitbucketApiService
- Throws:
BitbucketApiException
-
getPublicRepositories
@NotNull public @NotNull List<BitbucketResourceEntity> getPublicRepositories(@NotNull @NotNull String username) throws BitbucketApiException
Description copied from interface:BitbucketApiService
Return a list of all public repositories that user has access to.- Specified by:
getPublicRepositories
in 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:BitbucketApiService
Return a filtered list of accessible to Bitbucket user. The length of the list is limited.- Specified by:
findRepositories
in interfaceBitbucketApiService
- Throws:
BitbucketApiException
-
getRepositories
@NotNull public @NotNull List<BitbucketResourceEntity> getRepositories(@NotNull @NotNull String username, @NotNull @NotNull String password) throws BitbucketApiException
Description copied from interface:BitbucketApiService
Retrieve list of all repositories accessible to Bitbucket user- Specified by:
getRepositories
in 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:BitbucketApiService
Retrieve list of all repositories accessible to Bitbucket user- Specified by:
getRepositories
in 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:
findBranches
in 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:
getBranches
in 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:BitbucketApiService
Returns a branch of a repository if it exists, throws exception (404) if not.- Specified by:
getBranch
in 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:BitbucketApiService
Retrieve data about single Bitbucket repository.- Specified by:
getRepository
in 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:BitbucketApiService
Fetch default branch of a repository.- Specified by:
getDefaultBranch
in interfaceBitbucketApiService
- Throws:
BitbucketApiException
-
getUuidForWorkspaceOrUsername
@Nullable public @Nullable String getUuidForWorkspaceOrUsername(@NotNull @NotNull String identifier, @Nullable @Nullable String secret)
Description copied from interface:BitbucketApiService
Fetch UUID for given identifier.- Specified by:
getUuidForWorkspaceOrUsername
in 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:BitbucketApiService
Fetch repository commits.- Specified by:
getCommits
in interfaceBitbucketApiService
- Throws:
BitbucketApiException
com.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:BitbucketApiService
Fetch comment ids by commit id.- Specified by:
getCommentIds
in interfaceBitbucketApiService
- Throws:
BitbucketApiException
com.opensymphony.webwork.dispatcher.json.JSONException
-
deleteComment
public void deleteComment(String username, String password, String repositorySlug, String commitId, String commentId)
Description copied from interface:BitbucketApiService
Delete commit comment.- Specified by:
deleteComment
in 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 BitbucketApiException
Description copied from interface:BitbucketApiService
Send build status update to Bitbucket server- Specified by:
updateBuildStatus
in 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
-
-