Package com.atlassian.bamboo.task
Class TaskConfiguratorHelperImpl
java.lang.Object
com.atlassian.bamboo.task.TaskConfiguratorHelperImpl
- All Implemented Interfaces:
TaskConfiguratorHelper
-
Constructor Summary
ConstructorDescriptionTaskConfiguratorHelperImpl
(BuildDefinitionManager buildDefinitionManager, EnvironmentService environmentService, com.opensymphony.xwork2.TextProvider textProvider) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addJdkRequirement
(@NotNull Set<Requirement> requirements, @NotNull TaskDefinition taskDefinition, @NotNull String cfgJdkLabel) Add JDK requirement if JDK was defined in task configurationvoid
addSystemRequirementFromConfiguration
(@NotNull Set<Requirement> requirements, @NotNull TaskDefinition taskDefinition, @NotNull String cfgKey, @NotNull String requirementPrefix) Add Executable requirement if Executable was defined in task configuration@Nullable Requirement
createRequirementFromConfiguration
(@NotNull TaskDefinition taskDefinition, @NotNull String cfgKey) Creates a new Executable requirement if Executable was defined in task configuration@NotNull Optional<TaskDefinition>
extractTaskDefinition
(@NotNull ActionParametersMap params) Get the task definition for the task defined in the parameter map.@NotNull Optional<TaskDefinition>
getTaskDefinition
(@NotNull ActionParametersMap params) Get the task definition for the task defined in the parameter map.@NotNull List<TaskDefinition>
Get all the task definitions for the job or environment defined in the parameter map.void
populateContextWithConfiguration
(@NotNull Map<String, Object> context, @NotNull TaskDefinition taskDefinition, @NotNull Iterable<String> keys) Populate Freemarker context with selected data from task configuration.void
populateTaskConfigMapWithActionParameters
(@NotNull Map<String, String> config, @NotNull ActionParametersMap params, @NotNull Iterable<String> keys) Populate task configuration with selected data from action parameters.void
validateBuilderLabel
(@NotNull ActionParametersMap params, @NotNull ErrorCollection errorCollection) Validate builder definition in action parametersvoid
validateJdk
(@NotNull ActionParametersMap params, @NotNull ErrorCollection errorCollection) Validate JDK definition in action parametersvoid
validateTestResultsFilePattern
(@NotNull ActionParametersMap params, @NotNull ErrorCollection errorCollection) Validate test results file pattern in action parametersvoid
validateTestResultsFilePatternIfCustomPatternSelected
(@NotNull ActionParametersMap params, @NotNull ErrorCollection errorCollection, @NotNull String cfgTestResultsFilePatternOptionCustom) Validate test results file pattern in action parameters when manual pattern is enabled by an option
-
Constructor Details
-
TaskConfiguratorHelperImpl
public TaskConfiguratorHelperImpl(BuildDefinitionManager buildDefinitionManager, EnvironmentService environmentService, com.opensymphony.xwork2.TextProvider textProvider)
-
-
Method Details
-
populateContextWithConfiguration
public void populateContextWithConfiguration(@NotNull @NotNull Map<String, Object> context, @NotNull @NotNull TaskDefinition taskDefinition, @NotNull @NotNull Iterable<String> keys) Description copied from interface:TaskConfiguratorHelper
Populate Freemarker context with selected data from task configuration.- Specified by:
populateContextWithConfiguration
in interfaceTaskConfiguratorHelper
- Parameters:
context
- Freemarker contexttaskDefinition
- source of task configurationkeys
- keys for which values has to be copied
-
populateTaskConfigMapWithActionParameters
public void populateTaskConfigMapWithActionParameters(@NotNull @NotNull Map<String, String> config, @NotNull @NotNull ActionParametersMap params, @NotNull @NotNull Iterable<String> keys) Description copied from interface:TaskConfiguratorHelper
Populate task configuration with selected data from action parameters.- Specified by:
populateTaskConfigMapWithActionParameters
in interfaceTaskConfiguratorHelper
- Parameters:
config
- task configurationparams
- action parameterskeys
- keys for which values has to be copied
-
addJdkRequirement
public void addJdkRequirement(@NotNull @NotNull Set<Requirement> requirements, @NotNull @NotNull TaskDefinition taskDefinition, @NotNull @NotNull String cfgJdkLabel) Description copied from interface:TaskConfiguratorHelper
Add JDK requirement if JDK was defined in task configuration- Specified by:
addJdkRequirement
in interfaceTaskConfiguratorHelper
- Parameters:
requirements
- requirements to be modifiedtaskDefinition
- task definitioncfgJdkLabel
- name of configuration key that specifies JDK label
-
addSystemRequirementFromConfiguration
public void addSystemRequirementFromConfiguration(@NotNull @NotNull Set<Requirement> requirements, @NotNull @NotNull TaskDefinition taskDefinition, @NotNull @NotNull String cfgKey, @NotNull @NotNull String requirementPrefix) Description copied from interface:TaskConfiguratorHelper
Add Executable requirement if Executable was defined in task configuration- Specified by:
addSystemRequirementFromConfiguration
in interfaceTaskConfiguratorHelper
- Parameters:
requirements
- requirements to be modifiedtaskDefinition
- task definitioncfgKey
- name of configuration key that specifies label of system requirement to be addedrequirementPrefix
- prefix of the system requirement
-
createRequirementFromConfiguration
@Nullable public @Nullable Requirement createRequirementFromConfiguration(@NotNull @NotNull TaskDefinition taskDefinition, @NotNull @NotNull String cfgKey) Description copied from interface:TaskConfiguratorHelper
Creates a new Executable requirement if Executable was defined in task configuration- Specified by:
createRequirementFromConfiguration
in interfaceTaskConfiguratorHelper
- Parameters:
taskDefinition
- task definitioncfgKey
- name of configuration key that specifies the system requirement
-
validateJdk
public void validateJdk(@NotNull @NotNull ActionParametersMap params, @NotNull @NotNull ErrorCollection errorCollection) Description copied from interface:TaskConfiguratorHelper
Validate JDK definition in action parameters- Specified by:
validateJdk
in interfaceTaskConfiguratorHelper
- Parameters:
params
- action parameterserrorCollection
- target for adding validation errors
-
validateBuilderLabel
public void validateBuilderLabel(@NotNull @NotNull ActionParametersMap params, @NotNull @NotNull ErrorCollection errorCollection) Description copied from interface:TaskConfiguratorHelper
Validate builder definition in action parameters- Specified by:
validateBuilderLabel
in interfaceTaskConfiguratorHelper
- Parameters:
params
- action parameterserrorCollection
- target for adding validation errors
-
validateTestResultsFilePattern
public void validateTestResultsFilePattern(@NotNull @NotNull ActionParametersMap params, @NotNull @NotNull ErrorCollection errorCollection) Description copied from interface:TaskConfiguratorHelper
Validate test results file pattern in action parameters- Specified by:
validateTestResultsFilePattern
in interfaceTaskConfiguratorHelper
- Parameters:
params
- action parameterserrorCollection
- target for adding validation errors
-
validateTestResultsFilePatternIfCustomPatternSelected
public void validateTestResultsFilePatternIfCustomPatternSelected(@NotNull @NotNull ActionParametersMap params, @NotNull @NotNull ErrorCollection errorCollection, @NotNull @NotNull String cfgTestResultsFilePatternOptionCustom) Description copied from interface:TaskConfiguratorHelper
Validate test results file pattern in action parameters when manual pattern is enabled by an option- Specified by:
validateTestResultsFilePatternIfCustomPatternSelected
in interfaceTaskConfiguratorHelper
- Parameters:
params
- action parameterserrorCollection
- target for adding validation errorscfgTestResultsFilePatternOptionCustom
- value of an option that enables test results file pattern
-
getTaskDefinition
@NotNull public @NotNull Optional<TaskDefinition> getTaskDefinition(@NotNull @NotNull ActionParametersMap params) Description copied from interface:TaskConfiguratorHelper
Get the task definition for the task defined in the parameter map. This method works for tasks defined in either build or deployment plans.- Specified by:
getTaskDefinition
in interfaceTaskConfiguratorHelper
- Parameters:
params
- The parameter map from the task.- Returns:
- An
Optional<TaskDefinition>
containing the existing task definition or empty if this is a new task.
-
extractTaskDefinition
@NotNull public @NotNull Optional<TaskDefinition> extractTaskDefinition(@NotNull @NotNull ActionParametersMap params) Description copied from interface:TaskConfiguratorHelper
Get the task definition for the task defined in the parameter map. This method works for tasks defined in either build or deployment plans.- Specified by:
extractTaskDefinition
in interfaceTaskConfiguratorHelper
- Parameters:
params
- The parameter map from the task.- Returns:
- An
Optional<TaskDefinition>
containing the existing task definition or empty if this is a new task.
-
getTaskDefinitions
Description copied from interface:TaskConfiguratorHelper
Get all the task definitions for the job or environment defined in the parameter map.- Specified by:
getTaskDefinitions
in interfaceTaskConfiguratorHelper
- Parameters:
params
- The parameter map from a task in the job or environment.- Returns:
- A List of
TaskDefinition
s for all the tasks in the job or environment.
-