public class CachedPlanManagerImpl extends Object implements CachedPlanManager, FilteringPlanManager
Constructor and Description |
---|
CachedPlanManagerImpl() |
Modifier and Type | Method and Description |
---|---|
boolean |
assertPlanPermission(PlanIdentifier plan)
Used to validate user permission for plan.
|
Set<Project> |
getAllProjectsWithPlan()
Returns all projects which have at least one plan (plan is in the cache)
|
Optional<ImmutableChain> |
getAnyPlan(Predicate<? super ImmutableChain> predicate)
Returns a plan matching the supplied predicate, permission filtering is applied.
|
Optional<ImmutableChain> |
getAnyPlanUnrestricted(Predicate<? super ImmutableChain> predicate)
Returns a plan matching the supplied predicate.
|
List<ImmutableChainBranch> |
getBranchesForChain(PlanIdentifier chain)
Get all feature branches associated with the given chain, sorted
|
Stream<ImmutableChainBranch> |
getBranchesOfChain(PlanKey chainKey)
Get all feature branches associated with the given chain, unsorted
|
Set<PlanBranchGist> |
getBranchGistsOfChain(PlanKey chainKey)
Returns basic data of all branches for the supplied chain.
|
Set<PlanKey> |
getBranchKeysOfChain(PlanKey chainKey)
Returns keys of all branches for the supplied chain.
|
Iterable<ImmutableTopLevelPlan> |
getEditablePlansByProject(Project project)
|
Stream<ImmutableChain> |
getFilteredPlansWithRepository(PlanRepositoryIndex.Query query)
Returns chains that use repositories with given params
|
ImmutableJob |
getMasterOfJob(PlanKey masterChainKey,
PlanKey jobKey) |
ImmutableChain |
getMasterPlan(PlanKey branchKey)
Returns master branch for a given branchKey.
|
<T extends ImmutablePlan> |
getPlanById(long id,
Class<T> planType)
Returns a
ImmutablePlan by its database id and Class |
<T extends ImmutablePlan> |
getPlanByIdNotThrowing(long id,
Class<T> planType)
Returns a
ImmutablePlan by its database id and Class . |
ImmutablePlan |
getPlanByKey(PlanKey planKey)
Returns a
ImmutablePlan by its planKey |
<T extends ImmutablePlan> |
getPlanByKey(PlanKey planKey,
Class<T> planType)
Returns a
ImmutablePlan by its planKey and Class |
<T extends ImmutablePlan> |
getPlanByKeyIfOfType(PlanKey planKey,
Class<T> planType)
|
List<ImmutableTopLevelPlan> |
getPlans()
Returns all
TopLevelPlan 's. |
<T extends ImmutablePlan> |
getPlans(Class<T> planType)
|
<T extends ImmutablePlan> |
getPlans(Class<T> planType,
com.google.common.base.Predicate<? super T> filter)
|
List<ImmutableTopLevelPlan> |
getPlansByProject(Project project)
Returns all
ImmutableTopLevelPlan 's filtered by Project . |
<T extends ImmutablePlan> |
getPlansByProject(Project project,
Class<T> planType)
|
<T extends ImmutablePlan> |
getPlansByProject(Project project,
Class<T> planType,
com.google.common.base.Predicate<? super T> filter) |
List<ImmutableChain> |
getPlansForClone()
Returns all
Chain 's. |
List<ImmutableTopLevelPlan> |
getPlansUnrestricted()
Returns all
ImmutableTopLevelPlan 's ignoring permissions. |
Iterable<ImmutableChain> |
getPlansWithRepository(PlanRepositoryIndex.Query query)
Returns chains that use repositories with given params
|
<T extends ImmutablePlan> |
getRunnablePlans(Project project,
Class<T> planType)
|
boolean |
isBranchOf(PlanKey chainKey,
PlanKey branchKey)
Test if plan identified by branchKey is a branch of plan identified by chainKey.
|
@Nullable public ImmutablePlan getPlanByKey(@NotNull PlanKey planKey)
CachedPlanManager
ImmutablePlan
by its planKeygetPlanByKey
in interface CachedPlanManager
planKey
- to search for@Nullable public <T extends ImmutablePlan> T getPlanByKey(@NotNull PlanKey planKey, Class<T> planType) throws IncorrectPlanTypeException
CachedPlanManager
ImmutablePlan
by its planKey and Class
getPlanByKey
in interface CachedPlanManager
planKey
- to search forplanType
- - the type of the plan to retrieveIncorrectPlanTypeException
- if plan cannot be found with the correct type@Nullable public <T extends ImmutablePlan> T getPlanByKeyIfOfType(@NotNull PlanKey planKey, @NotNull Class<T> planType)
CachedPlanManager
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.getPlanByKeyIfOfType
in interface CachedPlanManager
@NotNull public List<ImmutableTopLevelPlan> getPlans()
FilteringPlanManager
TopLevelPlan
's.
This method is Acegi-filtered.getPlans
in interface FilteringPlanManager
@NotNull public List<ImmutableTopLevelPlan> getPlansUnrestricted()
CachedPlanManager
ImmutableTopLevelPlan
's ignoring permissions.getPlansUnrestricted
in interface CachedPlanManager
@NotNull public <T extends ImmutablePlan> List<T> getPlans(Class<T> planType)
FilteringPlanManager
Plan
's filtered by Class
. Does not include plans marked for deletion.
This method is Acegi-filtered.getPlans
in interface FilteringPlanManager
planType
- - the type of the plan to retrieveDescriptionProvider.getName()
@NotNull public <T extends ImmutablePlan> List<T> getPlans(Class<T> planType, @NotNull com.google.common.base.Predicate<? super T> filter)
FilteringPlanManager
Plan
's filtered by Class
. Does not include plans marked for deletion.
This method is Acegi-filtered.getPlans
in interface FilteringPlanManager
planType
- - the type of the plan to retrieveDescriptionProvider.getName()
@NotNull public List<ImmutableTopLevelPlan> getPlansByProject(Project project)
FilteringPlanManager
ImmutableTopLevelPlan
's filtered by Project
.
This method is Acegi-filtered.getPlansByProject
in interface FilteringPlanManager
project
- - that the plans will belong toImmutableTopLevelPlan
plans contained within the given project@NotNull public Iterable<ImmutableTopLevelPlan> getEditablePlansByProject(Project project)
FilteringPlanManager
Plan
's filtered by Project
and user can edit (EDIT permission assigned for plan to user)getEditablePlansByProject
in interface FilteringPlanManager
project
- - that the plans will belong to@NotNull public <T extends ImmutablePlan> List<T> getPlansByProject(Project project, Class<T> planType)
FilteringPlanManager
getPlansByProject
in interface FilteringPlanManager
project
- - that the plans will belong toplanType
- - the type of the plan to retrievepublic <T extends ImmutablePlan> List<T> getPlansByProject(@NotNull Project project, @NotNull Class<T> planType, @NotNull com.google.common.base.Predicate<? super T> filter)
getPlansByProject
in interface FilteringPlanManager
@NotNull public List<ImmutableChainBranch> getBranchesForChain(@NotNull PlanIdentifier chain)
FilteringPlanManager
getBranchesForChain
in interface FilteringPlanManager
chain
- - the masterChainBranch
s associated with the given chain.@NotNull public Stream<ImmutableChainBranch> getBranchesOfChain(@NotNull PlanKey chainKey)
FilteringPlanManager
getBranchesOfChain
in interface FilteringPlanManager
chainKey
- - the masterChainBranch
s associated with the given chain.@NotNull public Set<PlanKey> getBranchKeysOfChain(@NotNull PlanKey chainKey)
CachedPlanManager
getBranchKeysOfChain
in interface CachedPlanManager
@NotNull public Set<PlanBranchGist> getBranchGistsOfChain(@NotNull PlanKey chainKey)
CachedPlanManager
getBranchGistsOfChain
in interface CachedPlanManager
@Nullable public ImmutableChain getMasterPlan(@NotNull PlanKey branchKey)
CachedPlanManager
getMasterPlan
in interface CachedPlanManager
branchKey
- key of a branchpublic boolean isBranchOf(@NotNull PlanKey chainKey, @NotNull PlanKey branchKey)
CachedPlanManager
isBranchOf
in interface CachedPlanManager
chainKey
- key of master branchbranchKey
- key of alleged branchpublic boolean assertPlanPermission(@NotNull PlanIdentifier plan)
FilteringPlanManager
assertPlanPermission
in interface FilteringPlanManager
plan
- to check the permissions of@NotNull public List<ImmutableChain> getPlansForClone()
FilteringPlanManager
Chain
's. Return list filtered to show only plans the current user is allowed to clone.getPlansForClone
in interface FilteringPlanManager
@NotNull public <T extends ImmutablePlan> List<T> getRunnablePlans(@NotNull Project project, @NotNull Class<T> planType)
FilteringPlanManager
getRunnablePlans
in interface FilteringPlanManager
project
- - that the plans will belong toplanType
- - the type of the plan to retrieve@Nullable public ImmutableJob getMasterOfJob(@NotNull PlanKey masterChainKey, @NotNull PlanKey jobKey)
getMasterOfJob
in interface CachedPlanManager
public Iterable<ImmutableChain> getPlansWithRepository(@NotNull PlanRepositoryIndex.Query query)
CachedPlanManager
getPlansWithRepository
in interface CachedPlanManager
public Stream<ImmutableChain> getFilteredPlansWithRepository(@NotNull PlanRepositoryIndex.Query query)
FilteringPlanManager
getFilteredPlansWithRepository
in interface FilteringPlanManager
public Optional<ImmutableChain> getAnyPlan(Predicate<? super ImmutableChain> predicate)
CachedPlanManager
getAnyPlan
in interface CachedPlanManager
getAnyPlan
in interface FilteringPlanManager
public Optional<ImmutableChain> getAnyPlanUnrestricted(Predicate<? super ImmutableChain> predicate)
CachedPlanManager
getAnyPlanUnrestricted
in interface CachedPlanManager
@Nullable public <T extends ImmutablePlan> T getPlanById(long id, Class<T> planType)
CachedPlanManager
ImmutablePlan
by its database id and Class
getPlanById
in interface CachedPlanManager
id
- to search forplanType
- - the type of the plan to retrieve@Nullable public <T extends ImmutablePlan> T getPlanByIdNotThrowing(long id, Class<T> planType)
CachedPlanManager
ImmutablePlan
by its database id and Class
.
This method does not throw exception if plan is not found.getPlanByIdNotThrowing
in interface CachedPlanManager
id
- to search forplanType
- - the type of the plan to retrievepublic Set<Project> getAllProjectsWithPlan()
CachedPlanManager
getAllProjectsWithPlan
in interface CachedPlanManager
Copyright © 2020 Atlassian Software Systems Pty Ltd. All rights reserved.