Interface PullRequestManager

  • All Superinterfaces:
    PullRequestSupplier, ServerExtension, TeamCityExtension

    public interface PullRequestManager
    extends PullRequestSupplier
    Pull request information and providers manager Please note, that due to limitations of this interface, pull request integration plugin does not support configurations that build pull requests coming from two VCS roots simultaneously.
    • Method Detail

      • getSettingsUrl

        @Nullable
        String getSettingsUrl​(@NotNull
                              String vcsHostingType)
        Returns an URL of a JSP file that renders settings corresponding the toe VCS hosting type provider
        Parameters:
        vcsHostingType - VCS hosting type
        Returns:
        the URL if the VCS hosting type is known, null otherwise
      • getPullRequests

        @NotNull
        Collection<PullRequest> getPullRequests​(@NotNull
                                                VcsRootInstance vcsRoot,
                                                @NotNull
                                                SBuildType buildType,
                                                @NotNull
                                                Map<String,​String> branchRevisions,
                                                boolean retrieve,
                                                boolean openOnly)
        Provides open pull request information for a VCS root instance
        Parameters:
        vcsRoot - VCS root instance
        buildType - build configuration
        branchRevisions - branch names to revisions map. This is only used to determine if the retrieval from a third party system is necessary (if allowed)
        retrieve - if true, the retrieval is allowed
        openOnly -
        Returns:
        pull requests information
      • getCachedPullRequests

        List<PullRequest> getCachedPullRequests​(@NotNull
                                                VcsRoot vcsRoot,
                                                @NotNull
                                                SBuildType buildType,
                                                @NotNull
                                                String branchRef)
        Parameters:
        vcsRoot - VCS root
        buildType - build type for which pr feature is set
        branchRef - branch reference of a pull request branch
        Returns:
        pull request information about the corresponding pull request, it is retrieved from the cache and not updated
      • getTargetBranches

        PullRequestManager.TargetBranchesInfo getTargetBranches​(@NotNull
                                                                String providerType,
                                                                @NotNull
                                                                VcsRootInstance vcsRootInstance,
                                                                @NotNull
                                                                SBuildType buildType)
        Return target branches information for pull requests for the given VCS root instance and build type
        Parameters:
        providerType - pull request provider type
        vcsRootInstance - VCS root instance
        buildType - Build type
        Returns:
        an object that contains target branch names and last retrieval timestamp
      • getTargetBranches

        PullRequestManager.TargetBranchesInfo getTargetBranches​(@NotNull
                                                                String providerType,
                                                                @NotNull
                                                                SVcsRoot vcsRoot,
                                                                @NotNull
                                                                BuildTypeTemplate template)
        Return target branches information for pull requests for the given VCS root and template
        Parameters:
        providerType - pull request provider type
        vcsRoot - VCS root
        template - Build type or template
        Returns:
        an object that contains target branch names and last retrieval timestamp
      • registerProviderService

        void registerProviderService​(@NotNull
                                     PullRequestProviderService providerService)
        Register pull request provider
        Parameters:
        providerService - pull request provider
      • schedulePullRequestsRetrieval

        @Nullable
        Future<List<PullRequest>> schedulePullRequestsRetrieval​(@NotNull
                                                                VcsRoot root,
                                                                @NotNull
                                                                BuildTypeSettings buildTypeSettings,
                                                                @NotNull
                                                                Collection<PullRequest> oldPullRequests)
        Schedules extraction of information about individual pull requests from a remote system (e.g. VCS hosting provider)
        Parameters:
        root - VCS root isntance
        buildTypeSettings - build type or template
        oldPullRequests - collection of pull requests to extract the information for
        Returns:
        future if action is scheduled, null otherwise
      • schedulePullRequestsRetrieval

        @Nullable
        Future<Boolean> schedulePullRequestsRetrieval​(@NotNull
                                                      VcsRoot root,
                                                      @NotNull
                                                      BuildTypeSettings buildTypeSettings,
                                                      @Nullable
                                                      Map<String,​String> customParameters)
        Schedules batch retrieval of the pull request information. The pull requests will be retrieved in an asynchronous way in a reverse order of their last updated times until one either no more pull requests to retrieve or last updated timestamp is older than maxAge (if the latter is provided)
        Parameters:
        root - VCS root or VCS root instance to retrieve pull request info from
        buildTypeSettings - build configuration or template that contains relevant build feature
        customParameters - if provided, these will be used instead of the current build feature settings
        Returns:
        Completable future if the action was scheduled, null otherwise
      • describeParameters

        @NotNull
        String describeParameters​(@NotNull
                                  Map<String,​String> params)
        Provides a description for build feature parameters
        Parameters:
        params - build feature parameters
        Returns:
        short textual description of the build feature parameters
      • getFilter

        @Nullable
        Predicate<PullRequest> getFilter​(@NotNull
                                         Map<String,​String> parameters,
                                         BuildTypeEx buildType)
        Get a composite filter that applies both the author role filter and a target branch filter if required
        Parameters:
        vcsHostingType - VCS hosting type
        parameters - contributor roles filter id
        buildType -
        Returns:
        see above
      • getOAuthConnections

        @NotNull
        Map<OAuthConnectionDescriptor,​Boolean> getOAuthConnections​(@NotNull
                                                                         String vcsHostingType,
                                                                         @NotNull
                                                                         SProject project,
                                                                         @NotNull
                                                                         SUser user)
        Returns OAuth available OAuth connection for a specified user in a specified project for a give VCS hosting type
        Parameters:
        vcsHostingType - VCS hosting type
        project - project
        user - user
        Returns:
        see above
      • getOAuthConnections

        @NotNull
        List<OAuthConnectionDescriptor> getOAuthConnections​(@NotNull
                                                            String vcsHostingType,
                                                            @NotNull
                                                            SProject project)
        Returns OAuth available OAuth connection in a specified project for a give VCS hosting type
        Parameters:
        vcsHostingType - VCS hosting type
        project - project
        Returns:
        see above
      • getBranchesOrBranchSpecs

        Set<String> getBranchesOrBranchSpecs​(@NotNull
                                             Collection<PullRequest> pullRequests,
                                             @NotNull
                                             Map<String,​String> params,
                                             boolean generateBranchSpecs)
        retrieve set of Rull Request bracnches or branchs specs (depends on @generateBranchSpecs)
        Parameters:
        pullRequests -
        params - map which must contain vcs hosting type
        generateBranchSpecs -
        Returns:
        set of actual branches or branch specs
      • getBranchSpecEscapeSequence

        String getBranchSpecEscapeSequence​(@NotNull
                                           Map<String,​String> params)