Class VcsPullRequestHibernateDao

    • Constructor Detail

      • VcsPullRequestHibernateDao

        public VcsPullRequestHibernateDao()
    • Method Detail

      • findByRepositoryAndKey

        @Nullable
        public @Nullable MutableVcsPullRequest findByRepositoryAndKey​(long repositoryId,
                                                                      @NotNull
                                                                      @NotNull String pullRequestKey)
        Description copied from interface: VcsPullRequestDao
        Search pull request by pull request key (unique on repository level) and target repository id
        Specified by:
        findByRepositoryAndKey in interface VcsPullRequestDao
        Parameters:
        repositoryId - target repository id
        pullRequestKey - repository-specific pull request key
        Returns:
        pull request or null if not found
      • findByRepository

        @NotNull
        public @NotNull List<MutableVcsPullRequest> findByRepository​(long repositoryId,
                                                                     boolean isOpen)
        Description copied from interface: VcsPullRequestDao
        Search pull requests by target repository and status.
        Specified by:
        findByRepository in interface VcsPullRequestDao
        Parameters:
        repositoryId - target repository id
        isOpen - status
        Returns:
        list of pull requests
      • closePullRequestsClosedInRepository

        @NotNull
        public @NotNull PartialList<MutableVcsPullRequest> closePullRequestsClosedInRepository​(long targetRepositoryId,
                                                                                               @NotNull
                                                                                               @NotNull Set<String> openPrKeys)
        Description copied from interface: VcsPullRequestDao
        Synchronize status of PRs in DB and in remote repository. Returns a PartialList of updated pull requests.

        If the returned list is incomplete, this method should be called again.

        Specified by:
        closePullRequestsClosedInRepository in interface VcsPullRequestDao
        Parameters:
        targetRepositoryId - id of a remote repository
        openPrKeys - keys of pull requests which have open state in remote repository
        Returns:
        list of modified pull request entities
      • findByStatus

        @NotNull
        public @NotNull List<MutableVcsPullRequest> findByStatus​(boolean isOpen,
                                                                 long startId,
                                                                 int maxLimit)
        Description copied from interface: VcsPullRequestDao
        Search pull requests by status.
        Specified by:
        findByStatus in interface VcsPullRequestDao
        Parameters:
        isOpen - status
        startId - entity id to start query from
        maxLimit - maximum amount of values to be returned
        Returns:
        list of pull requests sorted by id
      • removeOrphanedPullRequests

        public int removeOrphanedPullRequests()
        Description copied from interface: VcsPullRequestDao
        Remove pull requests which are neither linked to any repository nor to any plan branch.
        Specified by:
        removeOrphanedPullRequests in interface VcsPullRequestDao
        Returns:
        number of removed records