Package com.atlassian.bamboo.fieldvalue
Class TaskConfigurationUtils
- java.lang.Object
-
- com.atlassian.bamboo.fieldvalue.TaskConfigurationUtils
-
@Internal public class TaskConfigurationUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
TASK_CONFIG_ROOT
static String
TASK_PREFIX
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addTaskDefinitionsToConfig(@Nullable List<TaskDefinition> taskDefinitions, @NotNull org.apache.commons.configuration.HierarchicalConfiguration config, @NotNull String taskPrefix)
Adds tasks to a build configurationstatic @NotNull List<TaskDefinition>
addTaskToList(@NotNull List<TaskDefinition> originalTasks, @NotNull TaskDefinition toAdd)
static void
adjustFinalisingBar(@NotNull List<TaskDefinition> tasks, long beforeId, long afterId)
static @Nullable BambooEntityOid
getMaxTaskOid(int serverKey)
Returns the maxBambooEntityOid
that's currently in use ofBambooEntityType.TASK
type, with the given server key.static @NotNull List<TaskDefinition>
getNewTaskList(@NotNull List<TaskDefinition> originalTasks, @NotNull TaskDefinition toMove, long beforeId, long afterId, boolean isFinal)
static @NotNull List<TaskDefinition>
getTaskDefinitionsFromConfig(String taskPrefix, org.apache.commons.configuration.HierarchicalConfiguration fromConfig)
Retrieves tasks from build configurationstatic long
getUniqueId(@NotNull List<TaskDefinition> tasks)
Returns id of task that is not used in provided list.static void
removeTasksFromConfig(org.apache.commons.configuration.HierarchicalConfiguration config)
Removes all tasks from build configurationstatic @NotNull Optional<List<TaskDefinition>>
replaceCapabilityLabelInTasks(@NotNull List<TaskDefinition> taskDefinitions, @NotNull String keyToReplace, @NotNull String oldCapabilityLabel, @NotNull String newCapabilityLabel, @NotNull String oldCapabilityKey, @NotNull String newCapabilityKey)
Replaces references to a capability in tasks from the list with a new capability key.
-
-
-
Field Detail
-
TASK_CONFIG_ROOT
public static final String TASK_CONFIG_ROOT
- See Also:
- Constant Field Values
-
TASK_PREFIX
public static final String TASK_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
removeTasksFromConfig
public static void removeTasksFromConfig(org.apache.commons.configuration.HierarchicalConfiguration config)
Removes all tasks from build configuration- Parameters:
config
-
-
addTaskDefinitionsToConfig
public static void addTaskDefinitionsToConfig(@Nullable @Nullable List<TaskDefinition> taskDefinitions, @NotNull @NotNull org.apache.commons.configuration.HierarchicalConfiguration config, @NotNull @NotNull String taskPrefix)
Adds tasks to a build configuration- Parameters:
taskDefinitions
-config
-taskPrefix
-
-
getTaskDefinitionsFromConfig
@NotNull public static @NotNull List<TaskDefinition> getTaskDefinitionsFromConfig(String taskPrefix, org.apache.commons.configuration.HierarchicalConfiguration fromConfig)
Retrieves tasks from build configuration- Parameters:
taskPrefix
-fromConfig
-- Returns:
-
getUniqueId
public static long getUniqueId(@NotNull @NotNull List<TaskDefinition> tasks)
Returns id of task that is not used in provided list.- Parameters:
tasks
-- Returns:
-
addTaskToList
@NotNull public static @NotNull List<TaskDefinition> addTaskToList(@NotNull @NotNull List<TaskDefinition> originalTasks, @NotNull @NotNull TaskDefinition toAdd)
-
adjustFinalisingBar
public static void adjustFinalisingBar(@NotNull @NotNull List<TaskDefinition> tasks, long beforeId, long afterId)
-
getNewTaskList
@NotNull public static @NotNull List<TaskDefinition> getNewTaskList(@NotNull @NotNull List<TaskDefinition> originalTasks, @NotNull @NotNull TaskDefinition toMove, long beforeId, long afterId, boolean isFinal)
-
getMaxTaskOid
@Nullable public static @Nullable BambooEntityOid getMaxTaskOid(int serverKey)
Returns the maxBambooEntityOid
that's currently in use ofBambooEntityType.TASK
type, with the given server key. Returns null if no OIDs are in use of this type with the given server key.
-
replaceCapabilityLabelInTasks
@NotNull public static @NotNull Optional<List<TaskDefinition>> replaceCapabilityLabelInTasks(@NotNull @NotNull List<TaskDefinition> taskDefinitions, @NotNull @NotNull String keyToReplace, @NotNull @NotNull String oldCapabilityLabel, @NotNull @NotNull String newCapabilityLabel, @NotNull @NotNull String oldCapabilityKey, @NotNull @NotNull String newCapabilityKey)
Replaces references to a capability in tasks from the list with a new capability key.- Returns:
- modified task list, or empty if no changes performed
-
-