Package com.atlassian.bamboo.task
Class TaskConfigurationServiceImpl
java.lang.Object
com.atlassian.bamboo.task.TaskConfigurationServiceImpl
- All Implemented Interfaces:
TaskConfigurationService
@Internal
public class TaskConfigurationServiceImpl
extends Object
implements TaskConfigurationService
-
Constructor Summary
ConstructorsConstructorDescriptionTaskConfigurationServiceImpl(BuildDefinitionManager buildDefinitionManager, TaskManager taskManager, org.apache.struts2.text.TextProvider textProvider, PlanManager planManager, AuditLogService auditLogService, ScopedExclusionService scopedExclusionService) -
Method Summary
Modifier and TypeMethodDescriptioncreateTask(@NotNull PlanKey planKey, @NotNull TaskModuleDescriptor taskDescriptor, @Nullable String userDescription, boolean isEnabled, @NotNull List<TaskConditionConfig> conditions, @NotNull Map<String, String> configuration, @NotNull TaskRootDirectorySelector taskRootDirectorySelector) Create a task Definition and save it against the plancreateTask(@NotNull PlanKey planKey, @NotNull TaskModuleDescriptor taskDescriptor, @Nullable String userDescription, boolean isEnabled, @NotNull Map<String, String> configuration, @NotNull TaskRootDirectorySelector taskRootDirectorySelector) Create a task Definition and save it against the planvoidcreateTaskList(PlanKey planKey, @NotNull List<TaskDefinition> taskDefinitions) Initializes task list of a plan with the provided list.voiddeleteTask(@NotNull PlanKey planKey, long taskId) Delete a given taskDefinitioneditTask(@NotNull PlanKey planKey, long taskId, @Nullable String userDescription, boolean isEnabled, @NotNull List<TaskConditionConfig> conditions, @NotNull Map<String, String> taskConfigurationMap, @NotNull TaskRootDirectorySelector taskRootDirectorySelector) Update the details of specific taskDefinitioneditTask(@NotNull PlanKey planKey, long taskId, @Nullable String userDescription, boolean isEnabled, @NotNull Map<String, String> taskConfigurationMap, @NotNull TaskRootDirectorySelector taskRootDirectorySelector) Update the details of specific taskDefinitiongetRelevantTasksForRepositoryId(@NotNull ImmutableJob job, long repositoryId) Return relevantTaskDefinitionfor givenJoband repositoryIdprotected @Nullable TaskDefinitiongetTaskById(@NotNull List<TaskDefinition> tasks, long id) @NotNull Collection<Requirement> getTasksRequirements(@NotNull PlanKey planKey) voidmoveFinalBar(PlanKey planKey, long beforeId, long afterId) Moves the final Bar to a specific location in the list.voidMove a taskDefinition from one spot in its list, to another.setTaskState(@NotNull PlanKey planKey, long taskId, boolean disabled) Update the disable state of specific taskDefinitionvoidupdateRepositoryIdsInJobsTasks(@NotNull Job job, Map<Long, Long> repositoryIdsChanges) Updates task configurations affected by repository edition.
-
Constructor Details
-
TaskConfigurationServiceImpl
public TaskConfigurationServiceImpl(BuildDefinitionManager buildDefinitionManager, TaskManager taskManager, org.apache.struts2.text.TextProvider textProvider, PlanManager planManager, AuditLogService auditLogService, ScopedExclusionService scopedExclusionService)
-
-
Method Details
-
createTask
public TaskDefinition createTask(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull TaskModuleDescriptor taskDescriptor, @Nullable @Nullable String userDescription, boolean isEnabled, @NotNull @NotNull Map<String, String> configuration, @NotNull @NotNull TaskRootDirectorySelector taskRootDirectorySelector) Description copied from interface:TaskConfigurationServiceCreate a task Definition and save it against the plan- Specified by:
createTaskin interfaceTaskConfigurationService- Parameters:
planKey- of the plan to add the taskDefinition to, plan should be BuildabletaskDescriptor- for the taskDefinition to be addeduserDescription- description the user has specified for this taskDefinitionisEnabled- - set enabled/disabled state of the newly created taskconfiguration- configuration from the plugin for this taskDefinitiontaskRootDirectorySelector- - data defining root of working directory of task- Returns:
- the
TaskDefinitioncreated
-
createTask
public TaskDefinition createTask(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull TaskModuleDescriptor taskDescriptor, @Nullable @Nullable String userDescription, boolean isEnabled, @NotNull @NotNull List<TaskConditionConfig> conditions, @NotNull @NotNull Map<String, String> configuration, @NotNull @NotNull TaskRootDirectorySelector taskRootDirectorySelector) Description copied from interface:TaskConfigurationServiceCreate a task Definition and save it against the plan- Specified by:
createTaskin interfaceTaskConfigurationService- Parameters:
planKey- of the plan to add the taskDefinition to, plan should be BuildabletaskDescriptor- for the taskDefinition to be addeduserDescription- description the user has specified for this taskDefinitionisEnabled- - set enabled/disabled state of the newly created taskconditions- - task conditionsconfiguration- configuration from the plugin for this taskDefinitiontaskRootDirectorySelector- - data defining root of working directory of task- Returns:
- the
TaskDefinitioncreated
-
createTaskList
Description copied from interface:TaskConfigurationServiceInitializes task list of a plan with the provided list. WARNING: If plan has existing tasks they are erased. It is assumed that the list is well-formed (i.e. ids are properly initialized) It can be used when automatically creating Jobs.- Specified by:
createTaskListin interfaceTaskConfigurationService- Parameters:
planKey- - the plan the task list belongs totaskDefinitions- - list of the tasks to be added
-
moveTask
public void moveTask(@NotNull @NotNull PlanKey planKey, long taskId, long beforeId, long afterId, boolean isFinal) Description copied from interface:TaskConfigurationServiceMove a taskDefinition from one spot in its list, to another. And save changes. Uses the before and after tasks to ensure that the task list is in the same state the user saw when editing.- Specified by:
moveTaskin interfaceTaskConfigurationService- Parameters:
planKey- the plan the taskDefinition is intaskId- ID of the TaskDefinition to movebeforeId- ID of the taskDefinition that will be before the moving Task, -1 if the beginning of the listafterId- ID of the taskDefinition that will be after the moving Task, -1 if the end of the listisFinal- whether the task being moved is finalising or not, may or may not require changing.
-
deleteTask
Description copied from interface:TaskConfigurationServiceDelete a given taskDefinition- Specified by:
deleteTaskin interfaceTaskConfigurationService- Parameters:
planKey- for the plan to delete the TaskDefinition fromtaskId- of the TaskDefinition to delete.
-
editTask
public TaskDefinition editTask(@NotNull @NotNull PlanKey planKey, long taskId, @Nullable @Nullable String userDescription, boolean isEnabled, @NotNull @NotNull Map<String, String> taskConfigurationMap, @NotNull @NotNull TaskRootDirectorySelector taskRootDirectorySelector) throws IllegalArgumentExceptionDescription copied from interface:TaskConfigurationServiceUpdate the details of specific taskDefinition- Specified by:
editTaskin interfaceTaskConfigurationService- Parameters:
planKey- - the plan the taskDefintion belongs to, must be buildabletaskId- - the taskDefinition to edituserDescription- - new user descriptionisEnabled- - set new enabled/disabled statetaskConfigurationMap- - new task ConfigurationtaskRootDirectorySelector- - data defining root of working directory of task- Returns:
TaskDefinitionwith updates.- Throws:
IllegalArgumentException- if planKey or taskId is invalid.
-
editTask
public TaskDefinition editTask(@NotNull @NotNull PlanKey planKey, long taskId, @Nullable @Nullable String userDescription, boolean isEnabled, @NotNull @NotNull List<TaskConditionConfig> conditions, @NotNull @NotNull Map<String, String> taskConfigurationMap, @NotNull @NotNull TaskRootDirectorySelector taskRootDirectorySelector) throws IllegalArgumentExceptionDescription copied from interface:TaskConfigurationServiceUpdate the details of specific taskDefinition- Specified by:
editTaskin interfaceTaskConfigurationService- Parameters:
planKey- - the plan the taskDefintion belongs to, must be buildabletaskId- - the taskDefinition to edituserDescription- - new user descriptionisEnabled- - set new enabled/disabled stateconditions- - task conditionstaskConfigurationMap- - new task ConfigurationtaskRootDirectorySelector- - data defining root of working directory of task- Returns:
TaskDefinitionwith updates.- Throws:
IllegalArgumentException- if planKey or taskId is invalid.
-
setTaskState
public TaskDefinition setTaskState(@NotNull @NotNull PlanKey planKey, long taskId, boolean disabled) throws IllegalArgumentException Description copied from interface:TaskConfigurationServiceUpdate the disable state of specific taskDefinition- Specified by:
setTaskStatein interfaceTaskConfigurationService- Parameters:
planKey- - the plan the taskDefintion belongs to, must be buildabletaskId- - the taskDefinition to editdisabled- - set new enabled/disabled state- Returns:
TaskDefinitionwith updates.- Throws:
IllegalArgumentException- if planKey or taskId is invalid.
-
getRelevantTasksForRepositoryId
public List<TaskDefinition> getRelevantTasksForRepositoryId(@NotNull @NotNull ImmutableJob job, long repositoryId) Description copied from interface:TaskConfigurationServiceReturn relevantTaskDefinitionfor givenJoband repositoryId- Specified by:
getRelevantTasksForRepositoryIdin interfaceTaskConfigurationService- Parameters:
job-repositoryId-- Returns:
-
updateRepositoryIdsInJobsTasks
public void updateRepositoryIdsInJobsTasks(@NotNull @NotNull Job job, Map<Long, Long> repositoryIdsChanges) Description copied from interface:TaskConfigurationServiceUpdates task configurations affected by repository edition.- Specified by:
updateRepositoryIdsInJobsTasksin interfaceTaskConfigurationService- Parameters:
job-repositoryIdsChanges- mapping between old and new repositories ids
-
getTasksRequirements
@NotNull public @NotNull Collection<Requirement> getTasksRequirements(@NotNull @NotNull PlanKey planKey) Description copied from interface:TaskConfigurationService- Specified by:
getTasksRequirementsin interfaceTaskConfigurationService- Parameters:
planKey-- Returns:
- requirements for the
JobsTaskTypes
-
moveFinalBar
public void moveFinalBar(PlanKey planKey, long beforeId, long afterId) throws IllegalArgumentException, IllegalStateException Description copied from interface:TaskConfigurationServiceMoves the final Bar to a specific location in the list.- Specified by:
moveFinalBarin interfaceTaskConfigurationService- Parameters:
planKey- - the plan the task list belongs tobeforeId- - the id of the task we want before the bar, -1 if beginning of listafterId- - the id of the task we want after the bar, -1 if end of list- Throws:
IllegalArgumentException- if plan does not existIllegalStateException- if task list has changed since move requested
-
getTaskById
@Nullable protected @Nullable TaskDefinition getTaskById(@NotNull @NotNull List<TaskDefinition> tasks, long id)
-