@PublicApi
public interface PlanManager
Use this manager if you need to address Builds, Plans, etc.
Modifier and Type | Method and Description |
---|---|
boolean |
assertPlanPermission(PlanIdentifier plan)
Used to validate user permission for plan.
|
void |
createPlan(Plan plan)
Same as savePlan, but create permissions used instead of edit permissions.
|
void |
deletePlan(Plan plan)
Removes the plan object from the database.
|
Set<ImmutableChain> |
filterFavouritedPlans(Collection<? extends ImmutableChain> plans,
com.atlassian.user.User user)
Return a set of
Plan s that are a subset of the given TopLevelPlan s
collection that are favourited by the User . |
List<Chain> |
getAllChainsAndJobsUnrestricted()
WARNING this is probably a bad idea from a performance perspective, only do this if you're going to
traverse through all the
ChainStage and Job of all Chain s returned. |
<T extends Plan> |
getAllPlanKeys(Class<T> planType)
Deprecated.
since 6.2 with no replacement
|
List<TopLevelPlan> |
getAllPlans()
Deprecated.
since 5.0 please use
CachedPlanManager |
<T extends Plan> |
getAllPlans(Class<T> planType)
|
<T extends Plan> |
getAllPlans(Class<T> planType,
int firstResult,
int maxResults)
|
<T extends Plan> |
getAllPlansByProject(Project project,
Class<T> planType)
|
<T extends Plan> |
getAllPlansMarkedForDeletion(Class<T> planType)
Returns a list of
Plan s that are ImmutableDeletable.isMarkedForDeletion()
for the given type |
List<TopLevelPlan> |
getAllPlansUnrestricted()
Returns all
TopLevelPlan 's ignoring permissions |
Set<ImmutableChain> |
getFavouritePlans(com.atlassian.user.User user) |
Plan |
getPlanById(long id)
Returns a
Plan by its id |
<T extends Plan> |
getPlanById(long id,
Class<T> planType)
|
Plan |
getPlanByKey(PlanKey planKey)
|
<T extends Plan> |
getPlanByKey(PlanKey planKey,
Class<T> planType)
|
Plan |
getPlanByKey(String planKey)
Deprecated.
since 4.2
|
<T extends Plan> |
getPlanByKey(String planKey,
Class<T> planType)
Deprecated.
since 4.2
|
<T extends Plan> |
getPlanByKeyIfOfType(PlanKey planKey,
Class<T> planType)
|
<T extends Plan> |
getPlanByOid(BambooEntityOid oid,
Class<T> planType)
|
<T extends Plan> |
getPlanByPartialKeyAndName(PlanKey partialPlanKey,
String planName,
Class<T> planType)
Deprecated.
since 4.2
|
Class<? extends Plan> |
getPlanClass(PlanKey planKey) |
int |
getPlanCount() |
<T extends Plan> |
getPlanCount(Class<T> planType)
How many plans filtered by
Class currently exist |
int |
getPlanCount(ProjectIdentifier projectIdentifier)
How many plans currently exist in a
project . |
PlanIdentifier |
getPlanIdentifierForPermissionCheckingByKey(String planKey)
Returns a
Plan skeleton skeleton providing ONLY id and key, that matches the given key This method should
be used only for permission checking using Acegi |
<T extends Plan> |
getPlanIdentifiersForProject(ProjectIdentifier project,
Class<T> planType,
boolean includeMarkedForDeletion)
Retrieve a list of plans for a given project.
|
List<TopLevelPlan> |
getPlansByProject(Project project)
Returns all
TopLevelPlan 's filtered by Project
Result of this method is filtered by Acegi. |
<T extends Plan> |
getPlansByProject(Project project,
Class<T> planType)
|
<T extends Plan> |
getProjectPlanMap(Class<T> planType,
boolean includeEmptyProjects)
|
boolean |
isChainNameConflicting(String projectKey,
long planIdToIgnore,
String planName)
Verifies whether a
Chain name is unique with the given project |
boolean |
isPlanCreationAllowed()
Check whether or not a plan can be created or not (based on licensing etc)
|
boolean |
isPlanKeyConflicting(PlanKey planKey)
Verifies whether a
Plan key is unique within whole Bamboo installation |
boolean |
isPlanKeyConflicting(PlanKey planKey,
long planIdToIgnore)
Verifies whether a
Plan key is unique within whole Bamboo installation |
void |
markPlansForDeletion(PlanKey planKey)
Efficiently marks a plan to be deleted
|
void |
removeStages(PlanKey key,
Collection<Long> stageIds)
Remove the tages from the plan specified.
|
void |
savePlan(Plan plan)
Saves the
Plan |
void |
savePlanWithSchedulesStopped(Plan plan)
Saves the
Plan while polling jobs are stopped. |
void |
setPlanSuspendedState(PlanKey planKey,
boolean isSuspended) |
void |
syncDeletionStatusOfJobs()
Performs a cleanup task to mark
Job objects that have a Plan or ChainStage that is marked
to be deleted, but it itself was not marked as deleted. |
void |
triggerConfigUpdatedEventsForPlansInProject(Project project)
Triggers updated events for every plan in a project regardless of permissions.
|
@Nullable PlanIdentifier getPlanIdentifierForPermissionCheckingByKey(@NotNull String planKey)
Plan
skeleton skeleton providing ONLY id and key, that matches the given key This method should
be used only for permission checking using Acegi
If Job
key is provided as a parameter, parent Chain will be returned anyway, as Acegi assertions are
defined only for TopLevelPlan
s
planKey
- of the plan to findIncorrectPlanTypeException
- if plan cannot be found with the correct type (should never happen)@Nullable Plan getPlanById(long id) throws IncorrectPlanTypeException
Plan
by its idid
- of the planIncorrectPlanTypeException
- if plan cannot be found@Nullable <T extends Plan> T getPlanById(long id, Class<T> planType) throws IncorrectPlanTypeException
id
- of the planplanType
- - the type of the plan to retrieveIncorrectPlanTypeException
- if plan cannot be found with the correct type@Nullable <T extends Plan> T getPlanByOid(BambooEntityOid oid, Class<T> planType) throws IncorrectPlanTypeException
oid
- of the planplanType
- - the type of the plan to retrieveIncorrectPlanTypeException
- if plan cannot be found with the correct type@Nullable Plan getPlanByKey(@NotNull PlanKey planKey) throws IncorrectPlanTypeException
planKey
- to search forIncorrectPlanTypeException
- if plan cannot be found with the correct type (should never happen)@Nullable <T extends Plan> T getPlanByKey(@NotNull PlanKey planKey, Class<T> planType) throws IncorrectPlanTypeException
planKey
- to search forplanType
- - the type of the plan to retrieveIncorrectPlanTypeException
- if plan cannot be found with the correct type@Nullable <T extends Plan> T getPlanByKeyIfOfType(@NotNull PlanKey planKey, @NotNull Class<T> planType)
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.planKey
- to search forplanType
- the type of the plan to retrieve@NotNull @Deprecated List<TopLevelPlan> getAllPlans()
CachedPlanManager
TopLevelPlan
'sList<TopLevelPlan> getAllPlansUnrestricted()
TopLevelPlan
's ignoring permissions@NotNull <T extends Plan> List<T> getAllPlans(Class<T> planType)
planType
- - the type of the plan to retrieveDescriptionProvider.getName()
@NotNull @Deprecated <T extends Plan> List<PlanKey> getAllPlanKeys(Class<T> planType)
planType
- - the type of the plan to retrieve@NotNull <T extends Plan> List<T> getAllPlans(Class<T> planType, int firstResult, int maxResults)
planType
- - the type of the plan to retrievefirstResult
- firstResult for a paginated resultsmaxResults
- maximum number of results to returnDescriptionProvider.getName()
@NotNull List<Chain> getAllChainsAndJobsUnrestricted()
ChainStage
and Job
of all Chain
s returned.@NotNull List<TopLevelPlan> getPlansByProject(Project project)
TopLevelPlan
's filtered by Project
Result of this method is filtered by Acegi.project
- - that the plans will belong toTopLevelPlan
plans contained within the given project@NotNull <T extends Plan> List<T> getPlansByProject(Project project, Class<T> planType)
project
- - that the plans will belong toplanType
- - the type of the plan to retrieve@NotNull <T extends Plan> List<T> getAllPlansByProject(Project project, Class<T> planType)
project
- - that the plans will belong toplanType
- - the type of the plan to retrieve@NotNull <T extends Plan> Map<Project,Collection<T>> getProjectPlanMap(Class<T> planType, boolean includeEmptyProjects)
@NotNull <T extends Plan> List<PlanIdentifier> getPlanIdentifiersForProject(@NotNull ProjectIdentifier project, @NotNull Class<T> planType, boolean includeMarkedForDeletion)
project
- to get plans forplanType
- to filter plans byincludeMarkedForDeletion
- set to true if you want to return plans marked for deletionSet<ImmutableChain> getFavouritePlans(@NotNull com.atlassian.user.User user)
@NotNull Set<ImmutableChain> filterFavouritedPlans(@NotNull Collection<? extends ImmutableChain> plans, @NotNull com.atlassian.user.User user)
Plan
s that are a subset of the given TopLevelPlan
s
collection that are favourited by the User
. Plans are not filtered by read permission.plans
- to filteruser
- to return the favourites ofChain
s that are a subset of the given TopLevelPlan
s collection that are favourited by the User
@NotNull <T extends Plan> Collection<T> getAllPlansMarkedForDeletion(Class<T> planType)
Plan
s that are ImmutableDeletable.isMarkedForDeletion()
for the given typeint getPlanCount()
Buildable
's exists<T extends Plan> int getPlanCount(Class<T> planType)
Class
currently existplanType
- - the type of the plan to retrieveint getPlanCount(@NotNull ProjectIdentifier projectIdentifier)
project
.projectIdentifier
- identifier of the projectboolean isChainNameConflicting(@NotNull String projectKey, long planIdToIgnore, @NotNull String planName)
Chain
name is unique with the given project
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)boolean isPlanKeyConflicting(@NotNull PlanKey planKey)
Plan
key is unique within whole Bamboo installationplanKey
- key of the plan to be searched for in the databaseboolean isPlanKeyConflicting(@NotNull PlanKey planKey, long planIdToIgnore)
Plan
key is unique within whole Bamboo installationplanKey
- planIdToIgnore
- id of plan which we want to set key for, if the key is used by that plan, it's not really conflicting@Nullable @Deprecated <T extends Plan> T getPlanByPartialKeyAndName(@NotNull PlanKey partialPlanKey, @NotNull String planName, Class<T> planType) throws IncorrectPlanTypeException
IncorrectPlanTypeException
- if plan cannot be found with the correct typeboolean assertPlanPermission(@NotNull PlanIdentifier plan)
plan
- to check the permissions ofboolean isPlanCreationAllowed()
void savePlanWithSchedulesStopped(@NotNull Plan plan)
Plan
while polling jobs are stopped.plan
- void setPlanSuspendedState(PlanKey planKey, boolean isSuspended)
void triggerConfigUpdatedEventsForPlansInProject(@NotNull Project project)
project
- to trigger event for.void createPlan(Plan plan)
void deletePlan(@NotNull Plan plan)
DeletionService
rather than using this method directlyplan
- to delete.void markPlansForDeletion(PlanKey planKey)
planKey
- void syncDeletionStatusOfJobs()
Job
objects that have a Plan
or ChainStage
that is marked
to be deleted, but it itself was not marked as deleted.void removeStages(@NotNull PlanKey key, @NotNull Collection<Long> stageIds)
Chain
key
- stageIds
- @Nullable @Deprecated Plan getPlanByKey(@NotNull String planKey) throws IncorrectPlanTypeException
Plan
by its planKeyplanKey
- of the plan to findIncorrectPlanTypeException
- if plan cannot be found with the correct type (should never happen)@Nullable @Deprecated <T extends Plan> T getPlanByKey(@NotNull String planKey, Class<T> planType) throws IncorrectPlanTypeException
planKey
- to search forplanType
- - the type of the plan to retrieveIncorrectPlanTypeException
- if plan cannot be found with the correct typeCopyright © 2018 Atlassian Software Systems Pty Ltd. All rights reserved.