Interface RepositoryService


  • public interface RepositoryService
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods 
      Modifier and Type Method Description
      void addCommentToPullRequest​(org.jboss.set.aphrodite.domain.PullRequest pullRequest, String comment)
      Deprecated.
      Use org.jboss.set.aphrodite.domain.spi.PullRequestHome#addComment() instead.
      void addLabelToPullRequest​(org.jboss.set.aphrodite.domain.PullRequest pullRequest, String labelName)
      Deprecated.
      Use org.jboss.set.aphrodite.domain.spi.PullRequestHome#addLabel() instead.
      default void destroy()
      allows to destroy and deallocate resources
      List<org.jboss.set.aphrodite.domain.PullRequest> findPullRequestsRelatedTo​(org.jboss.set.aphrodite.domain.PullRequest pullRequest)
      Deprecated.
      Use org.jboss.set.aphrodite.domain.spi.PullRequestHome#findReferencedPullRequests() instead.
      List<org.jboss.set.aphrodite.domain.Commit> getCommitsSince​(URL url, String branch, long since)
      returns list of commits committed after a given date
      org.jboss.set.aphrodite.domain.CommitStatus getCommitStatusFromPullRequest​(org.jboss.set.aphrodite.domain.PullRequest pullRequest)
      Deprecated.
      Use org.jboss.set.aphrodite.domain.spi.PullRequestHome#getCommitStatus() instead.
      List<org.jboss.set.aphrodite.domain.Label> getLabelsFromPullRequest​(org.jboss.set.aphrodite.domain.PullRequest pullRequest)
      Deprecated.
      Use org.jboss.set.aphrodite.domain.spi.PullRequestHome#getLabels() instead.
      List<org.jboss.set.aphrodite.domain.Label> getLabelsFromRepository​(org.jboss.set.aphrodite.domain.Repository repository)
      Retrieve all labels associated with the provided PullRequest in Repository object.
      org.jboss.set.aphrodite.domain.PullRequest getPullRequest​(URL url)
      Get the PullRequest located at the provided URL.
      org.jboss.set.aphrodite.domain.spi.PullRequestHome getPullRequestHome()
      Return the PullRequestHome service for this repository.
      List<org.jboss.set.aphrodite.domain.PullRequest> getPullRequestsAssociatedWith​(org.jboss.set.aphrodite.domain.Issue issue)
      Deprecated.
      List<org.jboss.set.aphrodite.domain.PullRequest> getPullRequestsByState​(org.jboss.set.aphrodite.domain.Repository repository, org.jboss.set.aphrodite.domain.PullRequestState state)
      Retrieve all pull requests associated with the provided Repository object, which have a state that matches the provided PullRequestState object.
      org.jboss.set.aphrodite.domain.RateLimit getRateLimit()  
      org.jboss.set.aphrodite.domain.Repository getRepository​(URL url)
      Get the repository located at the provided URL.
      RepositoryType getRepositoryType()
      Get Repository type
      boolean hasModifiableLabels​(org.jboss.set.aphrodite.domain.Repository repository)
      Discover if the user logged into this RepositoryService has the correct permissions to apply/remove labels to pull request in the provided Repository
      boolean init​(AphroditeConfig config)
      Initiate this RepositoryService using the supplied AphroditeConfig.
      boolean init​(RepositoryConfig config)
      Initiate this RepositoryService using the supplied RepositoryConfig.
      void removeLabelFromPullRequest​(org.jboss.set.aphrodite.domain.PullRequest pullRequest, String name)
      Deprecated.
      Use org.jboss.set.aphrodite.domain.spi.PullRequestHome#removeLabel() instead.
      boolean repositoryAccessable​(URL url)
      Checks whether the provided URL is accessable.
      void setLabelsToPullRequest​(org.jboss.set.aphrodite.domain.PullRequest pullRequest, List<org.jboss.set.aphrodite.domain.Label> labels)
      Deprecated.
      Use org.jboss.set.aphrodite.domain.spi.PullRequestHome#setLabels() instead.
      boolean urlExists​(URL url)
      Checks whether the provided URL is on the same host as this service.
    • Method Detail

      • init

        boolean init​(AphroditeConfig config)
        Initiate this RepositoryService using the supplied AphroditeConfig. The first RepositoryConfig object found in AphroditeConfig object, is used to initiate the service and is subsequently removed from the config to prevent the same service being initiated twice.
        Parameters:
        config - a AphroditeConfig object containing at least one RepositoryConfig object.
        Returns:
        true if the service was initialised without errors, false otherwise.
        Throws:
        IllegalArgumentException - if no RepositoryConfig objects are present.
      • init

        boolean init​(RepositoryConfig config)
        Initiate this RepositoryService using the supplied RepositoryConfig.
        Parameters:
        config - a RepositoryConfig object containing all configuration information.
        Returns:
        true if the service was initialised without errors, false otherwise.
      • urlExists

        boolean urlExists​(URL url)
        Checks whether the provided URL is on the same host as this service.
        Parameters:
        url - the URL to check.
        Returns:
        true if the provided URL has the same host as this service, otherwise false.
        Throws:
        NullPointerException - if the provided URL is null.
      • repositoryAccessable

        boolean repositoryAccessable​(URL url)
        Checks whether the provided URL is accessable.
        Parameters:
        url - the URL to check.
        Returns:
        true if the provided URL is accessable, otherwise false.
      • getRepository

        org.jboss.set.aphrodite.domain.Repository getRepository​(URL url)
                                                         throws NotFoundException
        Get the repository located at the provided URL.
        Parameters:
        url - the URL of the repository to be retrieved.
        Returns:
        the Repository object.
        Throws:
        NotFoundException - if a Repository cannot be found at the provided base url.
      • getPullRequest

        org.jboss.set.aphrodite.domain.PullRequest getPullRequest​(URL url)
                                                           throws NotFoundException
        Get the PullRequest located at the provided URL.
        Parameters:
        url - the URL of the pull request to be retrieved.
        Returns:
        the PullRequest object.
        Throws:
        NotFoundException - if a PullRequest cannot be found at the provided base url.
      • getPullRequestsAssociatedWith

        @Deprecated
        List<org.jboss.set.aphrodite.domain.PullRequest> getPullRequestsAssociatedWith​(org.jboss.set.aphrodite.domain.Issue issue)
                                                                                throws NotFoundException
        Deprecated.
        Retrieve all pull requests associated with the provided Issue object
        Parameters:
        issue - the Issue object whose associated pull requests should be returned.
        Returns:
        a list of all PullRequest objects, or an empty list if no pull request can be found.
        Throws:
        NotFoundException - if an exception is thrown when searching the RepositoryService.
      • getPullRequestsByState

        List<org.jboss.set.aphrodite.domain.PullRequest> getPullRequestsByState​(org.jboss.set.aphrodite.domain.Repository repository,
                                                                                org.jboss.set.aphrodite.domain.PullRequestState state)
                                                                         throws NotFoundException
        Retrieve all pull requests associated with the provided Repository object, which have a state that matches the provided PullRequestState object.
        Parameters:
        repository - the Repository object whose associated pull requests should be returned.
        state - the PullRequestsState which the returned PullRequest objects must have.
        Returns:
        a list of all matching PullRequest objects, or an empty list if no pull request can be found.
        Throws:
        NotFoundException - if the provided Repository cannot be found at the RepositoryService.
      • getLabelsFromRepository

        List<org.jboss.set.aphrodite.domain.Label> getLabelsFromRepository​(org.jboss.set.aphrodite.domain.Repository repository)
                                                                    throws NotFoundException
        Retrieve all labels associated with the provided PullRequest in Repository object.
        Parameters:
        repository - the Repository object whose associated labels should be returned.
        Returns:
        a list of all matching Label objects, or an empty list if no label can be found.
        Throws:
        NotFoundException - if the provided Repository url not consistent with the baseURL.
      • getLabelsFromPullRequest

        @Deprecated
        List<org.jboss.set.aphrodite.domain.Label> getLabelsFromPullRequest​(org.jboss.set.aphrodite.domain.PullRequest pullRequest)
                                                                     throws NotFoundException
        Deprecated.
        Use org.jboss.set.aphrodite.domain.spi.PullRequestHome#getLabels() instead.
        Retrieve all labels associated with the provided PullRequest object.
        Parameters:
        pullRequest - the PullRequest object whose associated labels should be returned.
        Returns:
        a list of all matching Label objects, or an empty list if no pull request can be found.
        Throws:
        NotFoundException - if the provided PullRequest url not consistent with the baseURL.
      • hasModifiableLabels

        boolean hasModifiableLabels​(org.jboss.set.aphrodite.domain.Repository repository)
                             throws NotFoundException
        Discover if the user logged into this RepositoryService has the correct permissions to apply/remove labels to pull request in the provided Repository
        Parameters:
        repository - the Repository whose permissions are to be checked
        Returns:
        true if the user has permission, otherwise false.
        Throws:
        NotFoundException - if the specified Repository cannot be found.
      • setLabelsToPullRequest

        @Deprecated
        void setLabelsToPullRequest​(org.jboss.set.aphrodite.domain.PullRequest pullRequest,
                                    List<org.jboss.set.aphrodite.domain.Label> labels)
                             throws NotFoundException,
                                    AphroditeException
        Deprecated.
        Use org.jboss.set.aphrodite.domain.spi.PullRequestHome#setLabels() instead.
        Set the labels for the provided PullRequest object.
        Parameters:
        pullRequest - the PullRequest object whose will be set.
        labels - the Label apply to the PullRequest
        Throws:
        NotFoundException - if the Label can not be found in the provided PullRequest
        AphroditeException - if add the Label is not consistent with get labels
      • removeLabelFromPullRequest

        @Deprecated
        void removeLabelFromPullRequest​(org.jboss.set.aphrodite.domain.PullRequest pullRequest,
                                        String name)
                                 throws NotFoundException
        Deprecated.
        Use org.jboss.set.aphrodite.domain.spi.PullRequestHome#removeLabel() instead.
        Delete a label from the provided PullRequest object.
        Parameters:
        pullRequest - the PullRequest whose label will be removed.
        name - the Label name will be removed.
        Throws:
        NotFoundException - if the Label name can not be found in the provided PullRequest
      • addCommentToPullRequest

        @Deprecated
        void addCommentToPullRequest​(org.jboss.set.aphrodite.domain.PullRequest pullRequest,
                                     String comment)
                              throws NotFoundException
        Deprecated.
        Use org.jboss.set.aphrodite.domain.spi.PullRequestHome#addComment() instead.
        Add a Comment to the specified PullRequest object, and propagate the changes to the remote repository.
        Parameters:
        pullRequest - the PullRequest on which the comment will be made.
        comment - the new Comment.
        Throws:
        NotFoundException - if the PullRequest cannot be found at the remote repository.
      • addLabelToPullRequest

        @Deprecated
        void addLabelToPullRequest​(org.jboss.set.aphrodite.domain.PullRequest pullRequest,
                                   String labelName)
                            throws NotFoundException
        Deprecated.
        Use org.jboss.set.aphrodite.domain.spi.PullRequestHome#addLabel() instead.
        Attach a label to the specified pull request. Note the label must already exist at remote repository, otherwise a NotFoundException will be thrown. If the specified label is already associated with the provided pull request then no further action is taken.
        Parameters:
        pullRequest - the PullRequest to which the label will be applied.
        labelName - the name of the label to be applied.
        Throws:
        NotFoundException - if the specified labelName has not been defined at the remote repository.
      • findPullRequestsRelatedTo

        @Deprecated
        List<org.jboss.set.aphrodite.domain.PullRequest> findPullRequestsRelatedTo​(org.jboss.set.aphrodite.domain.PullRequest pullRequest)
        Deprecated.
        Use org.jboss.set.aphrodite.domain.spi.PullRequestHome#findReferencedPullRequests() instead.
        Find all the pull requests related to the given pull request.
        Parameters:
        pullRequest - the PullRequest on which pull requests related are being searched
        Returns:
        list of pull requests related.
      • getCommitStatusFromPullRequest

        @Deprecated
        org.jboss.set.aphrodite.domain.CommitStatus getCommitStatusFromPullRequest​(org.jboss.set.aphrodite.domain.PullRequest pullRequest)
                                                                            throws NotFoundException
        Deprecated.
        Use org.jboss.set.aphrodite.domain.spi.PullRequestHome#getCommitStatus() instead.
        Retrieve the current CI status of the latest commit associated with a given pull request.
        Parameters:
        pullRequest - the PullRequest object whose status is to be queried
        Returns:
        the CI status of the latest commit associated with the given pull request
        Throws:
        NotFoundException - if no commit status can be found for the provided pull request
      • destroy

        default void destroy()
        allows to destroy and deallocate resources
      • getRepositoryType

        RepositoryType getRepositoryType()
        Get Repository type
        Returns:
        RepositoryType
      • getPullRequestHome

        org.jboss.set.aphrodite.domain.spi.PullRequestHome getPullRequestHome()
        Return the PullRequestHome service for this repository.
        Returns:
        Returns The PR home service for this repository.
      • getCommitsSince

        List<org.jboss.set.aphrodite.domain.Commit> getCommitsSince​(URL url,
                                                                    String branch,
                                                                    long since)
        returns list of commits committed after a given date
        Parameters:
        url - - repository url
        branch - - repository branch
        since - - date in Unix time
        Returns:
        list of commits since a given date