public class ChainBranchManagerImpl extends Object implements ChainBranchManager
Constructor and Description |
---|
ChainBranchManagerImpl(PlanDao planDao,
com.atlassian.bandana.BandanaManager bandanaManager,
VcsBranchManager vcsBranchManager,
PlanManager planManager,
com.atlassian.event.api.EventPublisher eventPublisher,
CustomVariableContext customVariableContext) |
Modifier and Type | Method and Description |
---|---|
void |
clearInvalidMetadataFlagInBranches(long masterId)
Clears 'invalid' flag in all branches of a chain.
|
int |
getBranchCount(@NotNull ImmutablePlan plan)
Returns the number of branches the given plan has
|
@NotNull List<ChainBranch> |
getBranchesForChain(@NotNull ImmutableChain chain)
Get all feature branches associated with the given chain
|
Collection<Job> |
getBranchesForJob(Job job) |
@NotNull List<ChainBranchIdentifier> |
getBranchIdentifiersForChain(@NotNull PlanIdentifier chain)
Get all feature branches associated with the given chain, however on pulls up
minimal details about each branch.
|
ChainBranchIdentifier |
getBranchWithName(ImmutableChain masterPlan,
String branchName)
|
long |
getNextBranchKeyNumber(ImmutablePlan chain)
Retrieving suggested number for next branch key in given chain.
|
@NotNull Set<Long> |
getPlansWithBranches()
Returns a list of plans that currently have branches
|
void |
handleVcsBranchDeletedOfPlanBranch(ImmutableChain chainBranch)
Handles deletion of a VCS branch from plan branch's default repository.
|
void |
handleVcsBranchDeletedOfPlanBranch(@NotNull ImmutableChain chainBranch,
@NotNull PlanRepositoryDefinition planRepositoryDefinition)
Handles deletion of a VCS branch from any of the plan branch's repositories.
|
boolean |
hasBranches(@NotNull Plan plan)
Returns whether or not the given plan has any branches
|
boolean |
isPlanBranchNameConflicting(ImmutableChain masterPlan,
long planIdToIgnore,
String branchName)
Verifies whether a
ChainBranch name is unique with a given master Chain |
void |
markMetadataInvalid(@NotNull PlanKey branchKey)
Marks the chain as 'invalid', which means metadata no longer match vcs data.
|
void |
updateNextBranchKeyNumber(ImmutablePlan chain,
long number)
Set suggested number for next branch key in given chain
|
void |
updatePlanBranchMetadata(@NotNull PlanKey branchKey)
Update plan branch metadata to reflect the current state of chain.
|
public ChainBranchManagerImpl(PlanDao planDao, com.atlassian.bandana.BandanaManager bandanaManager, VcsBranchManager vcsBranchManager, PlanManager planManager, com.atlassian.event.api.EventPublisher eventPublisher, CustomVariableContext customVariableContext)
@NotNull public @NotNull List<ChainBranch> getBranchesForChain(@NotNull @NotNull ImmutableChain chain)
ChainBranchManager
getBranchesForChain
in interface ChainBranchManager
chain
- - the masterChainBranch
s associated with the given chain.public Collection<Job> getBranchesForJob(Job job)
getBranchesForJob
in interface ChainBranchManager
@NotNull public @NotNull List<ChainBranchIdentifier> getBranchIdentifiersForChain(@NotNull @NotNull PlanIdentifier chain)
ChainBranchManager
getBranchIdentifiersForChain
in interface ChainBranchManager
chain
- - the masterChainBranchIdentifier
for branches associated with the given Chain.public boolean hasBranches(@NotNull @NotNull Plan plan)
ChainBranchManager
hasBranches
in interface ChainBranchManager
plan
- to check for branches forpublic int getBranchCount(@NotNull @NotNull ImmutablePlan plan)
ChainBranchManager
getBranchCount
in interface ChainBranchManager
plan
- to check for branches for@NotNull public @NotNull Set<Long> getPlansWithBranches()
ChainBranchManager
getPlansWithBranches
in interface ChainBranchManager
public boolean isPlanBranchNameConflicting(ImmutableChain masterPlan, long planIdToIgnore, String branchName)
ChainBranchManager
ChainBranch
name is unique with a given master Chain
isPlanBranchNameConflicting
in interface ChainBranchManager
masterPlan
- the master chain within which the name has to be uniqueplanIdToIgnore
- the id of the ChainBranch that has to be ignored during lookup (when you're saving a ChainBranch, you should supply its id here)branchName
- displayed name of the ChainBranch inside the master's planpublic ChainBranchIdentifier getBranchWithName(ImmutableChain masterPlan, String branchName)
ChainBranchManager
getBranchWithName
in interface ChainBranchManager
ChainBranchIdentifier
or null if no such branch existspublic void handleVcsBranchDeletedOfPlanBranch(ImmutableChain chainBranch)
ChainBranchManager
handleVcsBranchDeletedOfPlanBranch
in interface ChainBranchManager
chainBranch
- the plan branch of which a default VCS branch was deletedpublic void handleVcsBranchDeletedOfPlanBranch(@NotNull @NotNull ImmutableChain chainBranch, @NotNull @NotNull PlanRepositoryDefinition planRepositoryDefinition)
ChainBranchManager
handleVcsBranchDeletedOfPlanBranch
in interface ChainBranchManager
chainBranch
- the plan branch of which a VCS branch was deletedplanRepositoryDefinition
- plan repository whose branch was deletedpublic long getNextBranchKeyNumber(ImmutablePlan chain)
ChainBranchManager
getNextBranchKeyNumber
in interface ChainBranchManager
public void updateNextBranchKeyNumber(ImmutablePlan chain, long number)
ChainBranchManager
updateNextBranchKeyNumber
in interface ChainBranchManager
public void clearInvalidMetadataFlagInBranches(long masterId)
ChainBranchManager
clearInvalidMetadataFlagInBranches
in interface ChainBranchManager
public void updatePlanBranchMetadata(@NotNull @NotNull PlanKey branchKey)
ChainBranchManager
updatePlanBranchMetadata
in interface ChainBranchManager
public void markMetadataInvalid(@NotNull @NotNull PlanKey branchKey)
ChainBranchManager
markMetadataInvalid
in interface ChainBranchManager
Copyright © 2022 Atlassian Software Systems Pty Ltd. All rights reserved.