org.springframework.cloud.dataflow.server.controller

## Class TaskDefinitionController

- java.lang.Object
- - org.springframework.cloud.dataflow.server.controller.TaskDefinitionController

-     @RestController
       @RequestMapping(value="/tasks/definitions")
       @ExposesResourceFor(value=TaskDefinitionResource.class)
      public class TaskDefinitionController
      extends Object

  Controller for operations on `TaskDefinition`. This includes CRUD operations.
  Author:
    Michael Minella, Marius Bogoevici, Glenn Renfro, Mark Fisher, Gunnar Hillert, Daniel Serleg, Ilayaperumal Gopinathan

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TaskDefinitionController(org.springframework.cloud.task.repository.TaskExplorer taskExplorer, TaskDefinitionRepository repository, TaskSaveService taskSaveService, TaskDeleteService taskDeleteService, TaskDefinitionAssemblerProvider<? extends TaskDefinitionResource> taskDefinitionAssemblerProvider)` Creates a `TaskDefinitionController` that delegates CRUD operations to the provided `TaskDefinitionRepository` task status checks to the provided `TaskLauncher`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `destroyAll()` Delete all task from the repository.
    `void` | `destroyTask(String name, Boolean cleanup)` Delete the task from the repository so that it can no longer be executed.
    `TaskDefinitionResource` | `display(String name, boolean manifest)` Return a given task definition resource.
    `org.springframework.hateoas.PagedModel<? extends TaskDefinitionResource>` | `list(org.springframework.data.domain.Pageable pageable, String search, boolean manifest, String dslText, org.springframework.data.web.PagedResourcesAssembler<TaskExecutionAwareTaskDefinition> assembler)` Return a page-able list of `TaskDefinitionResource` defined tasks.
    `TaskDefinitionResource` | `save(String name, String dsl, String description)` Register a task definition for future execution.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TaskDefinitionController

          public TaskDefinitionController(org.springframework.cloud.task.repository.TaskExplorer taskExplorer,
                                          TaskDefinitionRepository repository,
                                          TaskSaveService taskSaveService,
                                          TaskDeleteService taskDeleteService,
                                          TaskDefinitionAssemblerProvider<? extends TaskDefinitionResource> taskDefinitionAssemblerProvider)

      Creates a `TaskDefinitionController` that delegates
      - CRUD operations to the provided `TaskDefinitionRepository`
      - task status checks to the provided `TaskLauncher`
      Parameters:
        `taskExplorer` - used to look up TaskExecutions.
        `repository` - the repository this controller will use for task CRUD operations.
        `taskSaveService` - handles Task saving related operations.
        `taskDeleteService` - handles Task deletion related operations.
        `taskDefinitionAssemblerProvider` - the task definition assembler provider to use.

  - ### Method Detail

    - #### save

          @RequestMapping(value="",
                          method=POST)
          public TaskDefinitionResource save(@RequestParam(value="name")
                                                                                                    String name,
                                                                                                    @RequestParam(value="definition")
                                                                                                    String dsl,
                                                                                                    @RequestParam(value="description",defaultValue="")
                                                                                                    String description)

      Register a task definition for future execution.
      Parameters:
        `name` - name the name of the task
        `dsl` - DSL definition for the task
        `description` - description of the task definition
      Returns:
        the task definition

    - #### destroyTask

          @RequestMapping(value="/{name}",
                          method=DELETE)
           @ResponseStatus(value=OK)
          public void destroyTask(@PathVariable(value="name")
                                                                                                                             String name,
                                                                                                                             @RequestParam(required=false)
                                                                                                                             Boolean cleanup)

      Delete the task from the repository so that it can no longer be executed.
      Parameters:
        `name` - name of the task to be deleted

    - #### destroyAll

          @RequestMapping(value="",
                          method=DELETE)
           @ResponseStatus(value=OK)
          public void destroyAll()

      Delete all task from the repository.

    - #### list

          @RequestMapping(value="",
                          method=GET)
           @ResponseStatus(value=OK)
          public org.springframework.hateoas.PagedModel<? extends TaskDefinitionResource> list(org.springframework.data.domain.Pageable pageable,
                                                                                                                                                                                @RequestParam(required=false)
                                                                                                                                                                                String search,
                                                                                                                                                                                @RequestParam(required=false)
                                                                                                                                                                                boolean manifest,
                                                                                                                                                                                @RequestParam(required=false)
                                                                                                                                                                                String dslText,
                                                                                                                                                                                org.springframework.data.web.PagedResourcesAssembler<TaskExecutionAwareTaskDefinition> assembler)

      Return a page-able list of `TaskDefinitionResource` defined tasks.
      Parameters:
        `pageable` - page-able collection of `TaskDefinitionResource`
        `search` - optional findByTaskNameContains parameter
        `dslText` - optional findByDslText parameter
        `manifest` - optional manifest flag to indicate whether the latest task execution requires task manifest update
        `assembler` - assembler for the `TaskDefinition`
      Returns:
        a list of task definitions

    - #### display

          @RequestMapping(value="/{name}",
                          method=GET)
           @ResponseStatus(value=OK)
          public TaskDefinitionResource display(@PathVariable(value="name")
                                                                                                                                        String name,
                                                                                                                                        @RequestParam(required=false,name="manifest")
                                                                                                                                        boolean manifest)

      Return a given task definition resource.
      Parameters:
        `name` - the name of an existing task definition (required)
      Returns:
        the task definition

Copyright © 2021 Pivotal Software, Inc.. All rights reserved.