com.atlassian.bamboo.plan
Class PlanHelper

java.lang.Object
  extended by com.atlassian.bamboo.plan.PlanHelper

public class PlanHelper
extends Object


Method Summary
static ImmutableJob getBranchedImmutableJob(ImmutableChain chainBranch, ImmutableJob masterJob)
          Searches for a corresponding job in a branch.
static Job getBranchedJob(Chain chainBranch, Job masterJob)
           
static ChainStage getBranchedStage(Chain chainBranch, ChainStage masterStage)
           
static
<T> T
getConfigObject(BuildDefinition planDefinition, String key, Class<T> clazz)
           
static
<T> T
getConfigObject(ImmutablePlan plan, String key, Class<T> clazz)
           
static String getCurrentStatus(ImmutablePlan plan)
           
static Repository getDefaultRepository(ImmutablePlan plan)
           
static RepositoryDefinition getDefaultRepositoryDefinition(ImmutablePlan plan)
           
static Set<PlanKey> getMasterAndBranchesKeys(CachedPlanManager cachedPlanManager, PlanKey masterOrBranchKey)
          Get keys of all branches and master plan.
static Chain getMasterPlan(Chain plan)
          Get master plan if plan has master or passed plan otherwise.
static ImmutableChain getMasterPlan(ImmutableChain plan)
          Get master plan if plan has master or passed plan otherwise.
static ImmutablePlan getMasterPlan(ImmutablePlan plan)
          Get master plan if plan has master or passed plan otherwise.
static PlanKey getMasterPlanKey(ImmutablePlan plan)
          Get planKey of master plan if plan has master or planKey of passed plan otherwise.
static long getPermissionPlanId(ImmutablePlan plan)
           
static PlanIdentifier getPlanIdentifierForPermissionChecking(long id, PlanType planType)
           
static List<Repository> getRepositories(ImmutablePlan plan)
           
static RepositoryDefinition getRepositoryDefinitionForPlanById(ImmutablePlan plan, long id)
           
static LinkedHashMap<Long,RepositoryDefinition> getRepositoryDefinitionMap(ImmutablePlan plan)
           
static List<RepositoryDefinition> getRepositoryDefinitions(ImmutablePlan plan)
           
static List<RepositoryDefinition> getRepositoryDefinitionsByType(ImmutablePlan plan, String pluginKey)
           
static boolean hasMultipleBranches(CachedPlanManager cachedPlanManager, PlanKey planKey)
           
static boolean haveTheSameMaster(CachedPlanManager cachedPlanManager, ImmutableChain masterOrBranchA, ImmutableChain masterOrBranchB)
           
static boolean haveTheSameMaster(CachedPlanManager cachedPlanManager, PlanKey masterOrBranchKeyA, PlanKey masterOrBranchKeyB)
           
static boolean isDefault(RepositoryDefinition repositoryDefinition)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRepositories

public static List<Repository> getRepositories(@NotNull
                                               ImmutablePlan plan)

getRepositoryDefinitionMap

@NotNull
public static LinkedHashMap<Long,RepositoryDefinition> getRepositoryDefinitionMap(@NotNull
                                                                                          ImmutablePlan plan)

getRepositoryDefinitions

@NotNull
public static List<RepositoryDefinition> getRepositoryDefinitions(@NotNull
                                                                          ImmutablePlan plan)

getRepositoryDefinitionsByType

@NotNull
public static List<RepositoryDefinition> getRepositoryDefinitionsByType(@NotNull
                                                                                ImmutablePlan plan,
                                                                                @NotNull
                                                                                String pluginKey)

getRepositoryDefinitionForPlanById

public static RepositoryDefinition getRepositoryDefinitionForPlanById(@NotNull
                                                                      ImmutablePlan plan,
                                                                      long id)

getDefaultRepositoryDefinition

@Nullable
public static RepositoryDefinition getDefaultRepositoryDefinition(@NotNull
                                                                           ImmutablePlan plan)

getDefaultRepository

@Nullable
public static Repository getDefaultRepository(@NotNull
                                                       ImmutablePlan plan)

isDefault

public static boolean isDefault(@NotNull
                                RepositoryDefinition repositoryDefinition)

getCurrentStatus

public static String getCurrentStatus(@NotNull
                                      ImmutablePlan plan)

getMasterPlan

@NotNull
public static ImmutablePlan getMasterPlan(@NotNull
                                                  ImmutablePlan plan)
Get master plan if plan has master or passed plan otherwise.

Parameters:
plan -
Returns:

getMasterPlan

@NotNull
public static ImmutableChain getMasterPlan(@NotNull
                                                   ImmutableChain plan)
Get master plan if plan has master or passed plan otherwise.

Parameters:
plan -
Returns:

getMasterPlan

@NotNull
public static Chain getMasterPlan(@NotNull
                                          Chain plan)
Get master plan if plan has master or passed plan otherwise.

Parameters:
plan -
Returns:

getMasterPlanKey

@NotNull
public static PlanKey getMasterPlanKey(@NotNull
                                               ImmutablePlan plan)
Get planKey of master plan if plan has master or planKey of passed plan otherwise.

Parameters:
plan -
Returns:

getBranchedJob

@NotNull
public static Job getBranchedJob(@NotNull
                                         Chain chainBranch,
                                         @NotNull
                                         Job masterJob)

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 searched
masterJob - job which is to be found in a branch
Returns:
ImmutableJob or null if not found

getBranchedStage

@NotNull
public static ChainStage getBranchedStage(Chain chainBranch,
                                                  ChainStage masterStage)

getConfigObject

@Nullable
public static <T> T getConfigObject(@NotNull
                                             ImmutablePlan plan,
                                             @NotNull
                                             String key,
                                             @NotNull
                                             Class<T> clazz)

getConfigObject

@Nullable
public static <T> T getConfigObject(@NotNull
                                             BuildDefinition planDefinition,
                                             @NotNull
                                             String key,
                                             @NotNull
                                             Class<T> clazz)

getPermissionPlanId

public static long getPermissionPlanId(ImmutablePlan plan)

getPlanIdentifierForPermissionChecking

public static PlanIdentifier getPlanIdentifierForPermissionChecking(long id,
                                                                    @NotNull
                                                                    PlanType planType)

getMasterAndBranchesKeys

@NotNull
public static Set<PlanKey> getMasterAndBranchesKeys(@NotNull
                                                            CachedPlanManager cachedPlanManager,
                                                            @NotNull
                                                            PlanKey masterOrBranchKey)
Get keys of all branches and master plan.

Parameters:
cachedPlanManager - cachedPlanManager bean
masterOrBranchKey - key of either master plan or one of the branches in the family
Returns:
set of keys of all branches and master plan

haveTheSameMaster

public static boolean haveTheSameMaster(@NotNull
                                        CachedPlanManager cachedPlanManager,
                                        @NotNull
                                        PlanKey masterOrBranchKeyA,
                                        @NotNull
                                        PlanKey masterOrBranchKeyB)

haveTheSameMaster

public static boolean haveTheSameMaster(@NotNull
                                        CachedPlanManager cachedPlanManager,
                                        @NotNull
                                        ImmutableChain masterOrBranchA,
                                        @NotNull
                                        ImmutableChain masterOrBranchB)

hasMultipleBranches

public static boolean hasMultipleBranches(@NotNull
                                          CachedPlanManager cachedPlanManager,
                                          @NotNull
                                          PlanKey planKey)


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.