Interface TaskDefinitionExporter

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default <T extends com.atlassian.bamboo.specs.api.builders.task.Task<T,​P>,​P extends com.atlassian.bamboo.specs.api.model.task.TaskProperties>
      T
      fromYaml​(@NotNull Node node, @NotNull TaskValidationContext context)
      Parse YAML node to Task Specs builder.
      default <T extends com.atlassian.bamboo.specs.api.builders.task.Task<T,​P>,​P extends com.atlassian.bamboo.specs.api.model.task.TaskProperties>
      T
      toSpecsEntity​(@NotNull TaskContainer taskContainer, @NotNull TaskDefinition taskDefinition)
      Create Bamboo Specs object representing this task.
      <T extends com.atlassian.bamboo.specs.api.builders.task.Task<T,​P>,​P extends com.atlassian.bamboo.specs.api.model.task.TaskProperties>
      T
      toSpecsEntity​(@NotNull TaskDefinition taskDefinition)
      Create Bamboo Specs object representing this task.
      @NotNull Map<String,​String> toTaskConfiguration​(@NotNull TaskContainer taskContainer, @NotNull com.atlassian.bamboo.specs.api.model.task.TaskProperties taskProperties)
      Converts properties to Bamboo task configuration.
      default @NotNull Map<String,​String> toTaskConfiguration​(@NotNull TaskContainer taskContainer, @NotNull List<TaskDefinition> precedingTasks, @NotNull com.atlassian.bamboo.specs.api.model.task.TaskProperties taskProperties)
      Converts properties to Bamboo task configuration.
      default @NotNull Map<String,​String> toTaskConfiguration​(@NotNull TaskContainer taskContainer, @NotNull List<TaskDefinition> precedingTasks, @NotNull com.atlassian.bamboo.specs.api.model.task.TaskProperties taskProperties, @Nullable VcsBranch importedBranch)
      Converts properties to Bamboo task configuration.
      default <T extends com.atlassian.bamboo.specs.api.model.task.TaskProperties>
      @Nullable Node
      toYaml​(T taskProperties)
      Convert task definition to YAML node.
      @NotNull List<com.atlassian.bamboo.specs.api.validators.common.ValidationProblem> validate​(@NotNull TaskValidationContext taskValidationContext, @NotNull com.atlassian.bamboo.specs.api.model.task.TaskProperties taskProperties)
      Validates task properties in context of enclosing plan or deployment properties.
    • Method Detail

      • toTaskConfiguration

        @NotNull
        @NotNull Map<String,​String> toTaskConfiguration​(@NotNull
                                                              @NotNull TaskContainer taskContainer,
                                                              @NotNull
                                                              @NotNull com.atlassian.bamboo.specs.api.model.task.TaskProperties taskProperties)
        Converts properties to Bamboo task configuration. Can use all Bamboo server side services and can access DB if necessary. Should throw a runtime exception if conversion fails.
        Parameters:
        taskContainer - current task container (a job or an environment for instance)
        taskProperties - the current task
        Returns:
        task configuration
      • toTaskConfiguration

        @NotNull
        default @NotNull Map<String,​String> toTaskConfiguration​(@NotNull
                                                                      @NotNull TaskContainer taskContainer,
                                                                      @NotNull
                                                                      @NotNull List<TaskDefinition> precedingTasks,
                                                                      @NotNull
                                                                      @NotNull com.atlassian.bamboo.specs.api.model.task.TaskProperties taskProperties)
        Converts properties to Bamboo task configuration. Can use all Bamboo server side services and can access DB if necessary. Should throw a runtime exception if conversion fails.
        Parameters:
        taskContainer - current task container (a job or an environment for instance)
        precedingTasks - list of tasks declared before the current one
        taskProperties - the current task
        Returns:
        task configuration
        Since:
        6.1.0
      • toTaskConfiguration

        @NotNull
        default @NotNull Map<String,​String> toTaskConfiguration​(@NotNull
                                                                      @NotNull TaskContainer taskContainer,
                                                                      @NotNull
                                                                      @NotNull List<TaskDefinition> precedingTasks,
                                                                      @NotNull
                                                                      @NotNull com.atlassian.bamboo.specs.api.model.task.TaskProperties taskProperties,
                                                                      @Nullable
                                                                      @Nullable VcsBranch importedBranch)
        Converts properties to Bamboo task configuration. Can use all Bamboo server side services and can access DB if necessary. Should throw a runtime exception if conversion fails.
        Parameters:
        taskContainer - current task container (a job or an environment for instance)
        precedingTasks - list of tasks declared before the current one
        taskProperties - the current task
        importedBranch - imported branch if importing a divergent branch
        Returns:
        task configuration
        Since:
        7.0.4
      • toSpecsEntity

        @NotNull
        <T extends com.atlassian.bamboo.specs.api.builders.task.Task<T,​P>,​P extends com.atlassian.bamboo.specs.api.model.task.TaskProperties> T toSpecsEntity​(@NotNull
                                                                                                                                                                          @NotNull TaskDefinition taskDefinition)
        Create Bamboo Specs object representing this task. Implementors don't need to handle common task properties like e.g. enabled/disabled, but must task specific configuration.
      • toYaml

        @Nullable
        default <T extends com.atlassian.bamboo.specs.api.model.task.TaskProperties> @Nullable Node toYaml​(@NotNull
                                                                                                           T taskProperties)
        Convert task definition to YAML node. Bamboo might modify returned node to add information about task conditions or other general task settings. To make it compatible with future versions returned value should be StringNode or MapNode (String, Map). Structure MapNode (String, String) can't be enriched with additional elements and cause runtime failures for some cases.
        Returns:
        YAML representation of the task.
        Since:
        7.1
      • fromYaml

        @Nullable
        default <T extends com.atlassian.bamboo.specs.api.builders.task.Task<T,​P>,​P extends com.atlassian.bamboo.specs.api.model.task.TaskProperties> T fromYaml​(@NotNull
                                                                                                                                                                             @NotNull Node node,
                                                                                                                                                                             @NotNull
                                                                                                                                                                             @NotNull TaskValidationContext context)
                                                                                                                                                                      throws YamlSpecsValidationException
        Parse YAML node to Task Specs builder.
        Parameters:
        node - YAML node from user input. In general case it's same node generated by toYaml(TaskProperties) method, but in some cases it might contain additional general task elements, like conditions. These elements should be ignored by method implementation and will be handled by Bamboo code. In such case MapNode handler should be implemented even if toYaml(TaskProperties) produces StringNode.
        context - task validation context
        Throws:
        YamlSpecsValidationException
        Since:
        7.1
      • toSpecsEntity

        @NotNull
        default <T extends com.atlassian.bamboo.specs.api.builders.task.Task<T,​P>,​P extends com.atlassian.bamboo.specs.api.model.task.TaskProperties> T toSpecsEntity​(@NotNull
                                                                                                                                                                                  @NotNull TaskContainer taskContainer,
                                                                                                                                                                                  @NotNull
                                                                                                                                                                                  @NotNull TaskDefinition taskDefinition)
        Create Bamboo Specs object representing this task. Implementors don't need to handle common task properties like e.g. enabled/disabled, but must task specific configuration.
        Since:
        6.1
      • validate

        @NotNull
        @NotNull List<com.atlassian.bamboo.specs.api.validators.common.ValidationProblem> validate​(@NotNull
                                                                                                   @NotNull TaskValidationContext taskValidationContext,
                                                                                                   @NotNull
                                                                                                   @NotNull com.atlassian.bamboo.specs.api.model.task.TaskProperties taskProperties)
        Validates task properties in context of enclosing plan or deployment properties. Should check for any inconsistencies between task definition and the rest of plan or deployment content, as it is provided in the validation context. Returns list of validation errors or empty if everything is ok.

        Should check RSS permissions if necessary.