com.atlassian.bamboo.deployments.environments.service
Class EnvironmentTaskServiceImpl

java.lang.Object
  extended by com.atlassian.bamboo.deployments.environments.service.EnvironmentTaskServiceImpl
All Implemented Interfaces:
EnvironmentTaskService

public class EnvironmentTaskServiceImpl
extends Object
implements EnvironmentTaskService


Constructor Summary
EnvironmentTaskServiceImpl(ScopedExclusionService scopedExclusionService, AuditLogService auditLogService, com.opensymphony.xwork2.TextProvider textProvider, EnvironmentDao environmentDao, TaskManager taskManager, PlanScheduler planScheduler, EnvironmentRepositoryLinkDao environmentRepositoryLinkDao, RepositoryDefinitionManager repositoryDefinitionManager)
           
 
Method Summary
 TaskDefinition createTask(long environmentId, TaskModuleDescriptor taskDescriptor, String userDescription, boolean isEnabled, Map<String,String> configuration)
          Create a new task in the environment
 void deleteTask(long environmentId, long taskId)
          Delete a task from the environment
 TaskDefinition editTask(long environmentId, long taskId, String userDescription, boolean isEnabled, Map<String,String> taskConfigurationMap)
          Edit an existing task in the environment
protected  TaskDefinition getTaskById(List<TaskDefinition> tasks, long id)
           
 void moveFinalBar(long environmentId, long beforeId, long afterId)
          Moves the final Bar to a specific location in the list.
 void moveTask(long environmentId, long taskId, long beforeId, long afterId, boolean isFinal)
          Move a taskDefinition from one spot in its list, to another.
 void updateRepositoryIdsInTasks(Environment environment, Map<Long,Long> repositoryIdsChanges)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnvironmentTaskServiceImpl

public EnvironmentTaskServiceImpl(ScopedExclusionService scopedExclusionService,
                                  AuditLogService auditLogService,
                                  com.opensymphony.xwork2.TextProvider textProvider,
                                  EnvironmentDao environmentDao,
                                  TaskManager taskManager,
                                  PlanScheduler planScheduler,
                                  EnvironmentRepositoryLinkDao environmentRepositoryLinkDao,
                                  RepositoryDefinitionManager repositoryDefinitionManager)
Method Detail

createTask

@NotNull
public TaskDefinition createTask(long environmentId,
                                         @NotNull
                                         TaskModuleDescriptor taskDescriptor,
                                         @Nullable
                                         String userDescription,
                                         boolean isEnabled,
                                         @NotNull
                                         Map<String,String> configuration)
                          throws IllegalArgumentException
Description copied from interface: EnvironmentTaskService
Create a new task in the environment

Specified by:
createTask in interface EnvironmentTaskService
Parameters:
environmentId - environment task belongs to
taskDescriptor - of the task type
userDescription - of the configured task
isEnabled - is the Task Enabled
configuration - map of all data to be saved for the task.
Returns:
created taskDefinition
Throws:
IllegalArgumentException - if no environment with environmentId can be found

editTask

public TaskDefinition editTask(long environmentId,
                               long taskId,
                               String userDescription,
                               boolean isEnabled,
                               Map<String,String> taskConfigurationMap)
Description copied from interface: EnvironmentTaskService
Edit an existing task in the environment

Specified by:
editTask in interface EnvironmentTaskService
Parameters:
environmentId - environment task belongs to
taskId - of the task being edited
userDescription - user defined description of the configured task
isEnabled - is the Task Enabled
taskConfigurationMap - map of all data to be saved for the task.
Returns:
taskDefinition with changes applied

deleteTask

public void deleteTask(long environmentId,
                       long taskId)
Description copied from interface: EnvironmentTaskService
Delete a task from the environment

Specified by:
deleteTask in interface EnvironmentTaskService
Parameters:
environmentId - environment task belongs to
taskId - task to delete

moveTask

public void moveTask(long environmentId,
                     long taskId,
                     long beforeId,
                     long afterId,
                     boolean isFinal)
Description copied from interface: EnvironmentTaskService
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 EnvironmentTaskService
Parameters:
environmentId - the environment 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.

moveFinalBar

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

Specified by:
moveFinalBar in interface EnvironmentTaskService
Parameters:
environmentId - - the environment 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:
IllegalArgumentException - if environment does not exist
IllegalStateException - if task list has changed since move requested

updateRepositoryIdsInTasks

public void updateRepositoryIdsInTasks(@NotNull
                                       Environment environment,
                                       Map<Long,Long> repositoryIdsChanges)
Specified by:
updateRepositoryIdsInTasks in interface EnvironmentTaskService

getTaskById

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


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