Interface VcsConfigurationHelper
-
- All Known Implementing Classes:
VcsConfigurationHelperImpl
@Internal public interface VcsConfigurationHelper
Bunch of common operations used in repository related actions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
VcsConfigurationHelper.Overrides
-
Field Summary
Fields Modifier and Type Field Description static String
BAMBOO_TEST_CONNECTION
Special marker added toActionParametersMap
if validation invoked from test connection.static EnumSet<VcsConfigurationHelper.Overrides>
OVERRIDE_ALL
static EnumSet<VcsConfigurationHelper.Overrides>
OVERRIDE_NOTHING
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
currentUserHasPermissionToCreateSharedRepository()
@NotNull PartialVcsRepositoryData
getNewPartialVcsConfigurationFromActionData(@NotNull ActionParametersMap apm, @NotNull VcsRepositoryModuleDescriptor vcsDescriptor, @NotNull String repositoryName, @Nullable String userDescription, @Nullable Long projectId, @Nullable PartialVcsRepositoryData previousVcsDefinition, boolean unused, @NotNull Set<VcsConfigurationHelper.Overrides> overrides)
Extracts repository configuration from action's parameters for saving in DB.@NotNull PartialVcsRepositoryData
reconfigureRepositoryWithMavenData(@NotNull VcsRepositoryModuleDescriptor oldModuleDescriptor, @NotNull PartialVcsRepositoryData oldData, @Nullable VcsRepositoryModuleDescriptor newModuleDescriptor, @NotNull Map<String,String> newServerConfiguration, @Nullable VcsBranch vcsBranch, @Nullable String webRepositoryUrl)
Creates new repository configuration according to data found in a maven pom.xml.@NotNull PartialVcsRepositoryData
temporaryVcsDataFromActionParams(@NotNull ActionParametersMap apm, @NotNull VcsRepositoryModuleDescriptor moduleDescriptor, @Nullable PartialVcsRepositoryData existingData, @NotNull Set<VcsConfigurationHelper.Overrides> overrides)
Extracts repository configuration from action's parameters.@Nullable RepositoryDataEntity
validateRepositoryExistenceAndPermissions(long repositoryId, com.atlassian.struts.ValidationAware validationAware)
Checks if a repository exists in the DB.@NotNull ErrorCollection
validateSharedRepositoryName(String repositoryName)
Check if new shared repository name is valid.void
validateSharedRepositoryName(String repositoryName, com.atlassian.struts.ValidationAware validationAware)
Check if new shared repository name is valid.void
validateVcsConfiguration(@NotNull ActionParametersMap apm, @NotNull VcsRepositoryModuleDescriptor vcsDescriptor, @Nullable PartialVcsRepositoryData previousVcsDefinition, @NotNull ErrorCollection errorCollection, @NotNull Set<VcsConfigurationHelper.Overrides> overrides)
Run repository configuration validation(s) on action's data.void
validateVcsConfigurationForConnectionTesting(@NotNull ActionParametersMap apm, @NotNull VcsRepositoryModuleDescriptor vcsDescriptor, @Nullable PartialVcsRepositoryData previousVcsDefinition, @NotNull ErrorCollection errorCollection)
Run repository configuration validation(s) on action's data before testing the connection.
-
-
-
Field Detail
-
BAMBOO_TEST_CONNECTION
static final String BAMBOO_TEST_CONNECTION
Special marker added toActionParametersMap
if validation invoked from test connection.- See Also:
- Constant Field Values
-
OVERRIDE_NOTHING
static final EnumSet<VcsConfigurationHelper.Overrides> OVERRIDE_NOTHING
-
OVERRIDE_ALL
static final EnumSet<VcsConfigurationHelper.Overrides> OVERRIDE_ALL
-
-
Method Detail
-
validateVcsConfiguration
void validateVcsConfiguration(@NotNull @NotNull ActionParametersMap apm, @NotNull @NotNull VcsRepositoryModuleDescriptor vcsDescriptor, @Nullable @Nullable PartialVcsRepositoryData previousVcsDefinition, @NotNull @NotNull ErrorCollection errorCollection, @NotNull @NotNull Set<VcsConfigurationHelper.Overrides> overrides)
Run repository configuration validation(s) on action's data.- Parameters:
apm
-vcsDescriptor
-previousVcsDefinition
-errorCollection
-
-
validateVcsConfigurationForConnectionTesting
void validateVcsConfigurationForConnectionTesting(@NotNull @NotNull ActionParametersMap apm, @NotNull @NotNull VcsRepositoryModuleDescriptor vcsDescriptor, @Nullable @Nullable PartialVcsRepositoryData previousVcsDefinition, @NotNull @NotNull ErrorCollection errorCollection)
Run repository configuration validation(s) on action's data before testing the connection.- Parameters:
apm
-vcsDescriptor
-previousVcsDefinition
-errorCollection
-
-
reconfigureRepositoryWithMavenData
@NotNull @NotNull PartialVcsRepositoryData reconfigureRepositoryWithMavenData(@NotNull @NotNull VcsRepositoryModuleDescriptor oldModuleDescriptor, @NotNull @NotNull PartialVcsRepositoryData oldData, @Nullable @Nullable VcsRepositoryModuleDescriptor newModuleDescriptor, @NotNull @NotNull Map<String,String> newServerConfiguration, @Nullable @Nullable VcsBranch vcsBranch, @Nullable @Nullable String webRepositoryUrl)
Creates new repository configuration according to data found in a maven pom.xml.- Parameters:
oldModuleDescriptor
- descriptor of the plugin which was used to check out maven pomoldData
- repository data used to check out maven pomnewModuleDescriptor
- descriptor of the repository plugin according to repository url found in pom.xmlnewServerConfiguration
- server configuration as extracted byVcsMavenPomAccessor.parseMavenScmUrlToVcsLocation(String, VcsRepositoryData)
vcsBranch
- vcs branch as extracted byVcsMavenPomAccessor.parseMavenScmUrlToVcsBranch(String, VcsRepositoryData)
webRepositoryUrl
- url to be used by web repository viewer
-
getNewPartialVcsConfigurationFromActionData
@NotNull @NotNull PartialVcsRepositoryData getNewPartialVcsConfigurationFromActionData(@NotNull @NotNull ActionParametersMap apm, @NotNull @NotNull VcsRepositoryModuleDescriptor vcsDescriptor, @NotNull @NotNull String repositoryName, @Nullable @Nullable String userDescription, @Nullable @Nullable Long projectId, @Nullable @Nullable PartialVcsRepositoryData previousVcsDefinition, boolean unused, @NotNull @NotNull Set<VcsConfigurationHelper.Overrides> overrides)
Extracts repository configuration from action's parameters for saving in DB.- Parameters:
apm
-vcsDescriptor
-repositoryName
-userDescription
-projectId
-previousVcsDefinition
-unused
-- Returns:
-
temporaryVcsDataFromActionParams
@NotNull @NotNull PartialVcsRepositoryData temporaryVcsDataFromActionParams(@NotNull @NotNull ActionParametersMap apm, @NotNull @NotNull VcsRepositoryModuleDescriptor moduleDescriptor, @Nullable @Nullable PartialVcsRepositoryData existingData, @NotNull @NotNull Set<VcsConfigurationHelper.Overrides> overrides)
Extracts repository configuration from action's parameters. Used if action requires to be able to perform some vcs ops without actually creating a proper repository object in DB (e.g. test connection, checkout for maven import)- Parameters:
apm
-moduleDescriptor
-existingData
-- Returns:
-
validateSharedRepositoryName
void validateSharedRepositoryName(String repositoryName, com.atlassian.struts.ValidationAware validationAware)
Check if new shared repository name is valid.- Parameters:
repositoryName
- namevalidationAware
- caller
-
validateSharedRepositoryName
@NotNull @NotNull ErrorCollection validateSharedRepositoryName(String repositoryName)
Check if new shared repository name is valid.- Parameters:
repositoryName
- name
-
currentUserHasPermissionToCreateSharedRepository
boolean currentUserHasPermissionToCreateSharedRepository()
- Returns:
- true if creation of a repository is allowed
-
validateRepositoryExistenceAndPermissions
@Nullable @Nullable RepositoryDataEntity validateRepositoryExistenceAndPermissions(long repositoryId, com.atlassian.struts.ValidationAware validationAware)
Checks if a repository exists in the DB.- Parameters:
repositoryId
-validationAware
- caller- Returns:
- repository database object if exists, null if it doesn't
-
-