PageRenderTime 47ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 1ms

/src/main/java/com/atlassian/jira/plugins/bitbucket/spi/RepositoryManager.java

https://bitbucket.org/atlassian/jira-bitbucket-connector/
Java | 132 lines | 30 code | 20 blank | 82 comment | 0 complexity | 291cefa563482203fc09501f624ca448 MD5 | raw file
  1. package com.atlassian.jira.plugins.bitbucket.spi;
  2. import java.util.List;
  3. import java.util.Set;
  4. import com.atlassian.jira.plugins.bitbucket.activeobjects.v2.IssueMapping;
  5. import com.atlassian.jira.plugins.bitbucket.api.Changeset;
  6. import com.atlassian.jira.plugins.bitbucket.api.ProgressWriter;
  7. import com.atlassian.jira.plugins.bitbucket.api.SourceControlRepository;
  8. import com.atlassian.jira.plugins.bitbucket.api.SourceControlUser;
  9. import com.atlassian.jira.plugins.bitbucket.api.SynchronizationKey;
  10. import com.atlassian.jira.plugins.bitbucket.streams.GlobalFilter;
  11. public interface RepositoryManager
  12. {
  13. /**
  14. * Mapps a repository to given project
  15. *
  16. * @param repositoryType
  17. * @param projectKey
  18. * @param repositoryUrl
  19. * @param username
  20. * @param password
  21. * @param adminUsername - used when (un)installing postcommit hook
  22. * @param adminPassword - used when (un)installing postcommit hook
  23. * @param accessToken - token for authenticating if this repository is accessed using OAuth
  24. * @return
  25. */
  26. public SourceControlRepository addRepository(String repositoryType, String projectKey, String repositoryUrl, String username,
  27. String password, String adminUsername, String adminPassword, String accessToken);
  28. /**
  29. * @param repositoryId
  30. * @return repository with given id
  31. * throws IllegalArgumentException if repository with given id is not found
  32. */
  33. public SourceControlRepository getRepository(int repositoryId);
  34. /**
  35. * @param projectKey
  36. * @return list of repositories linked with given project
  37. */
  38. public List<SourceControlRepository> getRepositories(String projectKey);
  39. /**
  40. * @param issueKey
  41. * @return list of changesets linked to the given issue
  42. */
  43. public List<Changeset> getChangesets(String issueKey);
  44. /**
  45. * Removes the repository with given id and all the issue mappings for this repository
  46. *
  47. * @param id
  48. */
  49. public void removeRepository(int id);
  50. /**
  51. * Links changeset with given issue
  52. *
  53. * @param sourceControlRepository
  54. * @param issueId
  55. * @param changeset
  56. */
  57. public void addChangeset(SourceControlRepository sourceControlRepository, String issueId, Changeset changeset);
  58. /**
  59. * @param repositoryUrl
  60. * @param username
  61. * @return the details about the user
  62. */
  63. public SourceControlUser getUser(SourceControlRepository repository, String username);
  64. /**
  65. * Returns callback function that is used for synchronisation of the repository.
  66. *
  67. * @param key
  68. * @param progress
  69. * @return
  70. */
  71. public SynchronisationOperation getSynchronisationOperation(SynchronizationKey key, ProgressWriter progress);
  72. /**
  73. * Parses the given json string into changesets
  74. *
  75. * @param repository
  76. * @param payload
  77. * @return
  78. */
  79. public List<Changeset> parsePayload(SourceControlRepository repository, String payload);
  80. /**
  81. * @param repository
  82. * @param changeset
  83. * @return the html used for rendering this changeset on the issue.
  84. */
  85. public String getHtmlForChangeset(SourceControlRepository repository, Changeset changeset);
  86. /**
  87. * Installs a postcommit service for this repository
  88. *
  89. * @param repo
  90. */
  91. public void setupPostcommitHook(SourceControlRepository repo);
  92. /**
  93. * Removes a postcommit service for this repository
  94. *
  95. * @param repo
  96. */
  97. public void removePostcommitHook(SourceControlRepository repo);
  98. /**
  99. * @return the identifier of repository type
  100. */
  101. public String getRepositoryType();
  102. /**
  103. * Find last changeset to the given count ordered by timestamp
  104. *
  105. * @param count changesets count
  106. * @param inProjects
  107. * @param notInProjects @return list of Changeset mappings
  108. */
  109. public Set<Changeset> getLatestChangesets(final int count, GlobalFilter gf);
  110. public UrlInfo getUrlInfo(String repositoryUrl);
  111. public Changeset reloadChangeset(IssueMapping issueMapping);
  112. }