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 |
---|---|
int |
getBranchCount(ImmutablePlan plan)
Returns the number of branches the given plan has
|
List<ChainBranch> |
getBranchesForChain(ImmutableChain chain)
Get all feature branches associated with the given chain
|
Collection<Job> |
getBranchesForJob(Job job) |
List<ChainBranchIdentifier> |
getBranchIdentifiersForChain(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.
|
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(ImmutableChain chainBranch,
PlanRepositoryDefinition planRepositoryDefinition)
Handles deletion of a VCS branch from any of the plan branch's repositories.
|
boolean |
hasBranches(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 |
updateNextBranchKeyNumber(ImmutablePlan chain,
long number)
Set suggested number for next branch key in given chain
|
public ChainBranchManagerImpl(PlanDao planDao, com.atlassian.bandana.BandanaManager bandanaManager, VcsBranchManager vcsBranchManager, PlanManager planManager, com.atlassian.event.api.EventPublisher eventPublisher, CustomVariableContext customVariableContext)
@NotNull public List<ChainBranch> getBranchesForChain(@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 List<ChainBranchIdentifier> getBranchIdentifiersForChain(@NotNull PlanIdentifier chain)
ChainBranchManager
getBranchIdentifiersForChain
in interface ChainBranchManager
chain
- - the masterChainBranchIdentifier
for branches associated with the given Chain.public boolean hasBranches(@NotNull Plan plan)
ChainBranchManager
hasBranches
in interface ChainBranchManager
plan
- to check for branches forpublic int getBranchCount(@NotNull ImmutablePlan plan)
ChainBranchManager
getBranchCount
in interface ChainBranchManager
plan
- to check for branches for@NotNull public 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 ImmutableChain chainBranch, @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
Copyright © 2020 Atlassian Software Systems Pty Ltd. All rights reserved.