com.atlassian.bamboo.plan.cache
Class CachedPlanManagerImpl

java.lang.Object
  extended by com.atlassian.bamboo.plan.cache.CachedPlanManagerImpl
All Implemented Interfaces:
CachedPlanManager, FilteringPlanManager

public class CachedPlanManagerImpl
extends java.lang.Object
implements CachedPlanManager, FilteringPlanManager

Author:
Krystian Brazulewicz

Constructor Summary
CachedPlanManagerImpl(ImmutablePlanCacheService immutablePlanCacheService)
           
 
Method Summary
 boolean assertPlanPermission(PlanIdentifier plan)
          Used to validate user permission for plan.
<T extends Plan>
java.util.List<T>
getAllPlansForClone(java.lang.Class<T> planType)
          Returns all Plan's filtered by Class Return list filtered to show only plans the current user is allowed to clone.
 java.util.List<ImmutableChainBranch> getBranchesForChain(PlanIdentifier chain)
          Get all feature branches associated with the given chain
 ImmutablePlan getPlanByKey(PlanKey planKey)
          Returns a ImmutablePlan by its planKey
<T extends ImmutablePlan>
T
getPlanByKey(PlanKey planKey, java.lang.Class<T> planType)
          Returns a ImmutablePlan by its planKey and Class
<T extends ImmutablePlan>
T
getPlanByKeyIfOfType(PlanKey planKey, java.lang.Class<T> planType)
          Returns a Plan by its planKey and if it's of the type Class.
 java.util.List<ImmutableTopLevelPlan> getPlans()
          Returns all TopLevelPlan's.
<T extends ImmutablePlan>
java.util.List<T>
getPlans(java.lang.Class<T> planType)
          Returns all Plan's filtered by Class.
<T extends ImmutablePlan>
java.util.List<T>
getPlans(java.lang.Class<T> planType, com.google.common.base.Predicate<? super T> filter)
          Returns all Plan's filtered by Class.
 java.util.List<ImmutableTopLevelPlan> getPlansByProject(Project project)
          Returns all ImmutableTopLevelPlan's filtered by Project.
<T extends ImmutablePlan>
java.util.List<T>
getPlansByProject(Project project, java.lang.Class<T> planType)
          Returns all Plan's filtered by Project and Class.
<T extends ImmutablePlan>
java.util.List<T>
getPlansByProject(Project project, java.lang.Class<T> planType, com.google.common.base.Predicate<? super T> filter)
           
 java.util.List<ImmutableChain> getPlansForClone()
          Returns all Chain's.
 java.util.List<ImmutableTopLevelPlan> getPlansUnrestricted()
          Returns all ImmutableTopLevelPlan's ignoring permissions.
<T extends ImmutablePlan>
java.util.List<T>
getRunnablePlans(Project project, java.lang.Class<T> planType)
          Returns all Plan's filtered by Project and Class.
<T extends Plan>
java.util.List<T>
getRunnablePlansByProject(Project project, java.lang.Class<T> planType)
          Returns all Plan's filtered by Project and Class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedPlanManagerImpl

public CachedPlanManagerImpl(ImmutablePlanCacheService immutablePlanCacheService)
Method Detail

getPlanByKey

public ImmutablePlan getPlanByKey(@NotNull
                                  PlanKey planKey)
Description copied from interface: CachedPlanManager
Returns a ImmutablePlan by its planKey

Specified by:
getPlanByKey in interface CachedPlanManager
Parameters:
planKey - to search for
Returns:
plan with the given plan key or null if not found

getPlanByKey

@Nullable
public <T extends ImmutablePlan> T getPlanByKey(@NotNull
                                                         PlanKey planKey,
                                                         java.lang.Class<T> planType)
                                     throws IncorrectPlanTypeException
Description copied from interface: CachedPlanManager
Returns a ImmutablePlan by its planKey and Class

Specified by:
getPlanByKey in interface CachedPlanManager
Parameters:
planKey - to search for
planType - - the type of the plan to retrieve
Returns:
plan with the given plan key, if found AND is of the correct type.
Throws:
IncorrectPlanTypeException - if plan cannot be found with the correct type

getPlanByKeyIfOfType

@Nullable
public <T extends ImmutablePlan> T getPlanByKeyIfOfType(@NotNull
                                                                 PlanKey planKey,
                                                                 @NotNull
                                                                 java.lang.Class<T> planType)
Description copied from interface: CachedPlanManager
Returns a Plan by its planKey and if it's of the type Class. Does not throw IncorrectPlanTypeException. Should only be used when the type of the plan can not be known.

Specified by:
getPlanByKeyIfOfType in interface CachedPlanManager
Returns:
null if the plan doesn't exist, or it's not of the found type

getPlans

@NotNull
public java.util.List<ImmutableTopLevelPlan> getPlans()
Description copied from interface: CachedPlanManager
Returns all TopLevelPlan's. This method is Acegi-filtered.

Specified by:
getPlans in interface CachedPlanManager
Returns:
plans

getPlansUnrestricted

@NotNull
public java.util.List<ImmutableTopLevelPlan> getPlansUnrestricted()
Description copied from interface: CachedPlanManager
Returns all ImmutableTopLevelPlan's ignoring permissions.

