Package com.atlassian.bamboo.plan.cache
Interface CachedPlanManager
- All Superinterfaces:
FilteringPlanManager
- All Known Implementing Classes:
CachedPlanManagerImpl
Provides access to immutable, centrally cached plans.
If the method does not contain `...WithConsistencyGuarantee` in its name, then it does not guarantee that
the data is up-to-date a.k.a. highly consistent in the cluster mode.
-
Method Summary
Modifier and TypeMethodDescription@NotNull Optional<ImmutableChain>
findPotentialMasterPlanByKey
(@NotNull PlanKey branchKey) Finds a potential master plan by progressively shortening the plan key.Returns all projects which have at least one plan (plan is in the cache)getAnyPlan
(Predicate<? super ImmutableChain> predicate) Returns a plan matching the supplied predicate, permission filtering is applied.getAnyPlanUnrestricted
(Predicate<? super ImmutableChain> predicate) Returns a plan matching the supplied predicate.@NotNull Set<PlanBranchGist>
getBranchGistsOfChain
(@NotNull PlanKey chainKey) Returns basic data of all branches for the supplied chain.@NotNull Set<PlanBranchGist>
getBranchGistsOfChainWithConsistencyGuarantee
(@NotNull PlanKey chainKey) Returns basic data of all branches for the supplied chain with guarantee that eventual new plan branches not present in the cache will be taken in consideration.getBranchKeysOfChain
(@NotNull PlanKey chainKey) Returns keys of all branches for the supplied chain.@Nullable ImmutableJob
getMasterOfJob
(@NotNull PlanKey masterChainKey, @NotNull PlanKey jobKey) @Nullable ImmutableChain
getMasterPlan
(@NotNull PlanKey branchKey) Returns master branch for a given branchKey.<T extends ImmutablePlan>
TgetPlanById
(long id, Class<T> planType) Returns aImmutablePlan
by its database id andClass
<T extends ImmutablePlan>
TgetPlanByIdNotThrowing
(long id, Class<T> planType) Returns aImmutablePlan
by its database id andClass
.<T extends ImmutablePlan>
TgetPlanByIdNotThrowingWithConsistencyGuarantee
(long id, Class<T> planType) Returns aImmutablePlan
by its database id andClass
.@Nullable ImmutablePlan
getPlanByKey
(@NotNull PlanKey planKey) Returns aImmutablePlan
by its planKey.<T extends ImmutablePlan>
TgetPlanByKey
(@NotNull PlanKey planKey, Class<T> planType) Returns aImmutablePlan
by its planKey andClass
.<T extends ImmutablePlan>
TgetPlanByKeyIfOfType
(@NotNull PlanKey planKey, @NotNull Class<T> planType) <T extends ImmutablePlan>
TgetPlanByKeyIfOfTypeWithConsistencyGuarantee
(@NotNull PlanKey planKey, @NotNull Class<T> planType) @Nullable ImmutablePlan
getPlanByKeyWithConsistencyGuarantee
(@NotNull PlanKey planKey) Returns aImmutablePlan
by its planKey.<T extends ImmutablePlan>
TgetPlanByKeyWithConsistencyGuarantee
(@NotNull PlanKey planKey, Class<T> planType) Returns aImmutablePlan
by its planKey andClass
.@NotNull List<ImmutableChain>
getPlansByProjectUnrestricted
(Project project) Returns allImmutableChain
's filtered byProject
ignoring permissions.@NotNull List<ImmutableChain>
Returns allImmutableChain
's filtered byProject
ignoring permissions.@NotNull List<ImmutableTopLevelPlan>
Returns allImmutableTopLevelPlan
's ignoring permissions.@NotNull List<ImmutableTopLevelPlan>
Returns allImmutableTopLevelPlan
's ignoring permissions.Returns chains that use repositories with given params.Returns chains that use repositories with given params.boolean
isBranchOf
(@NotNull PlanKey chainKey, @NotNull PlanKey branchKey) Test if plan identified by branchKey is a branch of plan identified by chainKey.Methods inherited from interface com.atlassian.bamboo.plan.FilteringPlanManager
assertPlanPermission, getBranchesForChain, getBranchesForChainWithConsistencyGuarantee, getBranchesOfChain, getBranchesOfChainWithConsistencyGuarantee, getEditablePlansByProject, getFilteredPlansWithRepository, getPlans, getPlans, getPlans, getPlansByProject, getPlansByProject, getPlansByProject, getPlansByProjectWithConsistencyGuarantee, getPlansByProjectWithConsistencyGuarantee, getPlansForClone, getPlansWithConsistencyGuarantee, getRunnablePlans
-
Method Details
-
getPlanByKey
Returns aImmutablePlan
by its planKey. In clustered mode, there is NO consistency guarantee.- Parameters:
planKey
- to search for- Returns:
- plan with the given plan key or null if not found
-
getPlanByKeyWithConsistencyGuarantee
@Nullable @Nullable ImmutablePlan getPlanByKeyWithConsistencyGuarantee(@NotNull @NotNull PlanKey planKey) Returns aImmutablePlan
by its planKey. There is a guarantee that the data will be up-to-date.- Parameters:
planKey
- to search for- Returns:
- plan with the given plan key or null if not found
- Since:
- 9.4
-
getPlanByKey
@Nullable <T extends ImmutablePlan> T getPlanByKey(@NotNull @NotNull PlanKey planKey, Class<T> planType) throws IncorrectPlanTypeException Returns aImmutablePlan
by its planKey andClass
. In clustered mode, there is NO consistency guarantee.- Parameters:
planKey
- to search forplanType
- - 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
-
getPlanByKeyWithConsistencyGuarantee
@Nullable <T extends ImmutablePlan> T getPlanByKeyWithConsistencyGuarantee(@NotNull @NotNull PlanKey planKey, Class<T> planType) throws IncorrectPlanTypeException Returns aImmutablePlan
by its planKey andClass
. There is a guarantee that the data will be up-to-date.- Parameters:
planKey
- to search forplanType
- - 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 <T extends ImmutablePlan> T getPlanByKeyIfOfType(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull Class<T> planType) Returns aPlan
by its planKey and if it's of the typeClass
. Does not throwIncorrectPlanTypeException
. Should only be used when the type of the plan can not be known. In clustered mode, there is NO consistency guarantee.- Type Parameters:
T
-- Parameters:
planKey
-planType
-- Returns:
- null if the plan doesn't exist, or it's not of the found type
-
getPlanByKeyIfOfTypeWithConsistencyGuarantee
@Nullable <T extends ImmutablePlan> T getPlanByKeyIfOfTypeWithConsistencyGuarantee(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull Class<T> planType) Returns aPlan
by its planKey and if it's of the typeClass
. Does not throwIncorrectPlanTypeException
. Should only be used when the type of the plan can not be known. There is a guarantee that the data will be up-to-date.- Type Parameters:
T
-- Parameters:
planKey
-planType
-- Returns:
- null if the plan doesn't exist, or it's not of the found type
- Since:
- 9.4
-
getAnyPlan
Returns a plan matching the supplied predicate, permission filtering is applied.- Specified by:
getAnyPlan
in interfaceFilteringPlanManager
-
getAnyPlanUnrestricted
Returns a plan matching the supplied predicate. -
getPlanById
@Nullable <T extends ImmutablePlan> T getPlanById(long id, Class<T> planType) throws IncorrectPlanTypeException, NoSuchElementException Returns aImmutablePlan
by its database id andClass
- Parameters:
id
- to search forplanType
- - the type of the plan to retrieve- Returns:
- plan with the given database id, if found AND is of the correct type.
- Throws:
IncorrectPlanTypeException
- if plan cannot be found with the correct typeNoSuchElementException
-
getPlanByIdNotThrowing
Returns aImmutablePlan
by its database id andClass
. This method does not throw exception if plan is not found. In clustered mode, there is NO consistency guarantee.- Parameters:
id
- to search forplanType
- - the type of the plan to retrieve- Returns:
- plan with the given database id, if found AND is of the correct type, null otherwise
- Since:
- 6.8
-
getPlanByIdNotThrowingWithConsistencyGuarantee
@Nullable <T extends ImmutablePlan> T getPlanByIdNotThrowingWithConsistencyGuarantee(long id, Class<T> planType) Returns aImmutablePlan
by its database id andClass
. This method does not throw exception if plan is not found. There is a guarantee that the data will be up-to-date.- Parameters:
id
- to search forplanType
- - the type of the plan to retrieve- Returns:
- plan with the given database id, if found AND is of the correct type, null otherwise
- Since:
- 9.4
-
getPlansUnrestricted
Returns allImmutableTopLevelPlan
's ignoring permissions. In clustered mode, there is NO consistency guarantee. -
getPlansUnrestrictedWithConsistencyGuarantee
Returns allImmutableTopLevelPlan
's ignoring permissions. There is a guarantee that the data will be up-to-date.- Since:
- 9.4
-
getPlansByProjectUnrestricted
Returns allImmutableChain
's filtered byProject
ignoring permissions. In clustered mode, there is NO consistency guarantee.- Parameters:
project
- - that the plans will belong to- Returns:
ImmutableChain
plans contained within the given project
-
getPlansByProjectUnrestrictedWithConsistencyGuarantee
@NotNull @NotNull List<ImmutableChain> getPlansByProjectUnrestrictedWithConsistencyGuarantee(Project project) Returns allImmutableChain
's filtered byProject
ignoring permissions. There is a guarantee that the data will be up-to-date.- Parameters:
project
- - that the plans will belong to- Returns:
ImmutableChain
plans contained within the given project- Since:
- 9.4
-
getBranchKeysOfChain
Returns keys of all branches for the supplied chain. -
getBranchGistsOfChain
Returns basic data of all branches for the supplied chain.- Since:
- 6.5
-
getBranchGistsOfChainWithConsistencyGuarantee
@NotNull @NotNull Set<PlanBranchGist> getBranchGistsOfChainWithConsistencyGuarantee(@NotNull @NotNull PlanKey chainKey) Returns basic data of all branches for the supplied chain with guarantee that eventual new plan branches not present in the cache will be taken in consideration.- Parameters:
chainKey
- the key of the chain- Returns:
- highly-consistent list of branches' gists associated with a master plan identified by the given key, including eventual new branches not present in the database
- Since:
- 9.5
-
getMasterPlan
Returns master branch for a given branchKey. If branchKey identifies plan which has no master (is a master itself) then this plan is returned, otherwise a master of a plan is returned.- Parameters:
branchKey
- key of a branch- Returns:
- master branch for a given branchKey or null if branchKey doesn't identify a plan
-
findPotentialMasterPlanByKey
@NotNull @NotNull Optional<ImmutableChain> findPotentialMasterPlanByKey(@NotNull @NotNull PlanKey branchKey) Finds a potential master plan by progressively shortening the plan key. For example, given "FOO-BAR2334" it will try "FOO-BAR233", "FOO-BAR23", "FOO-BAR2", "FOO-BAR" until it finds an existing plan that has no master (is a master itself).Due the lack of a separator for plan branches in the key, there is no guarantee that the master plan found is the intended master plan. For example, you won't be able to determine which is the master plan only from the key given plans "FOO-BAR1" and "FOO-BAR10", and a plan branch key "FOO-BAR101".
- Parameters:
branchKey
- key of a potential branch- Returns:
- Optional containing the master plan, or empty if no master plan is found
-
isBranchOf
Test if plan identified by branchKey is a branch of plan identified by chainKey. If branchKey identifies master plan method also returns true.- Parameters:
chainKey
- key of master branchbranchKey
- key of alleged branch- Returns:
- true if plan identified by branchKey is a branch of plan identified by chainKey, false otherwise
-
getMasterOfJob
@Nullable @Nullable ImmutableJob getMasterOfJob(@NotNull @NotNull PlanKey masterChainKey, @NotNull @NotNull PlanKey jobKey) -
getPlansWithRepository
Returns chains that use repositories with given params. In clustered mode, there is NO consistency guarantee. -
getPlansWithRepositoryWithConsistencyGuarantee
Iterable<ImmutableChain> getPlansWithRepositoryWithConsistencyGuarantee(@NotNull PlanRepositoryIndex.Query query) Returns chains that use repositories with given params. There is a guarantee that the data will be up-to-date.- Since:
- 9.4
-
getAllProjectsWithPlan
Returns all projects which have at least one plan (plan is in the cache)- Returns:
-