Interface TaskConfiguratorHelper

  • All Known Implementing Classes:
    TaskConfiguratorHelperImpl

    @PublicApi
    public interface TaskConfiguratorHelper
    Bucket of TaskConfigurator helper methods
    • Method Detail

      • populateContextWithConfiguration

        void populateContextWithConfiguration​(@NotNull
                                              @NotNull Map<String,​Object> context,
                                              @NotNull
                                              @NotNull TaskDefinition taskDefinition,
                                              @NotNull
                                              @NotNull Iterable<String> keys)
        Populate Freemarker context with selected data from task configuration.
        Parameters:
        context - Freemarker context
        taskDefinition - source of task configuration
        keys - keys for which values has to be copied
      • populateTaskConfigMapWithActionParameters

        void populateTaskConfigMapWithActionParameters​(@NotNull
                                                       @NotNull Map<String,​String> config,
                                                       @NotNull
                                                       @NotNull ActionParametersMap params,
                                                       @NotNull
                                                       @NotNull Iterable<String> keys)
        Populate task configuration with selected data from action parameters.
        Parameters:
        config - task configuration
        params - action parameters
        keys - keys for which values has to be copied
      • addJdkRequirement

        void addJdkRequirement​(@NotNull
                               @NotNull Set<Requirement> requirements,
                               @NotNull
                               @NotNull TaskDefinition taskDefinition,
                               @NotNull
                               @NotNull String cfgJdkLabel)
        Add JDK requirement if JDK was defined in task configuration
        Parameters:
        requirements - requirements to be modified
        taskDefinition - task definition
        cfgJdkLabel - name of configuration key that specifies JDK label
      • addSystemRequirementFromConfiguration

        void addSystemRequirementFromConfiguration​(@NotNull
                                                   @NotNull Set<Requirement> requirements,
                                                   @NotNull
                                                   @NotNull TaskDefinition taskDefinition,
                                                   @NotNull
                                                   @NotNull String cfgKey,
                                                   @NotNull
                                                   @NotNull String requirementPrefix)
        Add Executable requirement if Executable was defined in task configuration
        Parameters:
        requirements - requirements to be modified
        taskDefinition - task definition
        cfgKey - name of configuration key that specifies label of system requirement to be added
        requirementPrefix - prefix of the system requirement
      • createRequirementFromConfiguration

        @Nullable
        @Nullable Requirement createRequirementFromConfiguration​(@NotNull
                                                                 @NotNull TaskDefinition taskDefinition,
                                                                 @NotNull
                                                                 @NotNull String cfgKey)
        Creates a new Executable requirement if Executable was defined in task configuration
        Parameters:
        taskDefinition - task definition
        cfgKey - name of configuration key that specifies the system requirement
      • validateJdk

        void validateJdk​(@NotNull
                         @NotNull ActionParametersMap params,
                         @NotNull
                         @NotNull ErrorCollection errorCollection)
        Validate JDK definition in action parameters
        Parameters:
        params - action parameters
        errorCollection - target for adding validation errors
      • validateBuilderLabel

        void validateBuilderLabel​(@NotNull
                                  @NotNull ActionParametersMap params,
                                  @NotNull
                                  @NotNull ErrorCollection errorCollection)
        Validate builder definition in action parameters
        Parameters:
        params - action parameters
        errorCollection - target for adding validation errors
      • validateTestResultsFilePattern

        void validateTestResultsFilePattern​(@NotNull
                                            @NotNull ActionParametersMap params,
                                            @NotNull
                                            @NotNull ErrorCollection errorCollection)
        Validate test results file pattern in action parameters
        Parameters:
        params - action parameters
        errorCollection - target for adding validation errors
      • validateTestResultsFilePatternIfCustomPatternSelected

        void validateTestResultsFilePatternIfCustomPatternSelected​(@NotNull
                                                                   @NotNull ActionParametersMap params,
                                                                   @NotNull
                                                                   @NotNull ErrorCollection errorCollection,
                                                                   @NotNull
                                                                   @NotNull String cfgTestResultsFilePatternOptionCustom)
        Validate test results file pattern in action parameters when manual pattern is enabled by an option
        Parameters:
        params - action parameters
        errorCollection - target for adding validation errors
        cfgTestResultsFilePatternOptionCustom - value of an option that enables test results file pattern
      • getTaskDefinition

        @Deprecated
        @NotNull
        @NotNull Optional<TaskDefinition> getTaskDefinition​(@NotNull
                                                            @NotNull ActionParametersMap params)
        Get the task definition for the task defined in the parameter map. This method works for tasks defined in either build or deployment plans.
        Parameters:
        params - The parameter map from the task.
        Returns:
        An Optional containing the existing task definition or empty if this is a new task.
        Throws:
        IllegalArgumentException - if the parameter map does not represent a build or deployment task, or if it represents both a build and deployment plan.
      • extractTaskDefinition

        @NotNull
        @NotNull Optional<TaskDefinition> extractTaskDefinition​(@NotNull
                                                                @NotNull ActionParametersMap params)
        Get the task definition for the task defined in the parameter map. This method works for tasks defined in either build or deployment plans.
        Parameters:
        params - The parameter map from the task.
        Returns:
        An Optional containing the existing task definition or empty if this is a new task.
        Throws:
        IllegalArgumentException - if the parameter map does not represent a build or deployment task, or if it represents both a build and deployment plan.
      • getTaskDefinitions

        @NotNull
        @NotNull List<TaskDefinition> getTaskDefinitions​(ActionParametersMap params)
        Get all the task definitions for the job or environment defined in the parameter map.
        Parameters:
        params - The parameter map from a task in the job or environment.
        Returns:
        A List of TaskDefinitions for all the tasks in the job or environment.
        Throws:
        IllegalArgumentException - if the parameter map does not represent a build or deployment task, or if it represents both a build and deployment plan.