Specified by:
getPlansUnrestricted in interface CachedPlanManager
Returns:

getPlans

@NotNull
public <T extends ImmutablePlan> java.util.List<T> getPlans(java.lang.Class<T> planType)
Description copied from interface: CachedPlanManager
Returns all Plan's filtered by Class. Does not include plans marked for deletion. This method is Acegi-filtered.

Specified by:
getPlans in interface CachedPlanManager
Parameters:
planType - - the type of the plan to retrieve
Returns:
plans sorted by DescriptionProvider.getName()

getPlans

@NotNull
public <T extends ImmutablePlan> java.util.List<T> getPlans(java.lang.Class<T> planType,
                                                                    @NotNull
                                                                    com.google.common.base.Predicate<? super T> filter)
Description copied from interface: CachedPlanManager
Returns all Plan's filtered by Class. Does not include plans marked for deletion. This method is Acegi-filtered.

Specified by:
getPlans in interface CachedPlanManager
Parameters:
planType - - the type of the plan to retrieve
Returns:
plans sorted by DescriptionProvider.getName()

getPlansByProject

@NotNull
public java.util.List<ImmutableTopLevelPlan> getPlansByProject(Project project)
Description copied from interface: CachedPlanManager
Returns all ImmutableTopLevelPlan's filtered by Project. This method is Acegi-filtered.

Specified by:
getPlansByProject in interface CachedPlanManager
Parameters:
project - - that the plans will belong to
Returns:
ImmutableTopLevelPlan plans contained within the given project

getPlansByProject

@NotNull
public <T extends ImmutablePlan> java.util.List<T> getPlansByProject(Project project,
                                                                             java.lang.Class<T> planType)
Description copied from interface: CachedPlanManager
Returns all Plan's filtered by Project and Class. This method is Acegi-filtered.

Specified by:
getPlansByProject in interface CachedPlanManager
Parameters:
project - - that the plans will belong to
planType - - the type of the plan to retrieve
Returns:
plans contained within the given project and of the given type

getPlansByProject

public <T extends ImmutablePlan> java.util.List<T> getPlansByProject(@NotNull
                                                                     Project project,
                                                                     @NotNull
                                                                     java.lang.Class<T> planType,
                                                                     @NotNull
                                                                     com.google.common.base.Predicate<? super T> filter)
Specified by:
getPlansByProject in interface CachedPlanManager

getBranchesForChain

@NotNull
public java.util.List<ImmutableChainBranch> getBranchesForChain(@NotNull
                                                                        PlanIdentifier chain)
Description copied from interface: CachedPlanManager
Get all feature branches associated with the given chain

Specified by:
getBranchesForChain in interface CachedPlanManager
Parameters:
chain - - the master
Returns:
List ChainBranchs associated with the given chain.

assertPlanPermission

public boolean assertPlanPermission(@NotNull
                                    PlanIdentifier plan)
Description copied from interface: CachedPlanManager
Used to validate user permission for plan. This method is Acegi-filtered.

Specified by:
assertPlanPermission in interface CachedPlanManager
Parameters:
plan - to check the permissions of
Returns:
true if the current user has read(?) permissions on the plan

getPlansForClone

@NotNull
public java.util.List<ImmutableChain> getPlansForClone()
Description copied from interface: FilteringPlanManager
Returns all Chain's. Return list filtered to show only plans the current user is allowed to clone.

Specified by:
getPlansForClone in interface FilteringPlanManager
Returns:
plans

getAllPlansForClone

@NotNull
public <T extends Plan> java.util.List<T> getAllPlansForClone(java.lang.Class<T> planType)
Description copied from interface: FilteringPlanManager
Returns all Plan's filtered by Class Return list filtered to show only plans the current user is allowed to clone.

Specified by:
getAllPlansForClone in interface FilteringPlanManager
Parameters:
planType - the class type of the plans you want returned
Returns:
plans

getRunnablePlans

@NotNull
public <T extends ImmutablePlan> java.util.List<T> getRunnablePlans(@NotNull
                                                                            Project project,
                                                                            @NotNull
                                                                            java.lang.Class<T> planType)
Description copied from interface: FilteringPlanManager
Returns all Plan's filtered by Project and Class. Only plans runnable by user will be returned.

Specified by:
getRunnablePlans in interface FilteringPlanManager
Parameters:
project - - that the plans will belong to
planType - - the type of the plan to retrieve
Returns:
plans contained within the given project and of the given type

getRunnablePlansByProject

@NotNull
public <T extends Plan> java.util.List<T> getRunnablePlansByProject(Project project,
                                                                            java.lang.Class<T> planType)
Description copied from interface: FilteringPlanManager
Returns all Plan's filtered by Project and Class. Only plans runnable by user will be returned.

Specified by:
getRunnablePlansByProject in interface FilteringPlanManager
Parameters:
project - - that the plans will belong to
planType - - the type of the plan to retrieve
Returns:
plans contained within the given project and of the given type


Copyright © 2013 Atlassian Software Systems Pty Ltd. All Rights Reserved.