Package com.atlassian.bamboo.plan.stage
Interface StageService
- All Known Implementing Classes:
StageServiceImpl
public interface StageService
Service for performing stage related configuration
- Since:
- TODO
-
Method Summary
Modifier and TypeMethodDescription@NotNull ImmutableChainStage
addStage
(@NotNull PlanKey planKey, @NotNull String name, @Nullable String description, boolean isManual, boolean isFinal) Adds a new stage to the specified plan.void
deleteStage
(@NotNull PlanKey planKey, long stageId, @NotNull BambooClosures.Throwing1<ImmutableChainStage, WebValidationException>... runBefore) Deletes the given stage and any jobs under the stage.@NotNull ImmutableChainStage
Get an individual stage from a plan.@NotNull List<ImmutableChainStage>
getStagesForPlan
(@NotNull PlanKey planKey) Get all stages in a plan, in order@NotNull ImmutableChainStage
getStageWithConsistencyGuarantee
(@NotNull PlanKey planKey, long stageId) Get an individual stage from a plan.@NotNull ImmutableChainStage
Moves stage to a different position in the plan structure.@NotNull ImmutableChainStage
updateStage
(@NotNull PlanKey planKey, long stageId, @NotNull String name, @NotNull String description, boolean manual, boolean isFinal, @Nullable Integer index, @NotNull BambooClosures.Throwing1<ImmutableChainStage, WebValidationException>... runBefore) Update the details of a stage.@NotNull ErrorCollection
validateStageForAdd
(@NotNull PlanKey planKey, @Nullable String name, @Nullable String description, boolean isManual, boolean isFinal) Validates a new stage for the specified plan.@NotNull ErrorCollection
validateStageForUpdate
(@NotNull PlanKey planKey, long stageId, @Nullable String name, @Nullable String description, boolean manual, boolean isFinal) Validates editing of a stage.
-
Method Details
-
getStagesForPlan
Get all stages in a plan, in order- Parameters:
planKey
- of plan- Returns:
- list of immutable stages
- Throws:
NotFoundException
- if the plan does not existorg.acegisecurity.AccessDeniedException
- if user has no WRITE access to the plan
-
getStage
@NotNull @NotNull ImmutableChainStage getStage(@NotNull @NotNull PlanKey planKey, long stageId) throws WebValidationException Get an individual stage from a plan. In clustered mode, there is NO consistency guarantee.- Parameters:
planKey
- the plan the stage belongs tostageId
- the id of the stage- Returns:
- ImmutableChainStage representing the stage if it exists
- Throws:
NotFoundException
- if the plan or stage does not existorg.acegisecurity.AccessDeniedException
- if user has no WRITE access to the planWebValidationException
-
getStageWithConsistencyGuarantee
@NotNull @NotNull ImmutableChainStage getStageWithConsistencyGuarantee(@NotNull @NotNull PlanKey planKey, long stageId) throws WebValidationException Get an individual stage from a plan. There is a guarantee that the data will be up-to-date.- Parameters:
planKey
- the plan the stage belongs tostageId
- the id of the stage- Returns:
- ImmutableChainStage representing the stage if it exists
- Throws:
NotFoundException
- if the plan or stage does not existorg.acegisecurity.AccessDeniedException
- if user has no WRITE access to the planWebValidationException
-
addStage
@NotNull @NotNull ImmutableChainStage addStage(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull String name, @Nullable @Nullable String description, boolean isManual, boolean isFinal) throws WebValidationException Adds a new stage to the specified plan. Currently will be added to the end of the list // todo allow people to add a stage to a specific index?- Parameters:
planKey
- of plan to add stage toname
- of stagedescription
- of stageisManual
- true if this stage is a manual stageisFinal
- true if stage is a final stage- Returns:
- created chain stage
- Throws:
WebValidationException
- if plan does not exist or it is not of the correct type, or if validation fails
-
validateStageForAdd
@NotNull @NotNull ErrorCollection validateStageForAdd(@NotNull @NotNull PlanKey planKey, @Nullable @Nullable String name, @Nullable @Nullable String description, boolean isManual, boolean isFinal) throws WebValidationException Validates a new stage for the specified plan.- Parameters:
planKey
- of plan to add stage toname
- of stagedescription
- of stageisManual
- true if this stage is a manual stage- Returns:
- error collection containing any validation errors against the stage data.
- Throws:
WebValidationException
- if plan does not exist or it is not of the correct type
-
validateStageForUpdate
@NotNull @NotNull ErrorCollection validateStageForUpdate(@NotNull @NotNull PlanKey planKey, long stageId, @Nullable @Nullable String name, @Nullable @Nullable String description, boolean manual, boolean isFinal) throws WebValidationException Validates editing of a stage.- Parameters:
planKey
- of plan stage belongs tostageId
- if of the stage being editedname
- new name of stagedescription
- new description of stagemanual
- new value for id stage is manual or notisFinal
- if stage is final or not- Returns:
- error collection containing any validation errors that may have occurred against stage data.
- Throws:
WebValidationException
-
moveStage
@NotNull @NotNull ImmutableChainStage moveStage(@NotNull @NotNull PlanKey planKey, long stageId, int index) throws WebValidationException Moves stage to a different position in the plan structure. Will remove all broken artifact subscriptions.- Parameters:
planKey
- key of the plan the stage belongs tostageId
- if of the stage being updatedindex
- new position of the stage in the plan structure, must be a non-negative value. If the index is too big, the stage will be moved to the end of the list.- Returns:
ImmutableChainStage
representing the updated stage- Throws:
WebValidationException
- if any errors occur
-
updateStage
@NotNull @NotNull ImmutableChainStage updateStage(@NotNull @NotNull PlanKey planKey, long stageId, @NotNull @NotNull String name, @NotNull @NotNull String description, boolean manual, boolean isFinal, @Nullable @Nullable Integer index, @NotNull @NotNull BambooClosures.Throwing1<ImmutableChainStage, WebValidationException>... runBefore) throws WebValidationExceptionUpdate the details of a stage.- Parameters:
planKey
- key of the plan the stage belongs tostageId
- if of the stage being updatedname
- the name of the stagedescription
- the description of the stagemanual
- indicates if the stage runs automatically or needs manual interventionindex
- position of the stage in the plan structure- Returns:
ImmutableChainStage
representing the updated stage- Throws:
WebValidationException
- if invalid
-
deleteStage
void deleteStage(@NotNull @NotNull PlanKey planKey, long stageId, @NotNull @NotNull BambooClosures.Throwing1<ImmutableChainStage, WebValidationException>... runBefore) throws WebValidationExceptionDeletes the given stage and any jobs under the stage.- Parameters:
planKey
- key for the plan the stage belongs to.stageId
- id if of the stage being deleted.runBefore
- code to execute after security and validation has passed but before the deletion occurs.- Throws:
WebValidationException
-