swaggerblueprint

Blueprint project
git clone git://git.wimdupont.com/swaggerblueprint.git
Log | Files | Refs | README | LICENSE

BlueprintController.java (2364B)


      1 package com.wimdupont.swagger.blueprint.controller;
      2 
      3 import com.wimdupont.swagger.blueprint.controller.dto.BlueprintDto;
      4 import com.wimdupont.swagger.blueprint.service.BlueprintService;
      5 import io.swagger.v3.oas.annotations.Operation;
      6 import jakarta.validation.Valid;
      7 import org.springframework.web.bind.annotation.DeleteMapping;
      8 import org.springframework.web.bind.annotation.GetMapping;
      9 import org.springframework.web.bind.annotation.PathVariable;
     10 import org.springframework.web.bind.annotation.PostMapping;
     11 import org.springframework.web.bind.annotation.PutMapping;
     12 import org.springframework.web.bind.annotation.RequestBody;
     13 import org.springframework.web.bind.annotation.RequestMapping;
     14 import org.springframework.web.bind.annotation.RestController;
     15 
     16 import java.util.Set;
     17 import java.util.UUID;
     18 
     19 @RestController
     20 @RequestMapping("/blueprints")
     21 public class BlueprintController {
     22 
     23     private final BlueprintService blueprintService;
     24 
     25     public BlueprintController(BlueprintService blueprintService) {
     26         this.blueprintService = blueprintService;
     27     }
     28 
     29     @GetMapping
     30     @Operation(summary = "Retrieve blueprints", description = "This will list all the unique blueprints")
     31     public Set<BlueprintDto> getBlueprints() {
     32         return blueprintService.getBlueprints();
     33     }
     34 
     35     @GetMapping("/{id}")
     36     @Operation(summary = "Retrieve blueprint", description = "This will retrieve the existing blueprint")
     37     public BlueprintDto getBlueprint(@PathVariable UUID id) {
     38         return blueprintService.getBlueprint(id);
     39     }
     40 
     41     @PostMapping
     42     @Operation(summary = "Create blueprint", description = "This will create a new blueprint")
     43     public BlueprintDto createBlueprint(@RequestBody @Valid BlueprintDto blueprintDto) {
     44         return blueprintService.createBlueprint(blueprintDto);
     45     }
     46 
     47     @PutMapping("/{id}")
     48     @Operation(summary = "Update blueprint", description = "This will update the existing blueprint")
     49     public BlueprintDto updateBlueprint(@PathVariable UUID id, @RequestBody @Valid BlueprintDto blueprintDto) {
     50         return blueprintService.updateBlueprint(id, blueprintDto);
     51     }
     52 
     53     @DeleteMapping("/{id}")
     54     @Operation(summary = "Delete blueprint", description = "This will delete the existing blueprint")
     55     public void deleteBlueprint(@PathVariable UUID id) {
     56         blueprintService.deleteBlueprint(id);
     57     }
     58 
     59 }