Class WorkflowController

java.lang.Object
ai.nervemind.app.api.WorkflowController

@RestController @RequestMapping("/api/workflows") public class WorkflowController extends Object
REST API controller for workflow management.
  • Constructor Summary

    Constructors
    Constructor
    Description
    WorkflowController(WorkflowService workflowService, FileWatcherService fileWatcherService)
    Creates a new workflow controller.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    activate(Long id, boolean active)
    Activates or deactivates a workflow.
    ai.nervemind.common.dto.WorkflowDTO
    create(@Valid ai.nervemind.common.dto.WorkflowDTO dto)
    Creates a new workflow.
    void
    Deletes a workflow by its ID.
    ai.nervemind.common.dto.WorkflowDTO
    Duplicates an existing workflow.
    List<ai.nervemind.common.dto.WorkflowDTO>
    Retrieves all workflows.
    org.springframework.http.ResponseEntity<ai.nervemind.common.dto.WorkflowDTO>
    Retrieves a workflow by its ID.
    org.springframework.http.ResponseEntity<ai.nervemind.common.dto.WorkflowDTO>
    update(Long id, @Valid ai.nervemind.common.dto.WorkflowDTO dto)
    Updates an existing workflow.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • WorkflowController

      public WorkflowController(WorkflowService workflowService, FileWatcherService fileWatcherService)
      Creates a new workflow controller.
      Parameters:
      workflowService - the workflow service for business logic
      fileWatcherService - the file watcher service for file monitoring
  • Method Details

    • findAll

      @GetMapping public List<ai.nervemind.common.dto.WorkflowDTO> findAll()
      Retrieves all workflows.
      Returns:
      list of all workflows
    • findById

      @GetMapping("/{id}") public org.springframework.http.ResponseEntity<ai.nervemind.common.dto.WorkflowDTO> findById(@PathVariable Long id)
      Retrieves a workflow by its ID.
      Parameters:
      id - the workflow ID
      Returns:
      the workflow if found, 404 otherwise
    • create

      @PostMapping @ResponseStatus(CREATED) public ai.nervemind.common.dto.WorkflowDTO create(@Valid @RequestBody @Valid ai.nervemind.common.dto.WorkflowDTO dto)
      Creates a new workflow.
      Parameters:
      dto - the workflow data to create
      Returns:
      the created workflow
    • update

      @PutMapping("/{id}") public org.springframework.http.ResponseEntity<ai.nervemind.common.dto.WorkflowDTO> update(@PathVariable Long id, @Valid @RequestBody @Valid ai.nervemind.common.dto.WorkflowDTO dto)
      Updates an existing workflow.
      Parameters:
      id - the workflow ID to update
      dto - the updated workflow data
      Returns:
      the updated workflow if successful, 400 if ID mismatch
    • delete

      @DeleteMapping("/{id}") @ResponseStatus(NO_CONTENT) public void delete(@PathVariable Long id)
      Deletes a workflow by its ID.
      Parameters:
      id - the workflow ID to delete
    • duplicate

      @PostMapping("/{id}/duplicate") @ResponseStatus(CREATED) public ai.nervemind.common.dto.WorkflowDTO duplicate(@PathVariable Long id)
      Duplicates an existing workflow.
      Parameters:
      id - the workflow ID to duplicate
      Returns:
      the duplicated workflow DTO
    • activate

      @PatchMapping("/{id}/active") @ResponseStatus(OK) public void activate(@PathVariable Long id, @RequestParam boolean active)
      Activates or deactivates a workflow.
      Parameters:
      id - the workflow ID to activate/deactivate
      active - true to activate, false to deactivate