Package com.atlassian.bamboo.plan
Interface PlanDao
- All Superinterfaces:
BambooObjectDao<Plan>
,BambooObjectWithOidDao<Plan>
- All Known Implementing Classes:
PlanHibernateDao
DAO Manager for
Plan
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clearInvalidFlagForBranchesOfChain
(long masterId) filterFavouritedPlans
(@NotNull Collection<? extends ImmutableChain> plans, @NotNull com.atlassian.user.User user) Return a collection ofTopLevelPlan
s that are a subset of the givenPlan
s collection that are favourited by theUser
findAllPlans
(Class<T> planType) Return aPlan
collection for specified plan type.findAllPlans
(Class<T> planType, int firstResult, int maxResults) Return aPlan
collection for specified plan type.findAllPlansByProject
(@NotNull Project project, Class<T> planType) findPlansByProject
(@NotNull Project project, Class<T> planType) getAllPlanKeys
(Class<T> planType) Returns all plan keys of a particular type, including the plans marked for deletion.<T extends Plan>
@NotNull Collection<T>getAllPlansMarkedForDeletion
(Class<T> planType) Returns a list ofPlan
s that areImmutableDeletable.isMarkedForDeletion()
for the given typeint
getBranchCount
(@NotNull ImmutablePlan plan) Returns the number of branches that exist for the given planReturns the number of branches that exist for master plans in Bamboo.@NotNull List<ChainBranch>
Returns all branches which have the given chain as their mastergetBranchesForJob
(Job job) @NotNull List<ChainBranchIdentifier>
getBranchIdentifiersForChain
(@NotNull PlanIdentifier chain) Returns minimal data about all branches which have the given chain as their mastergetBranchKeysForChain
(@NotNull PlanKey chainKey) Returns the keys of branches that have as master the chain identified by the given chainKey.getFavouritePlansIds
(@NotNull com.atlassian.user.User user) Return a collection of Favourite plan ids.getJobKeys
(@NotNull PlanKey chainKey) Return all plan keys of Jobs that belong to a Chain@Nullable BambooEntityOid
getMaxPlanOid
(int serverKey, @NotNull BambooEntityType entityType) Returns the maxBambooEntityOid
that's currently in use of the specified entity type, with the given server key.<T extends Plan>
TgetPlanByKey
(@NotNull PlanKey planKey, Class<T> aClass) Return aPlan
that matches the given key<T extends Plan>
TgetPlanByKey
(@NotNull String planKey, Class<T> aClass) Return aPlan
that matches the given key<T extends Plan>
TgetPlanByPartialKeyAndName
(@NotNull PlanKey partialPlanKey, @NotNull String planName, Class<T> planType) getPlanClass
(@NotNull PlanKey planKey) int
getPlanCount
(@NotNull ProjectIdentifier projectIdentifier) How many plans currently exist in aproject
.<T extends Plan>
intgetPlanCount
(Class<T> planType) How many plans filtered byClass
currently exist@Nullable PlanIdentifier
getPlanIdentifierForPermissionCheckingByKey
(@NotNull String planKey) Return aPlan
skeleton providing ONLY id and key, that matches the given key This method should be used only for permission checking using Acegi IfJob
key is provided as a parameter, parent Chain will be returned anyway, as Acegi assertions are defined only forTopLevelPlan
s<T extends Plan>
@NotNull List<PlanIdentifier>getPlanIdentifiersForProject
(@NotNull ProjectIdentifier projectIdentifier, @NotNull Class<T> planType, boolean includeMarkedForDeletion) Returns minimal data about all plans in the given projectgetPlanKeys
(Class<T> planType) Returns all plan keys of a particular type, NOT including the plans marked for deletion.getPlanKeysPlanIdsMapping
(@NotNull Class<T> aClass) boolean
isChainNameConflicting
(@NotNull String projectKey, long planIdToIgnore, @NotNull String planName) Verifies whether aChain
name is unique with the given projectboolean
isPlanKeyConflicting
(@NotNull PlanKey planKey) Verifies whether aPlan
key is unique within whole Bamboo installationboolean
isPlanKeyConflicting
(@NotNull PlanKey planKey, long idOfChainBeingVerified) Verifies whether aPlan
key is unique within whole Bamboo installationvoid
markPlanForDeletion
(PlanKey planKey) Efficiently marks a plan to be deletedvoid
Performs a cleanup task to markChainBranch
objects that have a masterPlan
that is marked to be deleted, but is not marked as deleted.void
Performs a cleanup task to markJob
objects that have aPlan
orChainStage
that is marked to be deleted, but it itself was not marked as deleted.void
Methods inherited from interface com.atlassian.bamboo.persistence3.BambooObjectDao
countAll, countWithRestriction, delete, deleteAll, findAll, findById, merge, save, saveAll
Methods inherited from interface com.atlassian.bamboo.persistence3.BambooObjectWithOidDao
findByOid
-
Method Details
-
getPlanByKey
Return aPlan
that matches the given key- Parameters:
planKey
-- Returns:
- plan
-
getPlanByKey
Return aPlan
that matches the given key- Parameters:
planKey
-- Returns:
- plan
-
getPlanIdentifierForPermissionCheckingByKey
@Nullable @Nullable PlanIdentifier getPlanIdentifierForPermissionCheckingByKey(@NotNull @NotNull String planKey) Return aPlan
skeleton providing ONLY id and key, that matches the given key This method should be used only for permission checking using Acegi IfJob
key is provided as a parameter, parent Chain will be returned anyway, as Acegi assertions are defined only forTopLevelPlan
s- Parameters:
planKey
-- Returns:
- plan
-
getPlanClass
-
isChainNameConflicting
boolean isChainNameConflicting(@NotNull @NotNull String projectKey, long planIdToIgnore, @NotNull @NotNull String planName) Verifies whether aChain
name is unique with the given project- Parameters:
projectKey
- of the project to look for the plan inplanIdToIgnore
- the id of the plan that has to be ignored during lookup (when you're saving a Plan, you should supply the plan id here)planName
- - name of the plan inside the project: this is just the plan component of the name (i.e does not include the project component)- Returns:
- true if the name is in conflict
- Since:
- 4.0
-
isPlanKeyConflicting
Verifies whether aPlan
key is unique within whole Bamboo installation- Parameters:
planKey
- key of the plan to be searched for in the database- Returns:
- true if plan key is conflicting
- Since:
- 4.3
-
isPlanKeyConflicting
Verifies whether aPlan
key is unique within whole Bamboo installation- Parameters:
planKey
- key of the plan to be searched for in the databaseidOfChainBeingVerified
- id of plan that is verified (i.e. if that plan uses the key, it's not a duplicate key)- Returns:
- true if plan key is conflicting
- Since:
- 5.15
-
getPlanByPartialKeyAndName
@Nullable <T extends Plan> T getPlanByPartialKeyAndName(@NotNull @NotNull PlanKey partialPlanKey, @NotNull @NotNull String planName, Class<T> planType) - Parameters:
partialPlanKey
-planName
-planType
-- Returns:
- plan
-
getPlanCount
How many plans filtered byClass
currently exist- Parameters:
planType
-- Returns:
- how many plans exist in the database
-
getPlanCount
How many plans currently exist in aproject
.- Parameters:
projectIdentifier
- identifier of the project- Returns:
- how many plans exist in the database in a project, excluding ones marked for deletion
-
findPlansByProject
- Parameters:
project
-planType
-- Returns:
- plans for specifid project
-
findAllPlansByProject
<T extends Plan> List<T> findAllPlansByProject(@NotNull @NotNull Project project, Class<T> planType) - Parameters:
project
-planType
-- Returns:
- plans for specifid project
-
findAllPlans
Return aPlan
collection for specified plan type. Does not include plans marked for deletion.- Type Parameters:
T
-- Parameters:
planType
- type of plan to be selected from DB- Returns:
Plan
collection for specified plan type
-
findAllPlans
@NotNull <T extends Plan> @NotNull List<T> findAllPlans(Class<T> planType, int firstResult, int maxResults) Return aPlan
collection for specified plan type. Does not include plans marked for deletion.- Type Parameters:
T
-- Parameters:
planType
- type of plan to be selected from DBfirstResult
- firstResult for a paginated resultsmaxResults
- maximum number of results to return- Returns:
Plan
collection for specified plan type
-
filterFavouritedPlans
List<ImmutableChain> filterFavouritedPlans(@NotNull @NotNull Collection<? extends ImmutableChain> plans, @NotNull @NotNull com.atlassian.user.User user) Return a collection ofTopLevelPlan
s that are a subset of the givenPlan
s collection that are favourited by theUser
- Parameters:
plans
-user
-- Returns:
- favoritedBuilds
-
getFavouritePlansIds
Return a collection of Favourite plan ids.- Parameters:
user
-- Returns:
- favouritePlansIds
-
getAllPlansMarkedForDeletion
@Internal @NotNull <T extends Plan> @NotNull Collection<T> getAllPlansMarkedForDeletion(Class<T> planType) Returns a list ofPlan
s that areImmutableDeletable.isMarkedForDeletion()
for the given type- Returns:
- plansMarkedForDeletion
-
getPlanKeys
Returns all plan keys of a particular type, NOT including the plans marked for deletion. -
getAllPlanKeys
Returns all plan keys of a particular type, including the plans marked for deletion. -
getJobKeys
Return all plan keys of Jobs that belong to a Chain- Parameters:
chainKey
- key of a Chain- Returns:
- list of Job keys
-
getBranchesForChain
Returns all branches which have the given chain as their master- Parameters:
chain
- master plan- Returns:
- all branches which have the given chain as their master
-
getBranchesForJob
-
getBranchIdentifiersForChain
@NotNull @NotNull List<ChainBranchIdentifier> getBranchIdentifiersForChain(@NotNull @NotNull PlanIdentifier chain) Returns minimal data about all branches which have the given chain as their master- Parameters:
chain
- master- Returns:
- all branches which have the given chain as their master
-
getPlanIdentifiersForProject
@NotNull <T extends Plan> @NotNull List<PlanIdentifier> getPlanIdentifiersForProject(@NotNull @NotNull ProjectIdentifier projectIdentifier, @NotNull @NotNull Class<T> planType, boolean includeMarkedForDeletion) Returns minimal data about all plans in the given project- Parameters:
projectIdentifier
- - to get plans forplanType
- to filter plans byincludeMarkedForDeletion
- - true if you want to include any results currently marked for deletion- Returns:
- plansIdentifiers matching the above criteria.
-
getBranchCount
Returns the number of branches that exist for the given plan- Parameters:
plan
- to count branches of- Returns:
- the number of branches that exist for the given plan
-
getBranchesCount
Returns the number of branches that exist for master plans in Bamboo. Only returns masters plans which HAVE branches. Others are omitted.- Returns:
- List of pairs of plan id and their branches count
-
markPlanForDeletion
Efficiently marks a plan to be deleted- Parameters:
planKey
-
-
syncDeletionStatusOfPlans
void syncDeletionStatusOfPlans() -
syncDeletionStatusOfJobs
void syncDeletionStatusOfJobs()Performs a cleanup task to markJob
objects that have aPlan
orChainStage
that is marked to be deleted, but it itself was not marked as deleted. -
syncDeletionStatusOfChainBranches
void syncDeletionStatusOfChainBranches()Performs a cleanup task to markChainBranch
objects that have a masterPlan
that is marked to be deleted, but is not marked as deleted. -
getMaxPlanOid
@Nullable @Nullable BambooEntityOid getMaxPlanOid(int serverKey, @NotNull @NotNull BambooEntityType entityType) Returns the maxBambooEntityOid
that's currently in use of the specified entity type, with the given server key. Allowed entity types: -BambooEntityType.CHAIN
-BambooEntityType.JOB
-BambooEntityType.CHAIN_BRANCH
-BambooEntityType.JOB_BRANCH
Returns null if no OIDs are in use of the specified type with the given server key.- Throws:
IllegalArgumentException
- if the entity type is invalid
-
getPlanKeysPlanIdsMapping
- Returns:
- mapping between plans' keys and their ids for given plan class.
-
clearInvalidFlagForBranchesOfChain
void clearInvalidFlagForBranchesOfChain(long masterId) -
getBranchKeysForChain
Returns the keys of branches that have as master the chain identified by the given chainKey.- Parameters:
chainKey
- the key of the chain that is the master of the desired branches.- Returns:
- the keys of branches that have as master the chain identified by the given chainKey.
- Since:
- 9.5
-