|
7 | 7 | package org.gridsuite.studyconfig.server.controller;
|
8 | 8 |
|
9 | 9 | import io.swagger.v3.oas.annotations.Operation;
|
| 10 | +import io.swagger.v3.oas.annotations.media.Content; |
| 11 | +import io.swagger.v3.oas.annotations.media.Schema; |
10 | 12 | import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
11 | 13 | import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
12 | 14 | import io.swagger.v3.oas.annotations.tags.Tag;
|
13 | 15 | import lombok.RequiredArgsConstructor;
|
| 16 | +import lombok.extern.slf4j.Slf4j; |
14 | 17 | import org.gridsuite.studyconfig.server.StudyConfigApi;
|
15 | 18 | import org.gridsuite.studyconfig.server.dto.diagramgridlayout.DiagramGridLayout;
|
16 | 19 | import org.gridsuite.studyconfig.server.service.DiagramGridLayoutService;
|
| 20 | +import org.springframework.http.HttpStatus; |
17 | 21 | import org.springframework.http.MediaType;
|
18 | 22 | import org.springframework.http.ResponseEntity;
|
19 | 23 | import org.springframework.web.bind.annotation.*;
|
|
22 | 26 |
|
23 | 27 | import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
24 | 28 |
|
| 29 | +@Slf4j |
25 | 30 | @RestController
|
26 | 31 | @RequestMapping(value = "/" + StudyConfigApi.API_VERSION + "/diagram-grid-layout")
|
27 | 32 | @RequiredArgsConstructor
|
28 | 33 | @Tag(name = "Diagram Grid Layout Config", description = "Diagram Grid Layout Configuration API")
|
29 | 34 | public class DiagramGridLayoutController {
|
30 | 35 | private final DiagramGridLayoutService diagramGridLayoutService;
|
31 | 36 |
|
| 37 | + public static final String DUPLICATE_FROM = "duplicateFrom"; |
| 38 | + |
32 | 39 | @PostMapping(consumes = APPLICATION_JSON_VALUE)
|
33 | 40 | @Operation(summary = "Save diagram grid layout")
|
34 | 41 | @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The newly created diagram grid layout UUID returned")})
|
@@ -61,4 +68,13 @@ public ResponseEntity<DiagramGridLayout> deleteDiagramGridLayout(
|
61 | 68 | diagramGridLayoutService.deleteDiagramGridLayout(diagramGridLayoutUuid);
|
62 | 69 | return ResponseEntity.ok().build();
|
63 | 70 | }
|
| 71 | + |
| 72 | + @PostMapping(params = { DUPLICATE_FROM }) |
| 73 | + @Operation(summary = "Duplicate diagram grid layout") |
| 74 | + @ApiResponses(value = {@ApiResponse(responseCode = "201", description = "The diagram grid layout is duplicated")}) |
| 75 | + public ResponseEntity<UUID> duplicateDiagramGridLayout(@RequestParam(name = DUPLICATE_FROM) UUID diagramGridLayoutUuid) { |
| 76 | + UUID newId = diagramGridLayoutService.duplicateDiagramGridLayout(diagramGridLayoutUuid); |
| 77 | + return ResponseEntity.status(HttpStatus.CREATED).body(newId); |
| 78 | + } |
| 79 | + |
64 | 80 | }
|
0 commit comments