com.atlassian.bamboo.task
Class TaskConfigurationServiceImpl

java.lang.Object
  extended by com.atlassian.bamboo.task.TaskConfigurationServiceImpl
All Implemented Interfaces:
TaskConfigurationService

public class TaskConfigurationServiceImpl
extends java.lang.Object
implements TaskConfigurationService


Constructor Summary
TaskConfigurationServiceImpl(BuildDefinitionManager buildDefinitionManager, TaskManager taskManager, BuildDefinitionConverter buildDefinitionConverter, com.opensymphony.xwork.TextProvider textProvider, PlanManager planManager, AuditLogService auditLogService, ScopedExclusionService scopedExclusionService)
           
 
Method Summary
protected  java.util.List<TaskDefinition> addTaskToList(java.util.List<TaskDefinition> originalTasks, TaskDefinition toAdd)
           
protected  void adjustFinalisingBar(java.util.List<TaskDefinition> tasks, long beforeId, long afterId)
           
 TaskDefinition createTask(PlanKey planKey, TaskModuleDescriptor taskDescriptor, java.lang.String userDescription, java.util.Map<java.lang.String,java.lang.String> configuration, TaskRootDirectorySelector taskRootDirectorySelector)
          Create a task Definition and save it against the plan
 void createTaskList(PlanKey planKey, java.util.List<TaskDefinition> taskDefinitions)
          Initializes task list of a plan with the provided list.
 void deleteTask(PlanKey planKey, long taskId)
          Delete a given taskDefinition
 TaskDefinition editTask(PlanKey planKey, long taskId, java.lang.String userDescription, java.util.Map<java.lang.String,java.lang.String> taskConfigurationMap, TaskRootDirectorySelector taskRootDirectorySelector)
          Update the details of specific taskDefinition
protected  java.util.List<TaskDefinition> getNewTaskList(java.util.List<TaskDefinition> originalTasks, TaskDefinition toMove, long beforeId, long afterId, boolean isFinal)
           
 java.util.List<TaskDefinition> getRelevantTasksForRepositoryId(Job job, long repositoryId)
          Return relevant TaskDefinition for given Job and repositoryId
protected  TaskDefinition getTaskById(java.util.List<TaskDefinition> tasks, long id)
           
 java.util.Collection<Requirement> getTasksRequirements(PlanKey planKey)
          Return Requirements for all tasks of Plan represented by PlanKey
 void moveFinalBar(PlanKey planKey, long beforeId, long afterId)
          Moves the final Bar to a specific location in the list.
 void moveTask(PlanKey planKey, long taskId, long beforeId, long afterId, boolean isFinal)
          Move a taskDefinition from one spot in its list, to another.
 void updateRepositoryIdsInJobsTasks(Job job, java.util.Map<java.lang.Long,java.lang.Long> repositoryIdsChanges)
          Updates task configurations affected by repository edition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskConfigurationServiceImpl

public TaskConfigurationServiceImpl(BuildDefinitionManager buildDefinitionManager,
                                    TaskManager taskManager,
                                    BuildDefinitionConverter buildDefinitionConverter,
                                    com.opensymphony.xwork.TextProvider textProvider,
                                    PlanManager planManager,
                                    AuditLogService auditLogService,
                                    ScopedExclusionService scopedExclusionService)
Method Detail

createTask

public TaskDefinition createTask(@NotNull
                                 PlanKey planKey,
                                 @NotNull
                                 TaskModuleDescriptor taskDescriptor,
                                 @Nullable
                                 java.lang.String userDescription,
                                 @NotNull
                                 java.util.Map<java.lang.String,java.lang.String> configuration,
                                 @NotNull
                                 TaskRootDirectorySelector taskRootDirectorySelector)
Description copied from interface: TaskConfigurationService
Create a task Definition and save it against the plan

Specified by:
createTask in interface TaskConfigurationService
Parameters:
planKey - of the plan to add the taskDefinition to, plan should be Buildable
taskDescriptor - for the taskDefinition to be added
userDescription - description the user has specified for this taskDefinition
configuration - configuration from the plugin for this taskDefinition
taskRootDirectorySelector - - data defining root of working directory of task
Returns:
the TaskDefinition created

createTaskList

public void createTaskList(PlanKey planKey,
                           @NotNull
                           java.util.List<TaskDefinition> taskDefinitions)
Description copied from interface: TaskConfigurationService
Initializes task list of a plan with the provided list. If plan has existing tasks they are erased. It is assumed that the list is well-formed (i.e. ids are properly initialized)

Specified by:
createTaskList in interface TaskConfigurationService
Parameters:
planKey - - the plan the task list belongs to
taskDefinitions - - list of the tasks to be added

moveTask

