public class VcsRepositoryConfigurationServiceImpl extends Object implements VcsRepositoryConfigurationService
LEGACY_VCS_PLUGINS_USED_BANDANA_KEY
Constructor and Description |
---|
VcsRepositoryConfigurationServiceImpl(RepositoryDefinitionManager repositoryDefinitionManager,
AuditLogService auditLogService,
HibernateMutableAclService aclService,
RawRepositoryConfigurationXmlConverter rawRepositoryConfigurationXmlConverter,
ImmutablePlanCacheService immutablePlanCacheService,
ScopedExclusionService scopedExclusionService,
TriggerConfigurationService triggerConfigurationService,
TaskConfigurationService taskConfigurationService,
ChainBranchManager chainBranchManager,
EnvironmentTaskService environmentTaskService,
BuildDefinitionManager buildDefinitionManager,
com.atlassian.event.api.EventPublisher eventPublisher,
BranchDetectionService branchDetectionService,
VcsRepositoryManager vcsRepositoryManager) |
Modifier and Type | Method and Description |
---|---|
ErrorCollection |
configureRssDetection(long repositoryId,
PartialVcsRepositoryData vcsRepositoryData,
boolean isEnabled)
Sets detection of Bamboo Specs for repository and saves new config.
|
PartialVcsRepositoryData |
convertToNewRepositoryConfiguration(PartialVcsRepositoryData vcsRepositoryData)
If repository data represents a repository implemented in the old system and appropriate new plugin exists,
the data is converted to the new plugin.
|
PartialVcsRepositoryData |
createLinkedRepository(PartialVcsRepositoryData newVcsRepository,
com.atlassian.user.User user,
RepositoryConfigurationService.LinkedRepositoryAccess accessOption)
Creates new linked repository.
|
org.acegisecurity.acls.MutableAcl |
createNewSharedRepositoryDefaultAcl(com.atlassian.user.User user,
long repositoryId,
RepositoryConfigurationService.LinkedRepositoryAccess accessOption)
Creates a defualt Acl for a specific repository which has:
- READ permissions for the creator (if applicable)
- READ permission to logged in users if ALL_USERS option is specified
|
PartialVcsRepositoryData |
createPlanRepository(Plan plan,
PartialVcsRepositoryData newVcsConfiguration)
Creates "plan local" repository and adds it to a plan.
|
void |
deleteLinkedRepository(long repositoryId)
Removes linked repository.
|
void |
deleteRepository(Plan plan,
long repositoryId,
Long replacementRepositoryId)
Removes repository definition from a plan
|
PartialVcsRepositoryData |
editLinkedRepository(long repositoryId,
PartialVcsRepositoryData newVcsConfiguration)
Edits existing linked repository
|
PartialVcsRepositoryData |
editRepository(Plan plan,
long repositoryId,
PartialVcsRepositoryData newVcsConfiguration)
Edits existing "plan local" repository.
|
protected List<PlanRepositoryLink> |
getNewRepositoryList(List<PlanRepositoryLink> originalRepositories,
PlanRepositoryLink toMove,
long beforeId,
long afterId) |
Map<ImmutableJob,List<TaskDefinition>> |
getRelevantJobsForRepositoryIdChange(ImmutablePlan plan,
long repositoryId)
Gets list of jobs using a repository.
|
PartialVcsRepositoryData |
linkRepositoryToPlan(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.
|
PartialVcsRepositoryData |
mergeLinkedRepository(PartialVcsRepositoryData vcsRepositoryData)
Merges the state of the given linked repository into the database.
|
void |
mergePlanRepositories(Plan plan,
List<PartialVcsRepositoryData> vcsRepositoryDataList)
Merges the state of the given plan repositories into the database.
|
void |
moveRepository(Plan plan,
long repositoryId,
long beforePosition,
long afterPosition)
Changes position of repository in the repository list.
|
PartialVcsRepositoryData |
replaceRepositoryInPlan(Plan plan,
VcsRepositoryData parentRepository,
PartialVcsRepositoryData oldRepository,
PartialVcsRepositoryData newRepository)
Replaces uses of a repository with another one.
|
void |
setParentOfPlanRepository(ImmutablePlan plan,
long repositoryId,
long parentRepositoryId)
Creates or changes parent-child relationship for a plan repository.
|
void |
shareRepository(Plan plan,
PartialVcsRepositoryData repositoryData,
String repositoryName,
String userDescription,
com.atlassian.user.User user)
Converts existing Plan repository to Linked repository.
|
boolean |
validateContinuableStatus(ResultsSummary resultSummary)
Checks that result is continuable and repositories referenced by a result still exists in Bamboo db.
|
void |
validateLinkedRepository(PartialVcsRepositoryData vcsRepositoryData)
Validate linked repository before saving it in database.
|
boolean |
validateLinkedRepositoryName(String repositoryName,
BambooIdProvider vcsRepositoryData)
Checks if name of a linked repository is unique.
|
void |
validatePlanRepository(Plan plan,
PartialVcsRepositoryData vcsRepositoryData)
Validate plan repository before saving it in database.
|
boolean |
validateRepositoryName(ImmutablePlan immutablePlan,
String repositoryName,
BambooIdProvider repositoryDefinition)
Checks if provided name for repository is unique in the Plan
|
boolean |
validateRestartableStatus(ResultsSummary resultSummary)
Checks that result is restartable and repositories referenced by a result still exists in Bamboo db.
|
public VcsRepositoryConfigurationServiceImpl(RepositoryDefinitionManager repositoryDefinitionManager, AuditLogService auditLogService, HibernateMutableAclService aclService, RawRepositoryConfigurationXmlConverter rawRepositoryConfigurationXmlConverter, ImmutablePlanCacheService immutablePlanCacheService, ScopedExclusionService scopedExclusionService, TriggerConfigurationService triggerConfigurationService, TaskConfigurationService taskConfigurationService, ChainBranchManager chainBranchManager, EnvironmentTaskService environmentTaskService, BuildDefinitionManager buildDefinitionManager, com.atlassian.event.api.EventPublisher eventPublisher, BranchDetectionService branchDetectionService, VcsRepositoryManager vcsRepositoryManager)
@NotNull public PartialVcsRepositoryData createPlanRepository(@NotNull Plan plan, @NotNull PartialVcsRepositoryData newVcsConfiguration)
VcsRepositoryConfigurationService
createPlanRepository
in interface VcsRepositoryConfigurationService
@NotNull public PartialVcsRepositoryData editRepository(@NotNull Plan plan, long repositoryId, @NotNull PartialVcsRepositoryData newVcsConfiguration)
VcsRepositoryConfigurationService
editRepository
in interface VcsRepositoryConfigurationService
public void setParentOfPlanRepository(@NotNull ImmutablePlan plan, long repositoryId, long parentRepositoryId)
VcsRepositoryConfigurationService
setParentOfPlanRepository
in interface VcsRepositoryConfigurationService
public PartialVcsRepositoryData replaceRepositoryInPlan(@NotNull Plan plan, @NotNull VcsRepositoryData parentRepository, @NotNull PartialVcsRepositoryData oldRepository, @NotNull PartialVcsRepositoryData newRepository)
VcsRepositoryConfigurationService
replaceRepositoryInPlan
in interface VcsRepositoryConfigurationService
@NotNull public PartialVcsRepositoryData linkRepositoryToPlan(@NotNull Plan plan, long selectedRepositoryId)
VcsRepositoryConfigurationService
linkRepositoryToPlan
in interface VcsRepositoryConfigurationService
@NotNull public PartialVcsRepositoryData createLinkedRepository(@NotNull PartialVcsRepositoryData newVcsRepository, @NotNull com.atlassian.user.User user, @NotNull RepositoryConfigurationService.LinkedRepositoryAccess accessOption)
VcsRepositoryConfigurationService
createLinkedRepository
in interface VcsRepositoryConfigurationService
@NotNull public PartialVcsRepositoryData editLinkedRepository(long repositoryId, @NotNull PartialVcsRepositoryData newVcsConfiguration)
VcsRepositoryConfigurationService
editLinkedRepository
in interface VcsRepositoryConfigurationService
public void deleteLinkedRepository(long repositoryId)
VcsRepositoryConfigurationService
deleteLinkedRepository
in interface VcsRepositoryConfigurationService
public boolean validateLinkedRepositoryName(@NotNull String repositoryName, @Nullable BambooIdProvider vcsRepositoryData)
VcsRepositoryConfigurationService
validateLinkedRepositoryName
in interface VcsRepositoryConfigurationService
public boolean validateRepositoryName(@NotNull ImmutablePlan immutablePlan, @NotNull String repositoryName, @Nullable BambooIdProvider repositoryDefinition)
VcsRepositoryConfigurationService
validateRepositoryName
in interface VcsRepositoryConfigurationService
public org.acegisecurity.acls.MutableAcl createNewSharedRepositoryDefaultAcl(@NotNull com.atlassian.user.User user, long repositoryId, RepositoryConfigurationService.LinkedRepositoryAccess accessOption)
user
- to create acl foraccessOption
- MutableAcl
representing a default permission setpublic void deleteRepository(@NotNull Plan plan, long repositoryId, Long replacementRepositoryId)
VcsRepositoryConfigurationService
deleteRepository
in interface VcsRepositoryConfigurationService
replacementRepositoryId
- repository id to replace removed one in tasks depending on itpublic void moveRepository(@NotNull Plan plan, long repositoryId, long beforePosition, long afterPosition) throws IllegalArgumentException, IllegalStateException
VcsRepositoryConfigurationService
moveRepository
in interface VcsRepositoryConfigurationService
repositoryId
- the RepositoryDefinition to movebeforePosition
- position of the RepositoryDefinition that will be before the moving Repository, -1 if the beginning of the listafterPosition
- position of the RepositoryDefinition that will be after the moving Repository, -1 if the end of the listIllegalArgumentException
IllegalStateException
@NotNull protected List<PlanRepositoryLink> getNewRepositoryList(@NotNull List<PlanRepositoryLink> originalRepositories, @NotNull PlanRepositoryLink toMove, long beforeId, long afterId)
public void shareRepository(@NotNull Plan plan, @NotNull PartialVcsRepositoryData repositoryData, @NotNull String repositoryName, @Nullable String userDescription, @NotNull com.atlassian.user.User user)
VcsRepositoryConfigurationService
shareRepository
in interface VcsRepositoryConfigurationService
plan
- plan that owns the repositoryrepositoryData
- repository to sharerepositoryName
- new name of the repositoryuserDescription
- of the repositorypublic boolean validateRestartableStatus(@NotNull ResultsSummary resultSummary)
VcsRepositoryConfigurationService
validateRestartableStatus
in interface VcsRepositoryConfigurationService
public boolean validateContinuableStatus(@NotNull ResultsSummary resultSummary)
VcsRepositoryConfigurationService
validateContinuableStatus
in interface VcsRepositoryConfigurationService
public Map<ImmutableJob,List<TaskDefinition>> getRelevantJobsForRepositoryIdChange(@NotNull ImmutablePlan plan, long repositoryId)
VcsRepositoryConfigurationService
getRelevantJobsForRepositoryIdChange
in interface VcsRepositoryConfigurationService
public PartialVcsRepositoryData convertToNewRepositoryConfiguration(@NotNull PartialVcsRepositoryData vcsRepositoryData)
VcsRepositoryConfigurationService
convertToNewRepositoryConfiguration
in interface VcsRepositoryConfigurationService
public void validateLinkedRepository(@NotNull PartialVcsRepositoryData vcsRepositoryData) throws com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
VcsRepositoryConfigurationService
validateLinkedRepository
in interface VcsRepositoryConfigurationService
vcsRepositoryData
- imported linked repositorycom.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
public PartialVcsRepositoryData mergeLinkedRepository(@NotNull PartialVcsRepositoryData vcsRepositoryData) throws com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
VcsRepositoryConfigurationService
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.
mergeLinkedRepository
in interface VcsRepositoryConfigurationService
vcsRepositoryData
- imported linked repositorycom.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
public void validatePlanRepository(@NotNull Plan plan, @NotNull PartialVcsRepositoryData vcsRepositoryData) throws com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
VcsRepositoryConfigurationService
validatePlanRepository
in interface VcsRepositoryConfigurationService
vcsRepositoryData
- imported plan repositorycom.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
public void mergePlanRepositories(@NotNull Plan plan, @NotNull List<PartialVcsRepositoryData> vcsRepositoryDataList) throws com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
VcsRepositoryConfigurationService
This service will attempt to merge the entities based on ImmutableEntityWithOid.getOid()
, and if there's no
match, based on PartialVcsRepositoryData.getParentId()
}. If an existing entity is found, then it will be updated.
Otherwise, a new database entity will be created. All other repositories in plan will be removed.
mergePlanRepositories
in interface VcsRepositoryConfigurationService
vcsRepositoryDataList
- list of imported plan repositoriescom.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
@NotNull public ErrorCollection configureRssDetection(long repositoryId, PartialVcsRepositoryData vcsRepositoryData, boolean isEnabled)
VcsRepositoryConfigurationService
configureRssDetection
in interface VcsRepositoryConfigurationService
repositoryId
- id of repositoryvcsRepositoryData
- repository configuration, remains unchangedisEnabled
- true if Specs detection should be enabled, false otherwiseCopyright © 2020 Atlassian Software Systems Pty Ltd. All rights reserved.