com.atlassian.bamboo.plan.stage
Class StageServiceImpl

java.lang.Object
  extended by com.atlassian.bamboo.plan.stage.StageServiceImpl
All Implemented Interfaces:
StageService

public class StageServiceImpl
extends Object
implements StageService


Constructor Summary
StageServiceImpl(AuditLogService auditLogService, BambooPermissionManager bambooPermissionManager, CachedPlanManager cachedPlanManager, ChainBranchManager chainBranchManager, DeletionService deletionService, PlanManager planManager, com.atlassian.struts.TextProvider textProvider, ValidationService validationService, BuildExecutionManager buildExecutionManager, ScopedExclusionService scopedExclusionService, ArtifactSubscriptionManager artifactSubscriptionManager)
           
 
Method Summary
 ImmutableChainStage addStage(PlanKey planKey, String stageName, String stageDescription, boolean isManual)
          Adds a new stage to the specified plan.
 void deleteStage(PlanKey planKey, long stageId, BambooClosures.Throwing1<ImmutableChainStage,WebValidationException>... runBefore)
          Deletes the given stage and any jobs under the stage.
 ImmutableChainStage getStage(PlanKey planKey, long stageId)
          Get an individual stage from a plan
 List<ImmutableChainStage> getStagesForPlan(PlanKey planKey)
          Get all stages in a plan, in order
 ImmutableChainStage updateStage(PlanKey planKey, long stageId, String name, String description, boolean manual, Integer index, BambooClosures.Throwing1<ImmutableChainStage,WebValidationException>... runBefore)
          Update the details of a stage.
 ErrorCollection validateStageForAdd(PlanKey planKey, String stageName, String stageDescription, boolean isManual)
          Validates a new stage for the specified plan.
 ErrorCollection validateStageForUpdate(PlanKey planKey, long stageId, String name, String description, boolean manual)
          Validates editing of a stage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StageServiceImpl

public StageServiceImpl(AuditLogService auditLogService,
                        BambooPermissionManager bambooPermissionManager,
                        CachedPlanManager cachedPlanManager,
                        ChainBranchManager chainBranchManager,
                        DeletionService deletionService,
                        PlanManager planManager,
                        com.atlassian.struts.TextProvider textProvider,
                        ValidationService validationService,
                        BuildExecutionManager buildExecutionManager,
                        ScopedExclusionService scopedExclusionService,
                        ArtifactSubscriptionManager artifactSubscriptionManager)
Method Detail

getStagesForPlan

@NotNull
public List<ImmutableChainStage> getStagesForPlan(@NotNull
                                                          PlanKey planKey)
                                           throws WebValidationException
Description copied from interface: StageService
Get all stages in a plan, in order

Specified by:
getStagesForPlan in interface StageService
Parameters:
planKey - of plan
Returns:
list of immutable stages
Throws:
WebValidationException

getStage

@NotNull
public ImmutableChainStage getStage(@NotNull
                                            PlanKey planKey,
                                            long stageId)
                             throws WebValidationException
Description copied from interface: StageService
Get an individual stage from a plan

Specified by:
getStage in interface StageService
Parameters:
planKey - the plan the stage belongs to
stageId - the id of the stage
Returns:
ImmutableChainStage representing the stage if it exists
Throws:
WebValidationException

validateStageForAdd

@NotNull
public ErrorCollection validateStageForAdd(@NotNull
                                                   PlanKey planKey,
                                                   @Nullable
                                                   String stageName,
                                                   @Nullable
                                                   String stageDescription,
                                                   boolean isManual)
                                    throws WebValidationException
Description copied from interface: StageService
Validates a new stage for the specified plan.

Specified by:
validateStageForAdd in interface StageService
Parameters:
planKey - of plan to add stage to
stageName - of stage
stageDescription - of stage
isManual - 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

addStage

@NotNull
public ImmutableChainStage addStage(@NotNull
                                            PlanKey planKey,
                                            @NotNull
                                            String stageName,
                                            @Nullable
                                            String stageDescription,
                                            boolean isManual)
                             throws WebValidationException
Description copied from interface: StageService
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?

Specified by:
addStage in interface StageService
Parameters:
planKey - of plan to add stage to
stageName - of stage
stageDescription - of stage
isManual - true if this stage is a manual stage
Returns:
created chain stage
Throws:
WebValidationException - if plan does not exist or it is not of the correct type, or if validation fails

validateStageForUpdate

@NotNull
public ErrorCollection validateStageForUpdate(@NotNull
                                                      PlanKey planKey,
                                                      long stageId,
                                                      @Nullable
                                                      String name,
                                                      @Nullable
                                                      String description,
                                                      boolean manual)
                                       throws WebValidationException
Description copied from interface: StageService
Validates editing of a stage.

Specified by:
validateStageForUpdate in interface StageService
Parameters:
planKey - of plan stage belongs to
stageId - if of the stage being edited
name - new name of stage
description - new description of stage
manual - new value for id stage is manual or not
Returns:
error collection containing any validation errors that may have occurred against stage data.
Throws:
WebValidationException

updateStage

@NotNull
public ImmutableChainStage updateStage(@NotNull
                                               PlanKey planKey,
                                               long stageId,
                                               @NotNull
                                               String name,
                                               @NotNull
                                               String description,
                                               boolean manual,
                                               @Nullable
                                               Integer index,
                                               @NotNull
                                               BambooClosures.Throwing1<ImmutableChainStage,WebValidationException>... runBefore)
                                throws WebValidationException
Description copied from interface: StageService
Update the details of a stage.

Specified by:
updateStage in interface StageService
Parameters:
planKey - key of the plan the stage belongs to
stageId - if of the stage being updated
name - the name of the stage
description - the description of the stage
manual - indicates if the stage runs automatically or needs manual intervention
index - position of the stage in the plan structure
Returns:
ImmutableChainStage representing the updated stage
Throws:
WebValidationException - if invalid

deleteStage

public void deleteStage(@NotNull
                        PlanKey planKey,
                        long stageId,
                        @NotNull
                        BambooClosures.Throwing1<ImmutableChainStage,WebValidationException>... runBefore)
                 throws WebValidationException
Description copied from interface: StageService
Deletes the given stage and any jobs under the stage.

Specified by:
deleteStage in interface StageService
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


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.