Package com.atlassian.bamboo.plan
Class PlanHelper
java.lang.Object
com.atlassian.bamboo.plan.PlanHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic Predicate<ImmutableChain> defaultRepositoryAsRootPredicate(long repositoryId) Passes chains when the default plan repository definition points to root definition with given idstatic Predicate<ImmutableChain> defaultRepositoryPredicate(long repositoryId) Passes chains when the default plan repository definition points to definition with given idstatic ImmutableJobgetBranchedImmutableJob(ImmutableChain chainBranch, ImmutableJob masterJob) Searches for a corresponding job in a branch.static @NotNull ImmutableChainStagegetBranchedStage(ImmutableChain chainBranch, ImmutableChainStage masterStage) static Stream<ImmutableJob> getBranchesForJob(@NotNull CachedPlanManager cachedPlanManager, @NotNull ImmutableJob masterJob) static <T> TgetConfigObject(@NotNull BuildDefinition planDefinition, @NotNull String key, @NotNull Class<T> clazz) static <T> TgetConfigObject(@NotNull ImmutablePlan plan, @NotNull String key, @NotNull Class<T> clazz) static StringgetCurrentStatus(@NotNull ImmutablePlan plan) static @Nullable PlanRepositoryDefinitiongetDefaultPlanRepositoryDefinition(@NotNull ImmutablePlan plan) getMasterAndBranchesKeys(@NotNull CachedPlanManager cachedPlanManager, @NotNull PlanKey masterOrBranchKey) Get keys of all branches and master plan.static @NotNull ChaingetMasterPlan(@NotNull Chain plan) Get master plan if plan has master or passed plan otherwise.static @NotNull ImmutableChaingetMasterPlan(@NotNull ImmutableChain plan) Get master plan if plan has master or passed plan otherwise.static @NotNull ImmutablePlangetMasterPlan(@NotNull ImmutablePlan plan) Get master plan if plan has master or passed plan otherwise.static @NotNull PlanKeygetMasterPlanKey(@NotNull ImmutablePlan plan) Get planKey of master plan if plan has master or planKey of passed plan otherwise.static longgetPlanKeysOfBranchesSharingConfiguration(@NotNull CachedPlanManager cachedPlanManager, @NotNull PlanKey masterOrBranchKey) Get keys of all branches (including master plan if applicable) that share the configuration.static PlanRepositoryDefinitiongetPlanRepositoryDefinitionById(@NotNull ImmutablePlan plan, long id) static @NotNull LinkedHashMap<Long, PlanRepositoryDefinition> getPlanRepositoryDefinitionMap(@NotNull ImmutablePlan plan) static List<PlanRepositoryDefinition> getPlanRepositoryDefinitions(@NotNull ImmutablePlan plan) static List<PlanRepositoryDefinition> getPlanRepositoryDefinitionsByType(@NotNull ImmutablePlan plan, @NotNull String pluginKey) static booleanhasMultipleBranches(@NotNull CachedPlanManager cachedPlanManager, @NotNull PlanKey planKey) static booleanhaveTheSameMaster(@NotNull CachedPlanManager cachedPlanManager, @NotNull PlanKey masterOrBranchKeyA, @NotNull PlanKey masterOrBranchKeyB) static booleanhaveTheSameMaster(@NotNull ImmutableChain masterOrBranchA, @NotNull ImmutableChain masterOrBranchB) static booleanisDefault(@NotNull PlanRepositoryDefinition repositoryDefinition) static booleanisDivergentBranch(@NotNull ImmutableChain chain) static booleanisDivergentBranch(@NotNull ImmutablePlan plan)
-
Method Details
-
isDivergentBranch
- Returns:
- true if plan is a plan branch of a job of a plan branch and plan branch is divergent
-
isDivergentBranch
- Returns:
- true if plan is a plan branch of a job of a plan branch and plan branch is divergent
-
getPlanRepositoryDefinitionMap
@NotNull public static @NotNull LinkedHashMap<Long,PlanRepositoryDefinition> getPlanRepositoryDefinitionMap(@NotNull @NotNull ImmutablePlan plan) -
getPlanRepositoryDefinitions
public static List<PlanRepositoryDefinition> getPlanRepositoryDefinitions(@NotNull @NotNull ImmutablePlan plan) -
getPlanRepositoryDefinitionsByType
public static List<PlanRepositoryDefinition> getPlanRepositoryDefinitionsByType(@NotNull @NotNull ImmutablePlan plan, @NotNull @NotNull String pluginKey) -
getPlanRepositoryDefinitionById
public static PlanRepositoryDefinition getPlanRepositoryDefinitionById(@NotNull @NotNull ImmutablePlan plan, long id) -
getDefaultPlanRepositoryDefinition
@Nullable public static @Nullable PlanRepositoryDefinition getDefaultPlanRepositoryDefinition(@NotNull @NotNull ImmutablePlan plan) -
isDefault
-
getCurrentStatus
-
getMasterPlan
Get master plan if plan has master or passed plan otherwise.- Parameters:
plan-- Returns:
-
getMasterPlan
Get master plan if plan has master or passed plan otherwise.- Parameters:
plan-- Returns:
-
getMasterPlan
Get master plan if plan has master or passed plan otherwise.- Parameters:
plan-- Returns:
-
getMasterPlanKey
Get planKey of master plan if plan has master or planKey of passed plan otherwise.- Parameters:
plan-- Returns:
-
getBranchedImmutableJob
public static ImmutableJob getBranchedImmutableJob(ImmutableChain chainBranch, ImmutableJob masterJob) Searches for a corresponding job in a branch.- Parameters:
chainBranch- branch where job has to be searchedmasterJob- job which is to be found in a branch- Returns:
ImmutableJobor null if not found
-
getBranchedStage
@NotNull public static @NotNull ImmutableChainStage getBranchedStage(ImmutableChain chainBranch, ImmutableChainStage masterStage) -
getConfigObject
@Nullable public static <T> T getConfigObject(@NotNull @NotNull ImmutablePlan plan, @NotNull @NotNull String key, @NotNull @NotNull Class<T> clazz) -
getConfigObject
@Nullable public static <T> T getConfigObject(@NotNull @NotNull BuildDefinition planDefinition, @NotNull @NotNull String key, @NotNull @NotNull Class<T> clazz) -
getPermissionPlanId
-
getMasterAndBranchesKeys
@NotNull public static @NotNull Set<PlanKey> getMasterAndBranchesKeys(@NotNull @NotNull CachedPlanManager cachedPlanManager, @NotNull @NotNull PlanKey masterOrBranchKey) Get keys of all branches and master plan.- Parameters:
cachedPlanManager- cachedPlanManager beanmasterOrBranchKey- key of either master plan or one of the branches in the family- Returns:
- set of keys of all branches and master plan
-
getPlanKeysOfBranchesSharingConfiguration
@NotNull public static @NotNull Set<PlanKey> getPlanKeysOfBranchesSharingConfiguration(@NotNull @NotNull CachedPlanManager cachedPlanManager, @NotNull @NotNull PlanKey masterOrBranchKey) Get keys of all branches (including master plan if applicable) that share the configuration. If the argumanet is a key of a master plan or any lightweight branch, the returned list contains key of the master plan and keys of all its lightweight branches. If the argument is a key of a divergent branch, the list containing that key only is returned.- Parameters:
cachedPlanManager- cachedPlanManager beanmasterOrBranchKey- key of either master plan or one of the branches in the family- Returns:
- set of keys of all lightweight branches and master plan
-
getBranchesForJob
public static Stream<ImmutableJob> getBranchesForJob(@NotNull @NotNull CachedPlanManager cachedPlanManager, @NotNull @NotNull ImmutableJob masterJob) -
haveTheSameMaster
public static boolean haveTheSameMaster(@NotNull @NotNull CachedPlanManager cachedPlanManager, @NotNull @NotNull PlanKey masterOrBranchKeyA, @NotNull @NotNull PlanKey masterOrBranchKeyB) -
haveTheSameMaster
public static boolean haveTheSameMaster(@NotNull @NotNull ImmutableChain masterOrBranchA, @NotNull @NotNull ImmutableChain masterOrBranchB) -
hasMultipleBranches
public static boolean hasMultipleBranches(@NotNull @NotNull CachedPlanManager cachedPlanManager, @NotNull @NotNull PlanKey planKey) -
defaultRepositoryAsRootPredicate
Passes chains when the default plan repository definition points to root definition with given id -
defaultRepositoryPredicate
Passes chains when the default plan repository definition points to definition with given id
-