public void moveTask(@NotNull
                     PlanKey planKey,
                     long taskId,
                     long beforeId,
                     long afterId,
                     boolean isFinal)
Description copied from interface: TaskConfigurationService
Move 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:
moveTask in interface TaskConfigurationService
Parameters:
planKey - the plan the taskDefinition is in
taskId - ID of the TaskDefinition to move
beforeId - ID of the taskDefinition that will be before the moving Task, -1 if the beginning of the list
afterId - ID of the taskDefinition that will be after the moving Task, -1 if the end of the list
isFinal - whether the task being moved is finalising or not, may or may not require changing.

deleteTask

public void deleteTask(@NotNull
                       PlanKey planKey,
                       long taskId)
Description copied from interface: TaskConfigurationService
Delete a given taskDefinition

Specified by:
deleteTask in interface TaskConfigurationService
Parameters:
planKey - for the plan to delete the TaskDefinition from
taskId - of the TaskDefinition to delete.

editTask

public TaskDefinition editTask(@NotNull
                               PlanKey planKey,
                               long taskId,
                               @Nullable
                               java.lang.String userDescription,
                               @NotNull
                               java.util.Map<java.lang.String,java.lang.String> taskConfigurationMap,
                               @NotNull
                               TaskRootDirectorySelector taskRootDirectorySelector)
                        throws java.lang.IllegalArgumentException
Description copied from interface: TaskConfigurationService
Update the details of specific taskDefinition

Specified by:
editTask in interface TaskConfigurationService
Parameters:
planKey - - the plan the taskDefintion belongs to, must be buildable
taskId - - the taskDefinition to edit
userDescription - - new user description
taskConfigurationMap - - new task Configuration
taskRootDirectorySelector - - data defining root of working directory of task
Returns:
TaskDefinition with updates.
Throws:
java.lang.IllegalArgumentException - if planKey or taskId is invalid.

getRelevantTasksForRepositoryId

public java.util.List<TaskDefinition> getRelevantTasksForRepositoryId(@NotNull
                                                                      Job job,
                                                                      long repositoryId)
Description copied from interface: TaskConfigurationService
Return relevant TaskDefinition for given Job and repositoryId

Specified by:
getRelevantTasksForRepositoryId in interface TaskConfigurationService
Returns:

updateRepositoryIdsInJobsTasks

public void updateRepositoryIdsInJobsTasks(@NotNull
                                           Job job,
                                           java.util.Map<java.lang.Long,java.lang.Long> repositoryIdsChanges)
Description copied from interface: TaskConfigurationService
Updates task configurations affected by repository edition.

Specified by:
updateRepositoryIdsInJobsTasks in interface TaskConfigurationService
repositoryIdsChanges - mapping between old and new repositories ids

getTasksRequirements

@NotNull
public java.util.Collection<Requirement> getTasksRequirements(@NotNull
                                                                      PlanKey planKey)
Description copied from interface: TaskConfigurationService
Return Requirements for all tasks of Plan represented by PlanKey

Specified by:
getTasksRequirements in interface TaskConfigurationService
Returns:
requirements for the Jobs TaskTypes

moveFinalBar

public void moveFinalBar(PlanKey planKey,
                         long beforeId,
                         long afterId)
                  throws java.lang.IllegalArgumentException,
                         java.lang.IllegalStateException
Description copied from interface: TaskConfigurationService
Moves the final Bar to a specific location in the list.

Specified by:
moveFinalBar in interface TaskConfigurationService
Parameters:
planKey - - the plan the task list belongs to
beforeId - - the id of the task we want before the bar, -1 if beginning of list
afterId - - the id of the task we want after the bar, -1 if end of list
Throws:
java.lang.IllegalArgumentException - if plan does not exist
java.lang.IllegalStateException - if task list has changed since move requested

getTaskById

@Nullable
protected TaskDefinition getTaskById(@NotNull
                                              java.util.List<TaskDefinition> tasks,
                                              long id)

adjustFinalisingBar

protected void adjustFinalisingBar(@NotNull
                                   java.util.List<TaskDefinition> tasks,
                                   long beforeId,
                                   long afterId)

getNewTaskList

@NotNull
protected java.util.List<TaskDefinition> getNewTaskList(@NotNull
                                                                java.util.List<TaskDefinition> originalTasks,
                                                                @NotNull
                                                                TaskDefinition toMove,
                                                                long beforeId,
                                                                long afterId,
                                                                boolean isFinal)

addTaskToList

@NotNull
protected java.util.List<TaskDefinition> addTaskToList(@NotNull
                                                               java.util.List<TaskDefinition> originalTasks,
                                                               @NotNull
                                                               TaskDefinition toAdd)


Copyright © 2012 Atlassian. All Rights Reserved.