Interface VcsRepositoryConfigurationService

    • Method Detail

      • editLinkedRepository

        @NotNull
        @NotNull PartialVcsRepositoryData editLinkedRepository​(long repositoryId,
                                                               @NotNull
                                                               @NotNull PartialVcsRepositoryData newVcsConfiguration)
        Edits existing linked repository
        Parameters:
        repositoryId -
        newVcsConfiguration -
        Returns:
      • editProjectRepository

        @NotNull
        @NotNull PartialVcsRepositoryData editProjectRepository​(long repositoryId,
                                                                @NotNull
                                                                @NotNull PartialVcsRepositoryData newVcsConfiguration)
        Edits existing project repository
        Parameters:
        repositoryId -
        newVcsConfiguration -
        Returns:
      • validateLinkedRepositoryName

        boolean validateLinkedRepositoryName​(@NotNull
                                             @NotNull String repositoryName,
                                             @Nullable
                                             @Nullable BambooIdProvider vcsRepositoryData)
        Checks if name of a linked repository is unique.
        Parameters:
        repositoryName -
        vcsRepositoryData -
        Returns:
      • validateProjectRepositoryName

        boolean validateProjectRepositoryName​(@NotNull
                                              @NotNull String repositoryName,
                                              @NotNull
                                              @NotNull Long projectId,
                                              @Nullable
                                              @Nullable BambooIdProvider vcsRepositoryData)
        Checks if name of a project repository is unique in the project.
        Parameters:
        repositoryName -
        projectId -
        Returns:
      • validateRepositoryName

        boolean validateRepositoryName​(@NotNull
                                       @NotNull ImmutablePlan immutablePlan,
                                       @NotNull
                                       @NotNull String repositoryName,
                                       @Nullable
                                       @Nullable BambooIdProvider repositoryDefinition)
        Checks if provided name for repository is unique in the Plan
      • linkRepositoryToPlan

        @NotNull
        @NotNull PartialVcsRepositoryData linkRepositoryToPlan​(@NotNull
                                                               @NotNull Plan plan,
                                                               long selectedRepositoryId)
        Connects a linked repository to a plan by creating a new repository that inherits all the data from the linked repository and adding it to the plan.
        Parameters:
        plan -
        selectedRepositoryId -
        Returns:
      • createPlanRepository

        @NotNull
        @NotNull PartialVcsRepositoryData createPlanRepository​(@NotNull
                                                               @NotNull Plan plan,
                                                               @NotNull
                                                               @NotNull PartialVcsRepositoryData newVcsConfiguration)
        Creates "plan local" repository and adds it to a plan.
        Parameters:
        plan -
        newVcsConfiguration -
        Returns:
      • editRepository

        @NotNull
        @NotNull PartialVcsRepositoryData editRepository​(@NotNull
                                                         @NotNull Plan plan,
                                                         long repositoryId,
                                                         @NotNull
                                                         @NotNull PartialVcsRepositoryData newVcsConfiguration)
        Edits existing "plan local" repository.
        Parameters:
        plan -
        repositoryId -
        newVcsConfiguration -
        Returns:
      • deleteRepository

        void deleteRepository​(@NotNull
                              @NotNull Plan plan,
                              long repositoryId,
                              @Nullable
                              @Nullable Long replacementRepositoryId)
        Removes repository definition from a plan
        Parameters:
        plan -
        repositoryId -
        replacementRepositoryId - repository id to replace removed one in tasks depending on it
      • deleteLinkedRepository

        void deleteLinkedRepository​(long repositoryId)
        Removes linked repository.
        Parameters:
        repositoryId -
      • deleteProjectRepository

        void deleteProjectRepository​(long repositoryId)
        Removes project repository.
        Parameters:
        repositoryId -
      • moveRepository

        void moveRepository​(@NotNull
                            @NotNull Plan plan,
                            long repositoryId,
                            long beforePosition,
                            long afterPosition)
        Changes position of repository in the repository list. Important for setting default repository
        Parameters:
        plan -
        repositoryId - the RepositoryDefinition to move
        beforePosition - position of the RepositoryDefinition that will be before the moving Repository, -1 if the beginning of the list
        afterPosition - position of the RepositoryDefinition that will be after the moving Repository, -1 if the end of the list
      • shareRepository

        void shareRepository​(@NotNull
                             @NotNull Plan plan,
                             @NotNull
                             @NotNull PartialVcsRepositoryData repositoryData,
                             @NotNull
                             @NotNull String repositoryName,
                             @Nullable
                             @Nullable String userDescription,
                             @NotNull
                             @NotNull com.atlassian.user.User user)
        Converts existing Plan repository to Linked repository.
        Parameters:
        plan - plan that owns the repository
        repositoryData - repository to share
        repositoryName - new name of the repository
        userDescription - of the repository
        Since:
        5.14
      • setParentOfPlanRepository

        void setParentOfPlanRepository​(@NotNull
                                       @NotNull ImmutablePlan plan,
                                       long repositoryId,
                                       long parentRepositoryId)
        Creates or changes parent-child relationship for a plan repository.
        Parameters:
        plan -
        repositoryId -
        parentRepositoryId -
      • validateRestartableStatus

        boolean validateRestartableStatus​(@NotNull
                                          @NotNull ResultsSummary resultSummary)
        Checks that result is restartable and repositories referenced by a result still exists in Bamboo db.
      • validateContinuableStatus

        boolean validateContinuableStatus​(@NotNull
                                          @NotNull ResultsSummary resultSummary)
        Checks that result is continuable and repositories referenced by a result still exists in Bamboo db.
        Since:
        6.9
      • getRelevantJobsForRepositoryIdChange

        @Deprecated
        Map<ImmutableJob,​List<TaskDefinition>> getRelevantJobsForRepositoryIdChange​(@NotNull
                                                                                          @NotNull ImmutablePlan plan,
                                                                                          long repositoryId)
        Deprecated.
        since 5.14
        Gets list of jobs using a repository.
        Parameters:
        plan -
        repositoryId -
      • convertToNewRepositoryConfiguration

        @Deprecated
        PartialVcsRepositoryData convertToNewRepositoryConfiguration​(@NotNull
                                                                     @NotNull PartialVcsRepositoryData vcsRepositoryData)
        Deprecated.
        since 5.14 should be used for backward compatibility and upgrade task only
        If repository data represents a repository implemented in the old system and appropriate new plugin exists, the data is converted to the new plugin. Otherwise, original data is returned.
        Parameters:
        vcsRepositoryData -
        Returns:
      • validateLinkedRepository

        void validateLinkedRepository​(@NotNull
                                      @NotNull PartialVcsRepositoryData vcsRepositoryData)
                               throws com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
        Validate linked repository before saving it in database.
        Parameters:
        vcsRepositoryData - imported linked repository
        Throws:
        com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
      • validateProjectRepository

        void validateProjectRepository​(@NotNull
                                       @NotNull PartialVcsRepositoryData vcsRepositoryData)
                                throws com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
        Validate project repository before saving it in database.
        Parameters:
        vcsRepositoryData - imported project repository
        Throws:
        com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
      • mergeLinkedRepository

        PartialVcsRepositoryData mergeLinkedRepository​(@NotNull
                                                       @NotNull PartialVcsRepositoryData vcsRepositoryData)
                                                throws com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
        Merges the state of the given linked repository into the database.

        This service will attempt to merge the entity based on ImmutableEntityWithOid.getOid(), and if there's no match, based on DescriptionProvider.getName(). If an existing entity is found, then it will be updated. Otherwise, a new database entity will be created.

        It's assumed that this method is used in specs import only as it's sending analytic event.

        Parameters:
        vcsRepositoryData - imported linked repository
        Returns:
        an object after persisting to the database - either the newly created or updated database object
        Throws:
        com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
      • mergeProjectRepository

        PartialVcsRepositoryData mergeProjectRepository​(@NotNull
                                                        @NotNull PartialVcsRepositoryData vcsRepositoryData)
                                                 throws com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
        Merges the state of the given project repository into the database.

        This service will attempt to merge the entity based on ImmutableEntityWithOid.getOid(), and if there's no match, based on DescriptionProvider.getName(). If an existing entity is found, then it will be updated. Otherwise, a new database entity will be created. It's assumed that this method is used in specs import only as it's sending analytic event.

        Parameters:
        vcsRepositoryData - imported project repository
        Returns:
        an object after persisting to the database - either the newly created or updated database object
        Throws:
        com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
      • validatePlanRepository

        @Internal
        @Deprecated
        void validatePlanRepository​(@NotNull
                                    @NotNull Plan plan,
                                    @NotNull
                                    @NotNull PartialVcsRepositoryData vcsRepositoryData)
                             throws com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
        Deprecated.
        since 9.0 without direct replacement. The algorithm has changed.
        Validate plan repository before saving it in database.
        Parameters:
        plan -
        vcsRepositoryData - imported plan repository
        Throws:
        com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
      • validatePlanRepositoriesNamesAndOids

        void validatePlanRepositoriesNamesAndOids​(@NotNull
                                                  @NotNull Plan plan,
                                                  @NotNull
                                                  @NotNull List<PartialVcsRepositoryData> repositoryDataList)
                                           throws com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
        Validate repository names checking if there are no duplicates.
        Throws:
        com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
      • mergePlanRepositories

        void mergePlanRepositories​(@NotNull
                                   @NotNull Plan plan,
                                   @NotNull
                                   @NotNull List<PartialVcsRepositoryData> vcsRepositoryDataList)
                            throws com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
        Merges the state of the given plan repositories into the database. Note that it is up to the caller to validate if the resulting changes of repository configurations are actually legal.

        This service will attempt to merge the entities based on BambooIdProvider.getId(), and if there's no match, a new database entity will be created. All other repositories in plan will be removed.

        Parameters:
        plan -
        vcsRepositoryDataList - list of imported plan repositories
        Throws:
        com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
      • configureRssDetection

        @NotNull
        @NotNull ErrorCollection configureRssDetection​(long repositoryId,
                                                       PartialVcsRepositoryData vcsRepositoryData,
                                                       boolean isEnabled)
        Sets detection of Bamboo Specs for repository and saves new config. Validates if repository supports RSS.
        Parameters:
        repositoryId - id of repository
        vcsRepositoryData - repository configuration, remains unchanged
        isEnabled - true if Specs detection should be enabled, false otherwise
        Returns:
        a list of errors.
      • hasProjectSharedCredentialsForRepository

        @NotNull
        @org.jetbrains.annotations.NotNull boolean hasProjectSharedCredentialsForRepository​(PartialVcsRepositoryData vcsRepositoryData)
        Parameters:
        vcsRepositoryData - repository configuration
        Returns:
        true if has project shared credentials