From e2b7248902057f17eda3cc8864b1a0d8a3999670 Mon Sep 17 00:00:00 2001 From: manuwei <44226745+manuwei@users.noreply.github.com> Date: Thu, 1 Apr 2021 09:16:05 +0200 Subject: [PATCH] Feature/remove api version (#180) * remove apiVersion annotation to remove 'v1' from path * remove 'v1' constant, uses and tests for versioning * stop overriding the RequestMapping to insert the api version * delete api version annotation * upgrade testcontainer version * hide detailed logging output for tests Co-authored-by: salmma --- org.planqk.atlas.core/pom.xml | 6 +- .../core/services/SketchServiceTest.java | 5 +- .../java/org/planqk/atlas/web/Constants.java | 2 - .../atlas/web/annotation/ApiVersion.java | 36 - .../VersionedRequestHandlerMapping.java | 30 - .../web/controller/AlgorithmController.java | 628 +++++++++--------- .../AlgorithmRelationController.java | 80 ++- .../AlgorithmRelationTypeController.java | 48 +- .../controller/ApplicationAreaController.java | 46 +- .../controller/CloudServiceController.java | 112 ++-- .../controller/ComputeResourceController.java | 148 ++--- ...ComputeResourcePropertyTypeController.java | 54 +- .../DiscussionCommentController.java | 30 +- .../controller/DiscussionTopicController.java | 124 ++-- .../controller/ImplementationController.java | 2 - .../ImplementationGlobalController.java | 16 +- .../controller/PatternRelationController.java | 60 +- .../PatternRelationTypeController.java | 50 +- .../web/controller/ProblemTypeController.java | 48 +- .../web/controller/PublicationController.java | 274 ++++---- .../SoftwarePlatformController.java | 212 +++--- .../atlas/web/controller/TagController.java | 24 +- .../VersionedRequestHandlerMappingTest.java | 65 -- .../DiscussionCommentControllerTest.java | 83 +-- .../web/linkassembler/DummyController.java | 36 - .../LinkBuilderServiceIntegrationTest.java | 53 -- pom.xml | 7 + 27 files changed, 1016 insertions(+), 1263 deletions(-) delete mode 100644 org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/annotation/ApiVersion.java delete mode 100644 org.planqk.atlas.web/src/test/java/org/planqk/atlas/web/annotation/VersionedRequestHandlerMappingTest.java delete mode 100644 org.planqk.atlas.web/src/test/java/org/planqk/atlas/web/linkassembler/DummyController.java delete mode 100644 org.planqk.atlas.web/src/test/java/org/planqk/atlas/web/linkassembler/LinkBuilderServiceIntegrationTest.java diff --git a/org.planqk.atlas.core/pom.xml b/org.planqk.atlas.core/pom.xml index b81c518bc..4feb412be 100644 --- a/org.planqk.atlas.core/pom.xml +++ b/org.planqk.atlas.core/pom.xml @@ -48,19 +48,19 @@ org.testcontainers testcontainers - 1.14.3 + 1.15.2 test org.testcontainers postgresql - 1.14.3 + 1.15.2 test org.testcontainers junit-jupiter - 1.14.3 + 1.15.2 test diff --git a/org.planqk.atlas.core/src/test/java/org/planqk/atlas/core/services/SketchServiceTest.java b/org.planqk.atlas.core/src/test/java/org/planqk/atlas/core/services/SketchServiceTest.java index db65e60a9..865349195 100644 --- a/org.planqk.atlas.core/src/test/java/org/planqk/atlas/core/services/SketchServiceTest.java +++ b/org.planqk.atlas.core/src/test/java/org/planqk/atlas/core/services/SketchServiceTest.java @@ -25,7 +25,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -import java.net.URI; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; @@ -68,7 +67,7 @@ void updateSketch() { final MockMultipartFile file = new MockMultipartFile("image", testFile); final String description = "description"; - final String baseURL = "http://localhost:8080/atlas/v1"; + final String baseURL = "http://localhost:8080/atlas"; // call final Sketch persistedSketch = sketchService.addSketchToAlgorithm(algorithm.getId(), file, description, baseURL); @@ -114,7 +113,7 @@ void addSketchToAlgorithm() { final MockMultipartFile file = new MockMultipartFile("image", testFile); final String description = "description"; - final String baseURL = "http://localhost:8080/atlas/v1"; + final String baseURL = "http://localhost:8080/atlas"; // call final Sketch persistedSketch = sketchService.addSketchToAlgorithm(algorithm.getId(), file, description, baseURL); diff --git a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/Constants.java b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/Constants.java index 162ca09b4..4b7340907 100644 --- a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/Constants.java +++ b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/Constants.java @@ -25,8 +25,6 @@ public final class Constants { // URL snippets - public static final String API_VERSION = "v1"; - public static final String ALGORITHMS = "algorithms"; public static final String ALGORITHM_RELATIONS = "algorithm-relations"; diff --git a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/annotation/ApiVersion.java b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/annotation/ApiVersion.java deleted file mode 100644 index 55566ce35..000000000 --- a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/annotation/ApiVersion.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2020 the qc-atlas contributors. - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ - -package org.planqk.atlas.web.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Add API versioning information to a controller or controller method. - *

- * The specified version(s) are appended to the controller's base path (i.e. before the individual route paths). - */ -@Target({ElementType.METHOD, ElementType.TYPE}) -@Retention(RetentionPolicy.RUNTIME) -public @interface ApiVersion { - String[] value(); -} diff --git a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/annotation/VersionedRequestHandlerMapping.java b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/annotation/VersionedRequestHandlerMapping.java index 944a66d52..a988e2de1 100644 --- a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/annotation/VersionedRequestHandlerMapping.java +++ b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/annotation/VersionedRequestHandlerMapping.java @@ -19,11 +19,6 @@ package org.planqk.atlas.web.annotation; -import java.lang.reflect.Method; - -import org.springframework.core.annotation.AnnotatedElementUtils; -import org.springframework.web.servlet.mvc.condition.PatternsRequestCondition; -import org.springframework.web.servlet.mvc.method.RequestMappingInfo; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; /** @@ -39,29 +34,4 @@ public void populateFromHandler(Object handler) { detectHandlerMethods(handler); } - @Override - protected RequestMappingInfo getMappingForMethod(Method method, Class handlerType) { - RequestMappingInfo info = super.getMappingForMethod(method, handlerType); - if (info != null) { - final ApiVersion methodAnnotation = AnnotatedElementUtils.findMergedAnnotation(method, ApiVersion.class); - if (methodAnnotation != null) { - // Prepend our version mapping to the real method mapping. - info = createApiVersionInfo(methodAnnotation).combine(info); - } - - final ApiVersion typeAnnotation = AnnotatedElementUtils.findMergedAnnotation(handlerType, ApiVersion.class); - if (methodAnnotation == null && typeAnnotation != null) { - // Append our version mapping to the real controller mapping. - info = createApiVersionInfo(typeAnnotation).combine(info); - } - } - return info; - } - - private RequestMappingInfo createApiVersionInfo(ApiVersion annotation) { - return new RequestMappingInfo( - new PatternsRequestCondition(annotation.value(), getUrlPathHelper(), getPathMatcher(), - useSuffixPatternMatch(), useTrailingSlashMatch(), getFileExtensions()), - null, null, null, null, null, null); - } } diff --git a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/AlgorithmController.java b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/AlgorithmController.java index 34b15e5c2..1fdd62b4d 100644 --- a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/AlgorithmController.java +++ b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/AlgorithmController.java @@ -43,7 +43,6 @@ import org.planqk.atlas.core.services.SketchService; import org.planqk.atlas.core.services.TagService; import org.planqk.atlas.web.Constants; -import org.planqk.atlas.web.annotation.ApiVersion; import org.planqk.atlas.web.dtos.AlgorithmDto; import org.planqk.atlas.web.dtos.ApplicationAreaDto; import org.planqk.atlas.web.dtos.ComputeResourcePropertyDto; @@ -104,7 +103,6 @@ @RestController @CrossOrigin(allowedHeaders = "*", origins = "*") @RequestMapping("/" + Constants.ALGORITHMS) -@ApiVersion("v1") @AllArgsConstructor @Slf4j public class AlgorithmController { @@ -150,165 +148,165 @@ public class AlgorithmController { private final LinkingService linkingService; @Operation(responses = { - @ApiResponse(responseCode = "200") + @ApiResponse(responseCode = "200") }, description = "Retrieve all algorithms (quantum, hybrid and classic).") @ListParametersDoc @GetMapping public ResponseEntity>> getAlgorithms( - @Parameter(hidden = true) ListParameters listParameters) { + @Parameter(hidden = true) ListParameters listParameters) { return ResponseEntity.ok(algorithmAssembler.toModel(algorithmService.findAll(listParameters.getPageable(), - listParameters.getSearch()))); + listParameters.getSearch()))); } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), }, description = "Define the basic properties of an algorithm. " + - "References to sub-objects (e.g. a ProblemType) can be added via " + - "sub-routes (e.g. POST on /" + Constants.ALGORITHMS + "/{algorithmId}/" + Constants.PROBLEM_TYPES + ").") + "References to sub-objects (e.g. a ProblemType) can be added via " + + "sub-routes (e.g. POST on /" + Constants.ALGORITHMS + "/{algorithmId}/" + Constants.PROBLEM_TYPES + ").") @PostMapping public ResponseEntity> createAlgorithm( - @Validated(ValidationGroups.Create.class) @RequestBody AlgorithmDto algorithmDto) { + @Validated(ValidationGroups.Create.class) @RequestBody AlgorithmDto algorithmDto) { final Algorithm savedAlgorithm = algorithmService.create(ModelMapperUtils.convert(algorithmDto, Algorithm.class)); return new ResponseEntity<>(algorithmAssembler.toModel(savedAlgorithm), HttpStatus.CREATED); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", description = "Not Found. Algorithm with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", description = "Not Found. Algorithm with given ID doesn't exist.") }, description = "Update the basic properties of an algorithm (e.g. name). " + - "References to sub-objects (e.g. a ProblemType) are not updated via this operation " + - "- use the corresponding sub-route for updating them (e.g. PUT on " + - "/" + Constants.PROBLEM_TYPES + "/{problemTypeId})." + "References to sub-objects (e.g. a ProblemType) are not updated via this operation " + + "- use the corresponding sub-route for updating them (e.g. PUT on " + + "/" + Constants.PROBLEM_TYPES + "/{problemTypeId})." ) @PutMapping("/{algorithmId}") public ResponseEntity> updateAlgorithm( - @PathVariable UUID algorithmId, - @Validated(ValidationGroups.Update.class) @RequestBody AlgorithmDto algorithmDto) { + @PathVariable UUID algorithmId, + @Validated(ValidationGroups.Update.class) @RequestBody AlgorithmDto algorithmDto) { algorithmDto.setId(algorithmId); final Algorithm updatedAlgorithm = algorithmService.update( - ModelMapperUtils.convert(algorithmDto, Algorithm.class)); + ModelMapperUtils.convert(algorithmDto, Algorithm.class)); return ResponseEntity.ok(algorithmAssembler.toModel(updatedAlgorithm)); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Algorithm with given ID doesn't exist.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Algorithm with given ID doesn't exist.") }, description = "Delete an algorithm. This also deletes all entities that depend on it " + - "(e.g. the algorithm's relations to other algorithms).") + "(e.g. the algorithm's relations to other algorithms).") @DeleteMapping("/{algorithmId}") public ResponseEntity deleteAlgorithm( - @PathVariable UUID algorithmId) { + @PathVariable UUID algorithmId) { algorithmService.delete(algorithmId); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Algorithm with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Algorithm with given ID doesn't exist.") }, description = "Retrieve a specific algorithm and its basic properties.") @GetMapping("/{algorithmId}") public ResponseEntity> getAlgorithm( - @PathVariable UUID algorithmId) { + @PathVariable UUID algorithmId) { final var algorithm = algorithmService.findById(algorithmId); return ResponseEntity.ok(algorithmAssembler.toModel(algorithm)); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Algorithm with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Algorithm with given ID doesn't exist.") }, description = "Retrieve all tags associated with a specific algorithm.") @GetMapping("/{algorithmId}/" + Constants.TAGS) public ResponseEntity>> getTagsOfAlgorithm( - @PathVariable UUID algorithmId) { + @PathVariable UUID algorithmId) { final Algorithm algorithm = algorithmService.findById(algorithmId); return ResponseEntity.ok(tagAssembler.toModel(algorithm.getTags())); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", description = "Not Found. Algorithm with given ID doesn't exist.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", description = "Not Found. Algorithm with given ID doesn't exist.") }, description = "Add a tag to an algorithm. The tag does not have to exist before adding it.") @PostMapping("/{algorithmId}/" + Constants.TAGS) public ResponseEntity addTagToAlgorithm( - @PathVariable UUID algorithmId, - @Validated(ValidationGroups.Create.class) @RequestBody TagDto tagDto) { + @PathVariable UUID algorithmId, + @Validated(ValidationGroups.Create.class) @RequestBody TagDto tagDto) { tagService.addTagToAlgorithm(algorithmId, ModelMapperUtils.convert(tagDto, Tag.class)); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", description = "Not Found. Algorithm with given ID or Tag doesn't exist.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", description = "Not Found. Algorithm with given ID or Tag doesn't exist.") }, description = "Remove a tag from an algorithm.") @DeleteMapping("/{algorithmId}/" + Constants.TAGS) public ResponseEntity removeTagFromAlgorithm( - @PathVariable UUID algorithmId, - @Validated(ValidationGroups.IDOnly.class) @RequestBody TagDto tagDto) { + @PathVariable UUID algorithmId, + @Validated(ValidationGroups.IDOnly.class) @RequestBody TagDto tagDto) { tagService.removeTagFromAlgorithm(algorithmId, ModelMapperUtils.convert(tagDto, Tag.class)); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Algorithm with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Algorithm with given ID doesn't exist.") }, description = "Retrieve referenced publications of an algorithm. If none are found an empty list is returned.") @ListParametersDoc @GetMapping("/{algorithmId}/" + Constants.PUBLICATIONS) public ResponseEntity>> getPublicationsOfAlgorithm( - @PathVariable UUID algorithmId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID algorithmId, + @Parameter(hidden = true) ListParameters listParameters) { final Page publications = algorithmService.findLinkedPublications(algorithmId, listParameters.getPageable()); return ResponseEntity.ok(publicationAssembler.toModel(publications)); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", description = "Not Found. Algorithm or publication with given IDs don't exist or " + - "reference was already added.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", description = "Not Found. Algorithm or publication with given IDs don't exist or " + + "reference was already added.") }, description = "Add a reference to an existing publication " + - "(that was previously created via a POST on e.g. /" + Constants.PUBLICATIONS + "). " + - "Only the ID is required in the request body, other attributes will be ignored and not changed.") + "(that was previously created via a POST on e.g. /" + Constants.PUBLICATIONS + "). " + + "Only the ID is required in the request body, other attributes will be ignored and not changed.") @PostMapping("/{algorithmId}/" + Constants.PUBLICATIONS) public ResponseEntity linkAlgorithmAndPublication( - @PathVariable UUID algorithmId, - @Validated({ValidationGroups.IDOnly.class}) @RequestBody PublicationDto publicationDto) { + @PathVariable UUID algorithmId, + @Validated({ValidationGroups.IDOnly.class}) @RequestBody PublicationDto publicationDto) { linkingService.linkAlgorithmAndPublication(algorithmId, publicationDto.getId()); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", description = "Not Found. Algorithm or publication with given IDs don't exist or " + - "no reference exists.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", description = "Not Found. Algorithm or publication with given IDs don't exist or " + + "no reference exists.") }, description = "Delete a reference to a publication of an algorithm. The reference has to be previously created " + - "via a POST on /" + Constants.ALGORITHMS + "/{algorithmId}/" + Constants.PUBLICATIONS + ").") + "via a POST on /" + Constants.ALGORITHMS + "/{algorithmId}/" + Constants.PUBLICATIONS + ").") @DeleteMapping("/{algorithmId}/" + Constants.PUBLICATIONS + "/{publicationId}") public ResponseEntity unlinkAlgorithmAndPublication( - @PathVariable UUID algorithmId, - @PathVariable UUID publicationId) { + @PathVariable UUID algorithmId, + @PathVariable UUID publicationId) { linkingService.unlinkAlgorithmAndPublication(algorithmId, publicationId); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Algorithm or publication with given IDs don't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Algorithm or publication with given IDs don't exist.") }, description = "Retrieve a specific publication and its basic properties of an algorithm.") @GetMapping("/{algorithmId}/" + Constants.PUBLICATIONS + "/{publicationId}") public ResponseEntity> getPublicationOfAlgorithm( - @PathVariable UUID algorithmId, - @PathVariable UUID publicationId) { + @PathVariable UUID algorithmId, + @PathVariable UUID publicationId) { algorithmService.checkIfPublicationIsLinkedToAlgorithm(algorithmId, publicationId); final Publication publication = publicationService.findById(publicationId); @@ -316,64 +314,64 @@ public ResponseEntity> getPublicationOfAlgorithm( } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Algorithm with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Algorithm with given ID doesn't exist.") }, description = "Retrieve problem types of an algorithm. If none are found an empty list is returned.") @ListParametersDoc @GetMapping("/{algorithmId}/" + Constants.PROBLEM_TYPES) public ResponseEntity>> getProblemTypesOfAlgorithm( - @PathVariable UUID algorithmId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID algorithmId, + @Parameter(hidden = true) ListParameters listParameters) { final Page problemTypes = algorithmService.findLinkedProblemTypes(algorithmId, listParameters.getPageable()); return ResponseEntity.ok(problemTypeAssembler.toModel(problemTypes)); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400", - description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or problem type with given IDs don't exist or " + - "reference was already added.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400", + description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or problem type with given IDs don't exist or " + + "reference was already added.") }, description = "Add a reference to an existing ProblemType " + - "(that was previously created via a POST on /" + Constants.PROBLEM_TYPES + "). " + - "Only the ID is required in the request body, other attributes will be ignored and not changed.") + "(that was previously created via a POST on /" + Constants.PROBLEM_TYPES + "). " + + "Only the ID is required in the request body, other attributes will be ignored and not changed.") @PostMapping("/{algorithmId}/" + Constants.PROBLEM_TYPES) public ResponseEntity linkAlgorithmAndProblemType( - @PathVariable UUID algorithmId, - @Validated({ValidationGroups.IDOnly.class}) @RequestBody ProblemTypeDto problemTypeDto) { + @PathVariable UUID algorithmId, + @Validated({ValidationGroups.IDOnly.class}) @RequestBody ProblemTypeDto problemTypeDto) { linkingService.linkAlgorithmAndProblemType(algorithmId, problemTypeDto.getId()); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400", - description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or problem type with given IDs don't exist or " + - "no reference exists.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400", + description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or problem type with given IDs don't exist or " + + "no reference exists.") }, description = "Delete a reference to a problem types of an algorithm. The reference has to be previously created " + - "via a POST on e.g. /" + Constants.ALGORITHMS + "/{algorithmId}/" + Constants.PROBLEM_TYPES + ").") + "via a POST on e.g. /" + Constants.ALGORITHMS + "/{algorithmId}/" + Constants.PROBLEM_TYPES + ").") @DeleteMapping("/{algorithmId}/" + Constants.PROBLEM_TYPES + "/{problemTypeId}") public ResponseEntity unlinkAlgorithmAndProblemType( - @PathVariable UUID algorithmId, - @PathVariable UUID problemTypeId) { + @PathVariable UUID algorithmId, + @PathVariable UUID problemTypeId) { linkingService.unlinkAlgorithmAndProblemType(algorithmId, problemTypeId); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or problem type with given IDs don't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or problem type with given IDs don't exist.") }, description = "Retrieve a specific problem type of an algorithm.") @GetMapping("/{algorithmId}/" + Constants.PROBLEM_TYPES + "/{problemTypeId}") public ResponseEntity> getProblemTypeOfAlgorithm( - @PathVariable UUID algorithmId, - @PathVariable UUID problemTypeId) { + @PathVariable UUID algorithmId, + @PathVariable UUID problemTypeId) { algorithmService.checkIfProblemTypeIsLinkedToAlgorithm(algorithmId, problemTypeId); final ProblemType problemType = problemTypeService.findById(problemTypeId); @@ -381,63 +379,63 @@ public ResponseEntity> getProblemTypeOfAlgorithm( } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or application area with given IDs don't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or application area with given IDs don't exist.") }, description = "Retrieve application areas of an algorithm. If none are found an empty list is returned.") @ListParametersDoc @GetMapping("/{algorithmId}/" + Constants.APPLICATION_AREAS) public ResponseEntity>> getApplicationAreasOfAlgorithm( - @PathVariable UUID algorithmId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID algorithmId, + @Parameter(hidden = true) ListParameters listParameters) { final Page applicationAreas = algorithmService.findLinkedApplicationAreas(algorithmId, listParameters.getPageable()); return ResponseEntity.ok(applicationAreaAssembler.toModel(applicationAreas)); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or application area with given IDs don't exist or " + - "reference was already added.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or application area with given IDs don't exist or " + + "reference was already added.") }, description = "Add a reference to an existing application area " + - "(that was previously created via a POST on e.g. /" + Constants.APPLICATION_AREAS + "). " + - "Only the ID is required in the request body, other attributes will be ignored and not changed.") + "(that was previously created via a POST on e.g. /" + Constants.APPLICATION_AREAS + "). " + + "Only the ID is required in the request body, other attributes will be ignored and not changed.") @PostMapping("/{algorithmId}/" + Constants.APPLICATION_AREAS) public ResponseEntity linkAlgorithmAndApplicationArea( - @PathVariable UUID algorithmId, - @Validated({ValidationGroups.IDOnly.class}) @RequestBody ApplicationAreaDto applicationAreaDto) { + @PathVariable UUID algorithmId, + @Validated({ValidationGroups.IDOnly.class}) @RequestBody ApplicationAreaDto applicationAreaDto) { linkingService.linkAlgorithmAndApplicationArea(algorithmId, applicationAreaDto.getId()); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or application area with given IDs don't exist or " + - "no reference exists.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or application area with given IDs don't exist or " + + "no reference exists.") }, description = "Delete a reference to an application area of an algorithm. The reference has to be previously " + - "created via a POST on /" + Constants.ALGORITHMS + "/{algorithmId}/" + Constants.APPLICATION_AREAS + ").") + "created via a POST on /" + Constants.ALGORITHMS + "/{algorithmId}/" + Constants.APPLICATION_AREAS + ").") @DeleteMapping("/{algorithmId}/" + Constants.APPLICATION_AREAS + "/{applicationAreaId}") public ResponseEntity unlinkAlgorithmAndApplicationArea( - @PathVariable UUID algorithmId, - @PathVariable UUID applicationAreaId) { + @PathVariable UUID algorithmId, + @PathVariable UUID applicationAreaId) { linkingService.unlinkAlgorithmAndApplicationArea(algorithmId, applicationAreaId); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or application area with given IDs don't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or application area with given IDs don't exist.") }, description = "Retrieve a specific application area of an algorithm.") @GetMapping("/{algorithmId}/" + Constants.APPLICATION_AREAS + "/{applicationAreaId}") public ResponseEntity> getApplicationAreaOfAlgorithm( - @PathVariable UUID algorithmId, - @PathVariable UUID applicationAreaId) { + @PathVariable UUID algorithmId, + @PathVariable UUID applicationAreaId) { algorithmService.checkIfApplicationAreaIsLinkedToAlgorithm(algorithmId, applicationAreaId); final ApplicationArea applicationArea = applicationAreaService.findById(applicationAreaId); @@ -445,236 +443,236 @@ public ResponseEntity> getApplicationAreaOfAlgor } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm with given ID doesn't exist.") }, description = "Retrieve implementations of an algorithm. If none are found an empty list is returned." ) @ListParametersDoc @GetMapping("/{algorithmId}/" + Constants.IMPLEMENTATIONS) public ResponseEntity>> getImplementationsOfAlgorithm( - @PathVariable UUID algorithmId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID algorithmId, + @Parameter(hidden = true) ListParameters listParameters) { final var implementations = implementationService.findByImplementedAlgorithm(algorithmId, listParameters.getPageable()); return ResponseEntity.ok(implementationAssembler.toModel(implementations)); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm with given ID doesn't exist.") }, description = "Retrieve discussion topics of an algorithm. If none are found an empty list is returned." ) @ListParametersDoc @GetMapping("/{algorithmId}/" + Constants.DISCUSSION_TOPICS) public HttpEntity>> getDiscussionTopicsOfAlgorithm( - @PathVariable UUID algorithmId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID algorithmId, + @Parameter(hidden = true) ListParameters listParameters) { return discussionTopicController.getDiscussionTopics(algorithmId, listParameters); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or discussion topic with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or discussion topic with given ID doesn't exist.") }, description = "Retrieve discussion topic of an algorithm." ) @ListParametersDoc @GetMapping("/{algorithmId}/" + Constants.DISCUSSION_TOPICS + "/{topicId}") public HttpEntity> getDiscussionTopicOfAlgorithm( - @PathVariable UUID algorithmId, - @PathVariable UUID topicId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID algorithmId, + @PathVariable UUID topicId, + @Parameter(hidden = true) ListParameters listParameters) { return discussionTopicController.getDiscussionTopic(algorithmId, topicId); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or discussion topic with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or discussion topic with given ID doesn't exist.") }, description = "Delete discussion topic of an algorithm." ) @ListParametersDoc @DeleteMapping("/{algorithmId}/" + Constants.DISCUSSION_TOPICS + "/{topicId}") public HttpEntity deleteDiscussionTopicOfAlgorithm( - @PathVariable UUID algorithmId, - @PathVariable UUID topicId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID algorithmId, + @PathVariable UUID topicId, + @Parameter(hidden = true) ListParameters listParameters) { return discussionTopicController.deleteDiscussionTopic(algorithmId, topicId); } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or discussion topic with given ID doesn't exist.") + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or discussion topic with given ID doesn't exist.") }, description = "Create a discussion topic of an algorithm." ) @ListParametersDoc @PostMapping("/{algorithmId}/" + Constants.DISCUSSION_TOPICS) public HttpEntity> createDiscussionTopicOfAlgorithm( - @PathVariable UUID algorithmId, - @Validated(ValidationGroups.Create.class) @RequestBody DiscussionTopicDto discussionTopicDto, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID algorithmId, + @Validated(ValidationGroups.Create.class) @RequestBody DiscussionTopicDto discussionTopicDto, + @Parameter(hidden = true) ListParameters listParameters) { final var algorithm = algorithmService.findById(algorithmId); return discussionTopicController.createDiscussionTopic(algorithm, discussionTopicDto); } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or discussion topic with given ID doesn't exist.") + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or discussion topic with given ID doesn't exist.") }, description = "Update discussion topic of an algorithm." ) @ListParametersDoc @PutMapping("/{algorithmId}/" + Constants.DISCUSSION_TOPICS + "/{topicId}") public HttpEntity> updateDiscussionTopicOfAlgorithm( - @PathVariable UUID algorithmId, - @PathVariable UUID topicId, - @Validated(ValidationGroups.Update.class) @RequestBody DiscussionTopicDto discussionTopicDto, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID algorithmId, + @PathVariable UUID topicId, + @Validated(ValidationGroups.Update.class) @RequestBody DiscussionTopicDto discussionTopicDto, + @Parameter(hidden = true) ListParameters listParameters) { final var algorithm = algorithmService.findById(algorithmId); return discussionTopicController.updateDiscussionTopic(algorithm, topicId, discussionTopicDto); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or discussion topic with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or discussion topic with given ID doesn't exist.") }, description = "Retrieve discussion comments of a discussion topic of an algorithm. If none are found an empty list is returned." ) @ListParametersDoc @GetMapping("/{algorithmId}/" + Constants.DISCUSSION_TOPICS + "/{topicId}/" + Constants.DISCUSSION_COMMENTS) public HttpEntity>> getDiscussionCommentsOfDiscussionTopicOfAlgorithm( - @PathVariable UUID algorithmId, - @PathVariable UUID topicId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID algorithmId, + @PathVariable UUID topicId, + @Parameter(hidden = true) ListParameters listParameters) { return discussionTopicController.getDiscussionComments(algorithmId, topicId, listParameters); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm, discussion topic or discussion comment with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm, discussion topic or discussion comment with given ID doesn't exist.") }, description = "Retrieve discussion comment of a discussion topic of an algorithm." ) @ListParametersDoc @GetMapping("/{algorithmId}/" + Constants.DISCUSSION_TOPICS + "/{topicId}/" + Constants.DISCUSSION_COMMENTS + "/{commentId}") public HttpEntity> getDiscussionCommentOfDiscussionTopicOfAlgorithm( - @PathVariable UUID algorithmId, - @PathVariable UUID topicId, - @PathVariable UUID commentId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID algorithmId, + @PathVariable UUID topicId, + @PathVariable UUID commentId, + @Parameter(hidden = true) ListParameters listParameters) { return discussionTopicController.getDiscussionComment(algorithmId, topicId, commentId); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm, discussion topic or discussion comment with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm, discussion topic or discussion comment with given ID doesn't exist.") }, description = "Delete discussion comment of a discussion topic of an algorithm." ) @ListParametersDoc @DeleteMapping("/{algorithmId}/" + Constants.DISCUSSION_TOPICS + "/{topicId}/" + Constants.DISCUSSION_COMMENTS + "/{commentId}") public HttpEntity deleteDiscussionCommentOfDiscussionTopicOfAlgorithm( - @PathVariable UUID algorithmId, - @PathVariable UUID topicId, - @PathVariable UUID commentId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID algorithmId, + @PathVariable UUID topicId, + @PathVariable UUID commentId, + @Parameter(hidden = true) ListParameters listParameters) { return discussionTopicController.deleteDiscussionComment(algorithmId, topicId, commentId); } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or discussion topic with given ID doesn't exist.") + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or discussion topic with given ID doesn't exist.") }, description = "Create discussion comment of a discussion topic of an algorithm." ) @ListParametersDoc @PostMapping("/{algorithmId}/" + Constants.DISCUSSION_TOPICS + "/{topicId}/" + Constants.DISCUSSION_COMMENTS) public HttpEntity> createDiscussionCommentOfDiscussionTopicOfAlgorithm( - @PathVariable UUID algorithmId, - @PathVariable UUID topicId, - @Validated(ValidationGroups.Create.class) @RequestBody DiscussionCommentDto discussionCommentDto, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID algorithmId, + @PathVariable UUID topicId, + @Validated(ValidationGroups.Create.class) @RequestBody DiscussionCommentDto discussionCommentDto, + @Parameter(hidden = true) ListParameters listParameters) { return discussionTopicController.createDiscussionComment(algorithmId, topicId, discussionCommentDto); } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or discussion topic with given ID doesn't exist.") + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or discussion topic with given ID doesn't exist.") }, description = "Update discussion comment of a discussion topic of an algorithm." ) @ListParametersDoc @PutMapping("/{algorithmId}/" + Constants.DISCUSSION_TOPICS + "/{topicId}/" + Constants.DISCUSSION_COMMENTS + "/{commentId}") public HttpEntity> updateDiscussionCommentOfDiscussionTopicOfAlgorithm( - @PathVariable UUID algorithmId, - @PathVariable UUID topicId, - @PathVariable UUID commentId, - @Validated(ValidationGroups.Update.class) @RequestBody DiscussionCommentDto discussionCommentDto, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID algorithmId, + @PathVariable UUID topicId, + @PathVariable UUID commentId, + @Validated(ValidationGroups.Update.class) @RequestBody DiscussionCommentDto discussionCommentDto, + @Parameter(hidden = true) ListParameters listParameters) { return discussionTopicController.updateDiscussionComment(algorithmId, topicId, commentId, discussionCommentDto); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm with given ID doesn't exist.") }, description = "Retrieve the required compute resource properties of an algorithm. If none are found an empty list is returned.") @ListParametersDoc @GetMapping("/{algorithmId}/" + Constants.COMPUTE_RESOURCE_PROPERTIES) public ResponseEntity>> getComputeResourcePropertiesOfAlgorithm( - @PathVariable UUID algorithmId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID algorithmId, + @Parameter(hidden = true) ListParameters listParameters) { final var resources = computeResourcePropertyService.findComputeResourcePropertiesOfAlgorithm(algorithmId, listParameters.getPageable()); return ResponseEntity.ok(computeResourcePropertyAssembler.toModel(resources)); } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400", - description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or compute resource property type with given IDs don't exist.") + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400", + description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or compute resource property type with given IDs don't exist.") }, description = "Add a compute resource property (e.g. a certain number of qubits) that is required by an algorithm. " + - "The compute resource property type has to be already created (e.g. via POST on /" + Constants.COMPUTE_RESOURCE_PROPERTY_TYPES + "). " + - "As a result only the ID is required for the compute resource property type, other attributes will be ignored not changed.") + "The compute resource property type has to be already created (e.g. via POST on /" + Constants.COMPUTE_RESOURCE_PROPERTY_TYPES + "). " + + "As a result only the ID is required for the compute resource property type, other attributes will be ignored not changed.") @PostMapping("/{algorithmId}/" + Constants.COMPUTE_RESOURCE_PROPERTIES) public ResponseEntity> createComputeResourcePropertyForAlgorithm( - @PathVariable UUID algorithmId, - @Validated(ValidationGroups.Create.class) @RequestBody ComputeResourcePropertyDto computeResourcePropertyDto) { + @PathVariable UUID algorithmId, + @Validated(ValidationGroups.Create.class) @RequestBody ComputeResourcePropertyDto computeResourcePropertyDto) { final var computeResourceProperty = ModelMapperUtils.convert(computeResourcePropertyDto, ComputeResourceProperty.class); final var createdComputeResourceProperty = computeResourcePropertyService - .addComputeResourcePropertyToAlgorithm(algorithmId, computeResourceProperty); + .addComputeResourcePropertyToAlgorithm(algorithmId, computeResourceProperty); return new ResponseEntity<>(computeResourcePropertyAssembler.toModel(createdComputeResourceProperty), HttpStatus.CREATED); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400", - description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm, compute resource property or compute resource type with given IDs don't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", + description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm, compute resource property or compute resource type with given IDs don't exist.") }, description = "Update a Compute resource property of an algorithm. " + - "For the compute resource property type only the ID is required, " + - "other compute resource property type attributes will be ignored and not changed.") + "For the compute resource property type only the ID is required, " + + "other compute resource property type attributes will be ignored and not changed.") @PutMapping("/{algorithmId}/" + Constants.COMPUTE_RESOURCE_PROPERTIES + "/{computeResourcePropertyId}") public ResponseEntity> updateComputeResourcePropertyOfAlgorithm( - @PathVariable UUID algorithmId, - @PathVariable UUID computeResourcePropertyId, - @Validated(ValidationGroups.Update.class) @RequestBody ComputeResourcePropertyDto computeResourcePropertyDto) { + @PathVariable UUID algorithmId, + @PathVariable UUID computeResourcePropertyId, + @Validated(ValidationGroups.Update.class) @RequestBody ComputeResourcePropertyDto computeResourcePropertyDto) { computeResourcePropertyService.checkIfComputeResourcePropertyIsOfAlgorithm(algorithmId, computeResourcePropertyId); computeResourcePropertyDto.setId(computeResourcePropertyId); @@ -684,16 +682,16 @@ public ResponseEntity> updateComputeReso } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or compute resource property with given IDs don't exist."), + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or compute resource property with given IDs don't exist."), }, description = "Delete a Compute resource property of an algorithm. " + - "The compute resource property type is not affected by this.") + "The compute resource property type is not affected by this.") @DeleteMapping("/{algorithmId}/" + Constants.COMPUTE_RESOURCE_PROPERTIES + "/{computeResourcePropertyId}") public HttpEntity deleteComputeResourcePropertyOfAlgorithm( - @PathVariable UUID algorithmId, - @PathVariable UUID computeResourcePropertyId) { + @PathVariable UUID algorithmId, + @PathVariable UUID computeResourcePropertyId) { computeResourcePropertyService.checkIfComputeResourcePropertyIsOfAlgorithm(algorithmId, computeResourcePropertyId); computeResourcePropertyService.delete(computeResourcePropertyId); @@ -701,15 +699,15 @@ public HttpEntity deleteComputeResourcePropertyOfAlgorithm( } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or compute resource property with given IDs don't exist."), + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or compute resource property with given IDs don't exist."), }, description = "Retrieve a specific compute resource property of an algorithm.") @GetMapping("/{algorithmId}/" + Constants.COMPUTE_RESOURCE_PROPERTIES + "/{computeResourcePropertyId}") public HttpEntity> getComputeResourcePropertyOfAlgorithm( - @PathVariable UUID algorithmId, - @PathVariable UUID computeResourcePropertyId) { + @PathVariable UUID algorithmId, + @PathVariable UUID computeResourcePropertyId) { computeResourcePropertyService.checkIfComputeResourcePropertyIsOfAlgorithm(algorithmId, computeResourcePropertyId); final var resource = computeResourcePropertyService.findById(computeResourcePropertyId); @@ -717,73 +715,73 @@ public HttpEntity> getComputeResourcePro } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm with given ID doesn't exist.") }, description = "Retrieve pattern relations of an algorithms. If none are found an empty list is returned.") @ListParametersDoc @GetMapping("/{algorithmId}/" + Constants.PATTERN_RELATIONS) public ResponseEntity>> getPatternRelationsOfAlgorithm( - @PathVariable UUID algorithmId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID algorithmId, + @Parameter(hidden = true) ListParameters listParameters) { final Page patternRelations = algorithmService.findLinkedPatternRelations(algorithmId, listParameters.getPageable()); return ResponseEntity.ok(patternRelationAssembler.toModel(patternRelations)); } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or pattern relation type with given IDs don't exist.") + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or pattern relation type with given IDs don't exist.") }, description = "Create a relation between a pattern and an algorithm." + - "The pattern relation type has to be already created (e.g. via POST on /" + Constants.PATTERN_RELATION_TYPES + "). " + - "As a result only the ID is required for the pattern relation type, other attributes will be ignored not changed.") + "The pattern relation type has to be already created (e.g. via POST on /" + Constants.PATTERN_RELATION_TYPES + "). " + + "As a result only the ID is required for the pattern relation type, other attributes will be ignored not changed.") @PostMapping("/{algorithmId}/" + Constants.PATTERN_RELATIONS) public ResponseEntity> createPatternRelationForAlgorithm( - @PathVariable UUID algorithmId, - @Validated({ValidationGroups.Create.class}) @RequestBody PatternRelationDto patternRelationDto) { + @PathVariable UUID algorithmId, + @Validated({ValidationGroups.Create.class}) @RequestBody PatternRelationDto patternRelationDto) { ControllerValidationUtils.checkIfAlgorithmIsInPatternRelationDTO(algorithmId, patternRelationDto); final var savedPatternRelation = patternRelationService.create( - ModelMapperUtils.convert(patternRelationDto, PatternRelation.class)); + ModelMapperUtils.convert(patternRelationDto, PatternRelation.class)); return new ResponseEntity<>(patternRelationAssembler.toModel(savedPatternRelation), HttpStatus.CREATED); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400", - description = "Bad Request. Invalid request body or Pattern relation doesn't belong to this algorithm"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm, pattern relation or pattern relation type with given IDs don't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", + description = "Bad Request. Invalid request body or Pattern relation doesn't belong to this algorithm"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm, pattern relation or pattern relation type with given IDs don't exist.") }, description = "Update a relation between a pattern and an algorithm. " + - "For the pattern relation type only the ID is required," + - "other pattern relation type attributes will be ignored and not changed.") + "For the pattern relation type only the ID is required," + + "other pattern relation type attributes will be ignored and not changed.") @PutMapping("/{algorithmId}/" + Constants.PATTERN_RELATIONS + "/{patternRelationId}") public ResponseEntity> updatePatternRelationOfAlgorithm( - @PathVariable UUID algorithmId, - @PathVariable UUID patternRelationId, - @Validated({ValidationGroups.Update.class}) @RequestBody PatternRelationDto patternRelationDto) { + @PathVariable UUID algorithmId, + @PathVariable UUID patternRelationId, + @Validated({ValidationGroups.Update.class}) @RequestBody PatternRelationDto patternRelationDto) { ControllerValidationUtils.checkIfAlgorithmIsInPatternRelationDTO(algorithmId, patternRelationDto); patternRelationService.checkIfAlgorithmIsInPatternRelation(algorithmId, patternRelationId); patternRelationDto.setId(patternRelationId); final var savedPatternRelation = patternRelationService.update( - ModelMapperUtils.convert(patternRelationDto, PatternRelation.class)); + ModelMapperUtils.convert(patternRelationDto, PatternRelation.class)); return ResponseEntity.ok(patternRelationAssembler.toModel(savedPatternRelation)); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or pattern relation with given IDs don't exist.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or pattern relation with given IDs don't exist.") }, description = "Delete a specific relation between a pattern and an algorithm. " + - "The pattern relation type is not affected by this.") + "The pattern relation type is not affected by this.") @DeleteMapping("/{algorithmId}/" + Constants.PATTERN_RELATIONS + "/{patternRelationId}") public ResponseEntity deletePatternRelationOfAlgorithm( - @PathVariable UUID algorithmId, - @PathVariable UUID patternRelationId) { + @PathVariable UUID algorithmId, + @PathVariable UUID patternRelationId) { patternRelationService.checkIfAlgorithmIsInPatternRelation(algorithmId, patternRelationId); patternRelationService.delete(patternRelationId); @@ -791,15 +789,15 @@ public ResponseEntity deletePatternRelationOfAlgorithm( } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or pattern relation with given IDs don't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or pattern relation with given IDs don't exist.") }, description = "Retrieve a specific relation between a pattern and an algorithm.") @GetMapping("/{algorithmId}/" + Constants.PATTERN_RELATIONS + "/{patternRelationId}") public ResponseEntity> getPatternRelationOfAlgorithm( - @PathVariable UUID algorithmId, - @PathVariable UUID patternRelationId) { + @PathVariable UUID algorithmId, + @PathVariable UUID patternRelationId) { patternRelationService.checkIfAlgorithmIsInPatternRelation(algorithmId, patternRelationId); final var patternRelation = patternRelationService.findById(patternRelationId); @@ -807,23 +805,23 @@ public ResponseEntity> getPatternRelationOfAlgor } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "417"), - @ApiResponse(responseCode = "404", description = "Not Found. Algorithm with the given ID doesn't exist") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "417"), + @ApiResponse(responseCode = "404", description = "Not Found. Algorithm with the given ID doesn't exist") }, description = "Add a Sketch to the algorithm.") @PostMapping("/{algorithmId}/" + Constants.SKETCHES) public ResponseEntity> uploadSketch( - @PathVariable UUID algorithmId, - @RequestParam("file") MultipartFile file, - @RequestParam("description") String description, - @RequestParam("baseURL") String baseURL) { + @PathVariable UUID algorithmId, + @RequestParam("file") MultipartFile file, + @RequestParam("description") String description, + @RequestParam("baseURL") String baseURL) { final Sketch sketch = sketchService.addSketchToAlgorithm(algorithmId, file, description, baseURL); return ResponseEntity.ok(this.sketchAssembler.toModel(sketch)); } @Operation(responses = { - @ApiResponse(responseCode = "200") + @ApiResponse(responseCode = "200") }, description = "Retrieve all sketches for a specific algorithm.") @GetMapping("/{algorithmId}/" + Constants.SKETCHES) public ResponseEntity>> getSketches(@PathVariable UUID algorithmId) { @@ -837,9 +835,9 @@ public ResponseEntity>> getSketches(@PathVariable UU } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Algorithm or sketch with given IDs don't exist") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Algorithm or sketch with given IDs don't exist") }, description = "Delete a sketch of the algorithm.") @DeleteMapping("/{algorithmId}/" + Constants.SKETCHES + "/{sketchId}") public ResponseEntity deleteSketch(@PathVariable UUID algorithmId, @PathVariable UUID sketchId) { @@ -848,46 +846,46 @@ public ResponseEntity deleteSketch(@PathVariable UUID algorithmId, @PathVa } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Sketch with given ID doesn't exist") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Sketch with given ID doesn't exist") }, description = "Retrieve a specific Sketch and its basic properties.") @GetMapping("/{algorithmId}/" + Constants.SKETCHES + "/{sketchId}") public ResponseEntity> getSketch(@PathVariable UUID algorithmId, @PathVariable UUID sketchId) { return ResponseEntity - .ok(this.sketchAssembler.toModel(this.sketchService.findById(sketchId))); + .ok(this.sketchAssembler.toModel(this.sketchService.findById(sketchId))); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Sketch with given ID doesn't exist") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Sketch with given ID doesn't exist") }, description = "Update the properties of a sketch.") @PutMapping("/{algorithmId}/" + Constants.SKETCHES + "/{sketchId}") public ResponseEntity> updateSketch( - @PathVariable UUID algorithmId, - @PathVariable UUID sketchId, - @Validated @RequestBody SketchDto sketchDto) { + @PathVariable UUID algorithmId, + @PathVariable UUID sketchId, + @Validated @RequestBody SketchDto sketchDto) { sketchDto.setId(sketchId); final Sketch updatedSketch = sketchService.update( - ModelMapperUtils.convert(sketchDto, Sketch.class)); + ModelMapperUtils.convert(sketchDto, Sketch.class)); return ResponseEntity.ok(this.sketchAssembler.toModel(updatedSketch)); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Sketch with given ID doesn't exist") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Sketch with given ID doesn't exist") }, description = "Retrieve the image of specific Sketch.") @GetMapping(value = "/{algorithmId}/" + Constants.SKETCHES + "/{sketchId}" + "/image") public ResponseEntity getSketchImage(@PathVariable UUID algorithmId, @PathVariable UUID sketchId) { final Image image = this.sketchService.getImageBySketch(sketchId); return ResponseEntity - .ok() - .contentType(MediaType.parseMediaType(image.getMimeType())) - .header(HttpHeaders.CONTENT_DISPOSITION, "inline") - .body(image.getImage()); + .ok() + .contentType(MediaType.parseMediaType(image.getMimeType())) + .header(HttpHeaders.CONTENT_DISPOSITION, "inline") + .body(image.getImage()); } } diff --git a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/AlgorithmRelationController.java b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/AlgorithmRelationController.java index 14ada95a4..97592a558 100644 --- a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/AlgorithmRelationController.java +++ b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/AlgorithmRelationController.java @@ -25,7 +25,6 @@ import org.planqk.atlas.core.services.AlgorithmRelationService; import org.planqk.atlas.core.services.AlgorithmService; import org.planqk.atlas.web.Constants; -import org.planqk.atlas.web.annotation.ApiVersion; import org.planqk.atlas.web.dtos.AlgorithmRelationDto; import org.planqk.atlas.web.linkassembler.AlgorithmRelationAssembler; import org.planqk.atlas.web.utils.ControllerValidationUtils; @@ -60,7 +59,6 @@ @RestController @CrossOrigin(allowedHeaders = "*", origins = "*") @RequestMapping("/" + Constants.ALGORITHMS + "/{algorithmId}/" + Constants.ALGORITHM_RELATIONS) -@ApiVersion("v1") @AllArgsConstructor @Slf4j public class AlgorithmRelationController { @@ -72,73 +70,73 @@ public class AlgorithmRelationController { private final AlgorithmService algorithmService; @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Algorithm with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Algorithm with given ID doesn't exist.") }, description = "Retrieve all relations of an algorithm.") @ListParametersDoc @GetMapping public ResponseEntity>> getAlgorithmRelationsOfAlgorithm( - @PathVariable UUID algorithmId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID algorithmId, + @Parameter(hidden = true) ListParameters listParameters) { final Page algorithmRelations = algorithmService.findLinkedAlgorithmRelations(algorithmId, listParameters.getPageable()); return ResponseEntity.ok(algorithmRelationAssembler.toModel(algorithmRelations)); } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400", - description = "Bad Request. Invalid request body or algorithm resource is not part of relation."), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or algorithm relation type with given IDs don't exist.") + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400", + description = "Bad Request. Invalid request body or algorithm resource is not part of relation."), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or algorithm relation type with given IDs don't exist.") }, description = "Create a relation between two algorithms." + - "The algorithm relation type has to be already created (e.g. via POST on /" + Constants.ALGORITHM_RELATION_TYPES + "). " + - "As a result only the ID is required for the algorithm relation type, other attributes will be ignored not changed.") + "The algorithm relation type has to be already created (e.g. via POST on /" + Constants.ALGORITHM_RELATION_TYPES + "). " + + "As a result only the ID is required for the algorithm relation type, other attributes will be ignored not changed.") @PostMapping public ResponseEntity> createAlgorithmRelation( - @PathVariable UUID algorithmId, - @Validated(ValidationGroups.Create.class) @RequestBody AlgorithmRelationDto algorithmRelationDto) { + @PathVariable UUID algorithmId, + @Validated(ValidationGroups.Create.class) @RequestBody AlgorithmRelationDto algorithmRelationDto) { ControllerValidationUtils.checkIfAlgorithmIsInAlgorithmRelationDTO(algorithmId, algorithmRelationDto); final var savedAlgorithmRelation = algorithmRelationService.create( - ModelMapperUtils.convert(algorithmRelationDto, AlgorithmRelation.class)); + ModelMapperUtils.convert(algorithmRelationDto, AlgorithmRelation.class)); return new ResponseEntity<>(algorithmRelationAssembler.toModel(savedAlgorithmRelation), HttpStatus.CREATED); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body, algorithm resource is not part of relation " + - "or specified target and source algorithms are not correct."), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm, algorithm relation or algorithm relation type with given IDs don't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body, algorithm resource is not part of relation " + + "or specified target and source algorithms are not correct."), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm, algorithm relation or algorithm relation type with given IDs don't exist.") }, description = "Update a relation between two algorithms. " + - "For the algorithm relation type only the ID is required," + - "other algorithm relation type attributes will be ignored and not changed.") + "For the algorithm relation type only the ID is required," + + "other algorithm relation type attributes will be ignored and not changed.") @PutMapping("/{algorithmRelationId}") public ResponseEntity> updateAlgorithmRelation( - @PathVariable UUID algorithmId, - @PathVariable UUID algorithmRelationId, - @Validated(ValidationGroups.Update.class) @RequestBody AlgorithmRelationDto algorithmRelationDto) { + @PathVariable UUID algorithmId, + @PathVariable UUID algorithmRelationId, + @Validated(ValidationGroups.Update.class) @RequestBody AlgorithmRelationDto algorithmRelationDto) { ControllerValidationUtils.checkIfAlgorithmIsInAlgorithmRelationDTO(algorithmId, algorithmRelationDto); algorithmRelationService.checkIfAlgorithmIsInAlgorithmRelation(algorithmId, algorithmRelationId); algorithmRelationDto.setId(algorithmRelationId); final var savedAlgorithmRelation = algorithmRelationService.update( - ModelMapperUtils.convert(algorithmRelationDto, AlgorithmRelation.class)); + ModelMapperUtils.convert(algorithmRelationDto, AlgorithmRelation.class)); return ResponseEntity.ok(algorithmRelationAssembler.toModel(savedAlgorithmRelation)); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or algorithm relation with given IDs don't exist.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or algorithm relation with given IDs don't exist.") }, description = "Delete a specific relation between a two algorithms. " + - "The algorithm relation type is not affected by this.") + "The algorithm relation type is not affected by this.") @DeleteMapping("/{algorithmRelationId}") public ResponseEntity deleteAlgorithmRelation( - @PathVariable UUID algorithmId, - @PathVariable UUID algorithmRelationId) { + @PathVariable UUID algorithmId, + @PathVariable UUID algorithmRelationId) { algorithmRelationService.checkIfAlgorithmIsInAlgorithmRelation(algorithmId, algorithmRelationId); algorithmRelationService.delete(algorithmRelationId); @@ -146,15 +144,15 @@ public ResponseEntity deleteAlgorithmRelation( } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or algorithm relation with given IDs don't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or algorithm relation with given IDs don't exist.") }, description = "Retrieve a specific relation between two algorithms.") @GetMapping("/{algorithmRelationId}") public ResponseEntity> getAlgorithmRelation( - @PathVariable UUID algorithmId, - @PathVariable UUID algorithmRelationId) { + @PathVariable UUID algorithmId, + @PathVariable UUID algorithmRelationId) { algorithmRelationService.checkIfAlgorithmIsInAlgorithmRelation(algorithmId, algorithmRelationId); final var algorithmRelation = algorithmRelationService.findById(algorithmRelationId); diff --git a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/AlgorithmRelationTypeController.java b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/AlgorithmRelationTypeController.java index d676cbb72..c7c8a35d0 100644 --- a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/AlgorithmRelationTypeController.java +++ b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/AlgorithmRelationTypeController.java @@ -24,7 +24,6 @@ import org.planqk.atlas.core.model.AlgorithmRelationType; import org.planqk.atlas.core.services.AlgorithmRelationTypeService; import org.planqk.atlas.web.Constants; -import org.planqk.atlas.web.annotation.ApiVersion; import org.planqk.atlas.web.dtos.AlgorithmRelationTypeDto; import org.planqk.atlas.web.linkassembler.AlgorithmRelationTypeAssembler; import org.planqk.atlas.web.utils.ListParameters; @@ -57,7 +56,6 @@ @RestController @CrossOrigin(allowedHeaders = "*", origins = "*") @RequestMapping("/" + Constants.ALGORITHM_RELATION_TYPES) -@ApiVersion("v1") @AllArgsConstructor @Slf4j public class AlgorithmRelationTypeController { @@ -67,50 +65,50 @@ public class AlgorithmRelationTypeController { private final AlgorithmRelationTypeAssembler algorithmRelationTypeAssembler; @Operation(responses = { - @ApiResponse(responseCode = "200") + @ApiResponse(responseCode = "200") }, description = "Retrieve all algorithm relation types.") @ListParametersDoc @GetMapping public ResponseEntity>> getAlgorithmRelationTypes( - @Parameter(hidden = true) ListParameters params) { + @Parameter(hidden = true) ListParameters params) { final var algorithmRelationTypes = algorithmRelationTypeService.findAll(params.getPageable()); return ResponseEntity.ok(algorithmRelationTypeAssembler.toModel(algorithmRelationTypes)); } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), }, description = "Define the basic properties of an algorithm relation type.") @PostMapping public ResponseEntity> createAlgorithmRelationType( - @Validated(ValidationGroups.Create.class) @RequestBody AlgorithmRelationTypeDto AlgorithmRelationTypeDto) { + @Validated(ValidationGroups.Create.class) @RequestBody AlgorithmRelationTypeDto AlgorithmRelationTypeDto) { final var savedAlgorithmRelationType = algorithmRelationTypeService.create( - ModelMapperUtils.convert(AlgorithmRelationTypeDto, AlgorithmRelationType.class)); + ModelMapperUtils.convert(AlgorithmRelationTypeDto, AlgorithmRelationType.class)); return new ResponseEntity<>(algorithmRelationTypeAssembler.toModel(savedAlgorithmRelationType), HttpStatus.CREATED); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm relation type with given ID doesn't exist") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm relation type with given ID doesn't exist") }, description = "Update the basic properties of an algorithm relation type (e.g. name).") @PutMapping("/{algorithmRelationTypeId}") public ResponseEntity> updateAlgorithmRelationType( - @PathVariable UUID algorithmRelationTypeId, - @Validated(ValidationGroups.Update.class) @RequestBody AlgorithmRelationTypeDto algorithmRelationTypeDto) { + @PathVariable UUID algorithmRelationTypeId, + @Validated(ValidationGroups.Update.class) @RequestBody AlgorithmRelationTypeDto algorithmRelationTypeDto) { algorithmRelationTypeDto.setId(algorithmRelationTypeId); final var savedAlgorithmRelationType = algorithmRelationTypeService.update( - ModelMapperUtils.convert(algorithmRelationTypeDto, AlgorithmRelationType.class)); + ModelMapperUtils.convert(algorithmRelationTypeDto, AlgorithmRelationType.class)); return ResponseEntity.ok(algorithmRelationTypeAssembler.toModel(savedAlgorithmRelationType)); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400", - description = "Bad Request. Algorithm relation type is still in use by at least one algorithm relation"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm relation type with given ID doesn't exist") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400", + description = "Bad Request. Algorithm relation type is still in use by at least one algorithm relation"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm relation type with given ID doesn't exist") }, description = "Delete an algorithm relation type.") @DeleteMapping("/{algorithmRelationTypeId}") public ResponseEntity deleteAlgorithmRelationType(@PathVariable UUID algorithmRelationTypeId) { @@ -119,14 +117,14 @@ public ResponseEntity deleteAlgorithmRelationType(@PathVariable UUID algor } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm relation type with given ID doesn't exist") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm relation type with given ID doesn't exist") }, description = "Retrieve a specific algorithm relation type and its basic properties.") @GetMapping("/{algorithmRelationTypeId}") public ResponseEntity> getAlgorithmRelationType( - @PathVariable UUID algorithmRelationTypeId) { + @PathVariable UUID algorithmRelationTypeId) { final var algorithmRelationType = algorithmRelationTypeService.findById(algorithmRelationTypeId); return ResponseEntity.ok(algorithmRelationTypeAssembler.toModel(algorithmRelationType)); } diff --git a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ApplicationAreaController.java b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ApplicationAreaController.java index 183417ace..29755f373 100644 --- a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ApplicationAreaController.java +++ b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ApplicationAreaController.java @@ -24,7 +24,6 @@ import org.planqk.atlas.core.model.ApplicationArea; import org.planqk.atlas.core.services.ApplicationAreaService; import org.planqk.atlas.web.Constants; -import org.planqk.atlas.web.annotation.ApiVersion; import org.planqk.atlas.web.dtos.ApplicationAreaDto; import org.planqk.atlas.web.linkassembler.ApplicationAreaAssembler; import org.planqk.atlas.web.utils.ListParameters; @@ -57,7 +56,6 @@ @RestController @CrossOrigin(allowedHeaders = "*", origins = "*") @RequestMapping("/" + Constants.APPLICATION_AREAS) -@ApiVersion("v1") @AllArgsConstructor @Slf4j public class ApplicationAreaController { @@ -67,49 +65,49 @@ public class ApplicationAreaController { private final ApplicationAreaAssembler applicationAreaAssembler; @Operation(responses = { - @ApiResponse(responseCode = "200") + @ApiResponse(responseCode = "200") }, description = "Retrieve all application areas") @ListParametersDoc @GetMapping public ResponseEntity>> getApplicationAreas( - @Parameter(hidden = true) ListParameters listParameters) { + @Parameter(hidden = true) ListParameters listParameters) { return ResponseEntity.ok(applicationAreaAssembler - .toModel(applicationAreaService.findAll(listParameters.getPageable(), listParameters.getSearch()))); + .toModel(applicationAreaService.findAll(listParameters.getPageable(), listParameters.getSearch()))); } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), }, description = "Define the basic properties of an application area.") @PostMapping public ResponseEntity> createApplicationArea( - @Validated(ValidationGroups.Create.class) @RequestBody ApplicationAreaDto applicationAreaDto) { + @Validated(ValidationGroups.Create.class) @RequestBody ApplicationAreaDto applicationAreaDto) { final var savedApplicationArea = applicationAreaService.create( - ModelMapperUtils.convert(applicationAreaDto, ApplicationArea.class)); + ModelMapperUtils.convert(applicationAreaDto, ApplicationArea.class)); return new ResponseEntity<>(applicationAreaAssembler.toModel(savedApplicationArea), HttpStatus.CREATED); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", - description = "Not Found. Application area with given ID does not exist"), + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", + description = "Not Found. Application area with given ID does not exist"), }, description = "Update the basic properties of an application area (e.g. name).") @PutMapping("/{applicationAreaId}") public ResponseEntity> updateApplicationArea( - @PathVariable UUID applicationAreaId, - @Validated(ValidationGroups.Update.class) @RequestBody ApplicationAreaDto applicationAreaDto) { + @PathVariable UUID applicationAreaId, + @Validated(ValidationGroups.Update.class) @RequestBody ApplicationAreaDto applicationAreaDto) { applicationAreaDto.setId(applicationAreaId); final var updatedApplicationArea = applicationAreaService.update( - ModelMapperUtils.convert(applicationAreaDto, ApplicationArea.class)); + ModelMapperUtils.convert(applicationAreaDto, ApplicationArea.class)); return ResponseEntity.ok(applicationAreaAssembler.toModel(updatedApplicationArea)); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Application area with given ID doesn't exist") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Application area with given ID doesn't exist") }, description = "Delete an application area. This removes the application area from all algorithms it is references in.") @DeleteMapping("/{applicationAreaId}") public ResponseEntity deleteApplicationArea(@PathVariable UUID applicationAreaId) { @@ -118,10 +116,10 @@ public ResponseEntity deleteApplicationArea(@PathVariable UUID application } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Application area with given ID doesn't exist") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Application area with given ID doesn't exist") }, description = "Retrieve a specific application area and its basic properties.") @GetMapping("/{applicationAreaId}") public ResponseEntity> getApplicationArea(@PathVariable UUID applicationAreaId) { diff --git a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/CloudServiceController.java b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/CloudServiceController.java index f26268868..90949fd8b 100644 --- a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/CloudServiceController.java +++ b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/CloudServiceController.java @@ -25,7 +25,6 @@ import org.planqk.atlas.core.services.CloudServiceService; import org.planqk.atlas.core.services.LinkingService; import org.planqk.atlas.web.Constants; -import org.planqk.atlas.web.annotation.ApiVersion; import org.planqk.atlas.web.dtos.CloudServiceDto; import org.planqk.atlas.web.dtos.ComputeResourceDto; import org.planqk.atlas.web.dtos.SoftwarePlatformDto; @@ -63,7 +62,6 @@ @RestController @CrossOrigin(allowedHeaders = "*", origins = "*") @RequestMapping("/" + Constants.CLOUD_SERVICES) -@ApiVersion("v1") @AllArgsConstructor @Slf4j public class CloudServiceController { @@ -79,12 +77,12 @@ public class CloudServiceController { private final LinkingService linkingService; @Operation(responses = { - @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "200"), }, description = "Retrieve all cloud services.") @ListParametersDoc @GetMapping public ResponseEntity>> getCloudServices( - @Parameter(hidden = true) ListParameters listParameters) { + @Parameter(hidden = true) ListParameters listParameters) { final Page entities; if (listParameters.getSearch() == null || listParameters.getSearch().isEmpty()) { entities = cloudServiceService.findAll(listParameters.getPageable()); @@ -95,121 +93,121 @@ public ResponseEntity>> getCloudServices } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), }, description = "Define the basic properties of a cloud service. " + - "References to sub-objects (e.g. a compute resource) can be added via sub-routes " + - "(e.g. POST on /" + Constants.CLOUD_SERVICES + "/{cloudServiceId}/" + Constants.COMPUTE_RESOURCES + ").") + "References to sub-objects (e.g. a compute resource) can be added via sub-routes " + + "(e.g. POST on /" + Constants.CLOUD_SERVICES + "/{cloudServiceId}/" + Constants.COMPUTE_RESOURCES + ").") @PostMapping public ResponseEntity> createCloudService( - @Validated(ValidationGroups.Create.class) @RequestBody CloudServiceDto cloudServiceDto) { + @Validated(ValidationGroups.Create.class) @RequestBody CloudServiceDto cloudServiceDto) { final var savedCloudService = cloudServiceService.create(ModelMapperUtils.convert(cloudServiceDto, CloudService.class)); return new ResponseEntity<>(cloudServiceAssembler.toModel(savedCloudService), HttpStatus.CREATED); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", - description = "Not Found. Cloud service with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", + description = "Not Found. Cloud service with given ID doesn't exist.") }, description = "Update the basic properties of a cloud service (e.g. name). " + - "References to sub-objects (e.g. a compute resource) are not updated via this operation - " + - "use the corresponding sub-route for updating them (e.g. PUT on " + "/" + Constants.COMPUTE_RESOURCES + "/{computeResourceId}).") + "References to sub-objects (e.g. a compute resource) are not updated via this operation - " + + "use the corresponding sub-route for updating them (e.g. PUT on " + "/" + Constants.COMPUTE_RESOURCES + "/{computeResourceId}).") @PutMapping("/{cloudServiceId}") public ResponseEntity> updateCloudService( - @PathVariable UUID cloudServiceId, - @Validated(ValidationGroups.Update.class) @RequestBody CloudServiceDto cloudServiceDto) { + @PathVariable UUID cloudServiceId, + @Validated(ValidationGroups.Update.class) @RequestBody CloudServiceDto cloudServiceDto) { cloudServiceDto.setId(cloudServiceId); final var updatedCloudService = cloudServiceService.update( - ModelMapperUtils.convert(cloudServiceDto, CloudService.class)); + ModelMapperUtils.convert(cloudServiceDto, CloudService.class)); return ResponseEntity.ok(cloudServiceAssembler.toModel(updatedCloudService)); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Cloud service with given ID doesn't exist."), + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Cloud service with given ID doesn't exist."), }, description = "Delete a cloud service. " + - "This also removes all references to other entities (e.g. compute resource).") + "This also removes all references to other entities (e.g. compute resource).") @DeleteMapping("/{cloudServiceId}") public ResponseEntity deleteCloudService( - @PathVariable UUID cloudServiceId) { + @PathVariable UUID cloudServiceId) { cloudServiceService.delete(cloudServiceId); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Cloud service with given ID doesn't exist."), + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Cloud service with given ID doesn't exist."), }, description = "Retrieve a specific cloud service and its basic properties.") @GetMapping("/{cloudServiceId}") public ResponseEntity> getCloudService( - @PathVariable UUID cloudServiceId) { + @PathVariable UUID cloudServiceId) { final var cloudService = cloudServiceService.findById(cloudServiceId); return ResponseEntity.ok(cloudServiceAssembler - .toModel(ModelMapperUtils.convert(cloudService, CloudServiceDto.class))); + .toModel(ModelMapperUtils.convert(cloudService, CloudServiceDto.class))); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Cloud service with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Cloud service with given ID doesn't exist.") }, description = "Retrieve referenced software platforms of an cloud service. If none are found an empty list is returned.") @ListParametersDoc @GetMapping("/{cloudServiceId}/" + Constants.SOFTWARE_PLATFORMS) public ResponseEntity>> getSoftwarePlatformsOfCloudService( - @PathVariable UUID cloudServiceId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID cloudServiceId, + @Parameter(hidden = true) ListParameters listParameters) { final var softwarePlatforms = cloudServiceService.findLinkedSoftwarePlatforms(cloudServiceId, listParameters.getPageable()); return ResponseEntity.ok(softwarePlatformAssembler.toModel(softwarePlatforms)); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Cloud Service or Compute Resource with given IDs don't exist."), + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Cloud Service or Compute Resource with given IDs don't exist."), }, description = "Retrieve referenced compute resources of an cloud service. If none are found an empty list is returned.") @ListParametersDoc @GetMapping("/{cloudServiceId}/" + Constants.COMPUTE_RESOURCES) public ResponseEntity>> getComputeResourcesOfCloudService( - @PathVariable UUID cloudServiceId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID cloudServiceId, + @Parameter(hidden = true) ListParameters listParameters) { final var computeResources = cloudServiceService.findLinkedComputeResources(cloudServiceId, listParameters.getPageable()); return ResponseEntity.ok(computeResourceAssembler.toModel(computeResources)); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", description = "Not Found. Cloud Service or Compute Resource with given IDs don't exist or " + - "reference was already added."), + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", description = "Not Found. Cloud Service or Compute Resource with given IDs don't exist or " + + "reference was already added."), }, description = "Add a reference to an existing compute resource " + - "(that was previously created via a POST on e.g. /" + Constants.COMPUTE_RESOURCES + "). " + - "Only the ID is required in the request body, other attributes will be ignored and not changed.") + "(that was previously created via a POST on e.g. /" + Constants.COMPUTE_RESOURCES + "). " + + "Only the ID is required in the request body, other attributes will be ignored and not changed.") @PostMapping("/{cloudServiceId}/" + Constants.COMPUTE_RESOURCES) public ResponseEntity linkCloudServiceAndComputeResource( - @PathVariable UUID cloudServiceId, - @Validated({ValidationGroups.IDOnly.class}) @RequestBody ComputeResourceDto computeResourceDto) { + @PathVariable UUID cloudServiceId, + @Validated({ValidationGroups.IDOnly.class}) @RequestBody ComputeResourceDto computeResourceDto) { linkingService.linkCloudServiceAndComputeResource(cloudServiceId, computeResourceDto.getId()); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Cloud Service or Compute Resource with given IDs don't exist or " + - "no reference exists."), + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Cloud Service or Compute Resource with given IDs don't exist or " + + "no reference exists."), }, description = "Delete a reference to a compute resource of a cloud service. " + - "The reference has to be previously created via a POST on /" + - Constants.CLOUD_SERVICES + "/{cloudServiceId}/" + Constants.COMPUTE_RESOURCES + ").") + "The reference has to be previously created via a POST on /" + + Constants.CLOUD_SERVICES + "/{cloudServiceId}/" + Constants.COMPUTE_RESOURCES + ").") @DeleteMapping("/{cloudServiceId}/" + Constants.COMPUTE_RESOURCES + "/{computeResourceId}") public ResponseEntity unlinkCloudServiceAndComputeResource( - @PathVariable UUID cloudServiceId, - @PathVariable UUID computeResourceId) { + @PathVariable UUID cloudServiceId, + @PathVariable UUID computeResourceId) { linkingService.unlinkCloudServiceAndComputeResource(cloudServiceId, computeResourceId); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } diff --git a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ComputeResourceController.java b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ComputeResourceController.java index cdf71d952..281034bdb 100644 --- a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ComputeResourceController.java +++ b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ComputeResourceController.java @@ -26,7 +26,6 @@ import org.planqk.atlas.core.services.ComputeResourcePropertyService; import org.planqk.atlas.core.services.ComputeResourceService; import org.planqk.atlas.web.Constants; -import org.planqk.atlas.web.annotation.ApiVersion; import org.planqk.atlas.web.dtos.CloudServiceDto; import org.planqk.atlas.web.dtos.ComputeResourceDto; import org.planqk.atlas.web.dtos.ComputeResourcePropertyDto; @@ -68,7 +67,6 @@ @RestController @CrossOrigin(allowedHeaders = "*", origins = "*") @RequestMapping("/" + Constants.COMPUTE_RESOURCES) -@ApiVersion("v1") @AllArgsConstructor @Slf4j public class ComputeResourceController { @@ -86,12 +84,12 @@ public class ComputeResourceController { private final CloudServiceAssembler cloudServiceAssembler; @Operation(responses = { - @ApiResponse(responseCode = "200") + @ApiResponse(responseCode = "200") }, description = "Retrieve all compute resources.") @ListParametersDoc @GetMapping public ResponseEntity>> getComputeResources( - @Parameter(hidden = true) ListParameters listParameters) { + @Parameter(hidden = true) ListParameters listParameters) { final Page entities; if (listParameters.getSearch() == null || listParameters.getSearch().isEmpty()) { entities = computeResourceService.findAll(listParameters.getPageable()); @@ -102,137 +100,137 @@ public ResponseEntity>> getComputeRes } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body.") + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body.") }, description = "Define the basic properties of a compute resource. " + - "References to sub-objects (e.g. a compute resource property) can be added via sub-routes " + - "(e.g. POST on /" + Constants.COMPUTE_RESOURCES + "/{computeResourceId}/" + Constants.COMPUTE_RESOURCE_PROPERTIES + ").") + "References to sub-objects (e.g. a compute resource property) can be added via sub-routes " + + "(e.g. POST on /" + Constants.COMPUTE_RESOURCES + "/{computeResourceId}/" + Constants.COMPUTE_RESOURCE_PROPERTIES + ").") @PostMapping public ResponseEntity> createComputeResource( - @Validated(ValidationGroups.Create.class) @RequestBody ComputeResourceDto computeResourceDto) { + @Validated(ValidationGroups.Create.class) @RequestBody ComputeResourceDto computeResourceDto) { final ComputeResource computeResource = computeResourceService.create( - ModelMapperUtils.convert(computeResourceDto, ComputeResource.class)); + ModelMapperUtils.convert(computeResourceDto, ComputeResource.class)); return ResponseEntity.status(HttpStatus.CREATED).body(computeResourceAssembler.toModel(computeResource)); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", description = "Not Found. Compute Resource with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", description = "Not Found. Compute Resource with given ID doesn't exist.") }, description = "Update the basic properties of a compute resource (e.g. name). " + - "References to sub-objects (e.g. a compute resource property) are not updated via this operation - " + - "use the corresponding sub-route for updating them (e.g. PUT on /" + - Constants.COMPUTE_RESOURCES + "/{computeResourceId}/" + Constants.COMPUTE_RESOURCE_PROPERTIES + "/{computeResourcePropertyId}).") + "References to sub-objects (e.g. a compute resource property) are not updated via this operation - " + + "use the corresponding sub-route for updating them (e.g. PUT on /" + + Constants.COMPUTE_RESOURCES + "/{computeResourceId}/" + Constants.COMPUTE_RESOURCE_PROPERTIES + "/{computeResourcePropertyId}).") @PutMapping("/{computeResourceId}") public ResponseEntity> updateComputeResource( - @PathVariable UUID computeResourceId, - @Validated(ValidationGroups.Update.class) @RequestBody ComputeResourceDto computeResourceDto) { + @PathVariable UUID computeResourceId, + @Validated(ValidationGroups.Update.class) @RequestBody ComputeResourceDto computeResourceDto) { computeResourceDto.setId(computeResourceId); final ComputeResource computeResource = computeResourceService.update( - ModelMapperUtils.convert(computeResourceDto, ComputeResource.class)); + ModelMapperUtils.convert(computeResourceDto, ComputeResource.class)); return ResponseEntity.ok(computeResourceAssembler.toModel(computeResource)); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Compute Resource with given ID doesn't exist.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Compute Resource with given ID doesn't exist.") }, description = "Delete a compute resource. " + - "This also removes all references to other entities (e.g. software platform).") + "This also removes all references to other entities (e.g. software platform).") @DeleteMapping("/{computeResourceId}") public ResponseEntity deleteComputeResource( - @PathVariable UUID computeResourceId) { + @PathVariable UUID computeResourceId) { computeResourceService.delete(computeResourceId); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Compute Resource with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Compute Resource with given ID doesn't exist.") }, description = "Retrieve a specific compute resource and its basic properties.") @GetMapping("/{computeResourceId}") public ResponseEntity> getComputeResource( - @PathVariable UUID computeResourceId) { + @PathVariable UUID computeResourceId) { final ComputeResource computeResource = computeResourceService.findById(computeResourceId); return ResponseEntity.ok(computeResourceAssembler.toModel(computeResource)); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Compute Resource with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Compute Resource with given ID doesn't exist.") }, description = "Retrieve referenced software platform of a compute resource. If none are found an empty list is returned.") @ListParametersDoc @GetMapping("/{computeResourceId}/" + Constants.SOFTWARE_PLATFORMS) public ResponseEntity>> getSoftwarePlatformsOfComputeResource( - @PathVariable UUID computeResourceId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID computeResourceId, + @Parameter(hidden = true) ListParameters listParameters) { final var softwarePlatforms = computeResourceService.findLinkedSoftwarePlatforms(computeResourceId, listParameters.getPageable()); return ResponseEntity.ok(softwarePlatformAssembler.toModel(softwarePlatforms)); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Compute Resource with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Compute Resource with given ID doesn't exist.") }, description = "Retrieve referenced cloud services of a compute resource. If none are found an empty list is returned.") @ListParametersDoc @GetMapping("/{computeResourceId}/" + Constants.CLOUD_SERVICES) public ResponseEntity>> getCloudServicesOfComputeResource( - @PathVariable UUID computeResourceId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID computeResourceId, + @Parameter(hidden = true) ListParameters listParameters) { final var cloudServices = computeResourceService.findLinkedCloudServices(computeResourceId, listParameters.getPageable()); return ResponseEntity.ok(cloudServiceAssembler.toModel(cloudServices)); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Compute Resource with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Compute Resource with given ID doesn't exist.") }, description = "Retrieve referenced compute resource properties of a compute resource. If none are found an empty list is returned.") @ListParametersDoc @GetMapping("/{computeResourceId}/" + Constants.COMPUTE_RESOURCE_PROPERTIES) public ResponseEntity>> getComputeResourcePropertiesOfComputeResource( - @PathVariable UUID computeResourceId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID computeResourceId, + @Parameter(hidden = true) ListParameters listParameters) { final var resources = computeResourcePropertyService.findComputeResourcePropertiesOfComputeResource(computeResourceId, - listParameters.getPageable()); + listParameters.getPageable()); return ResponseEntity.ok(computeResourcePropertyAssembler.toModel(resources)); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", - description = "Not Found. Compute resource or compute resource property type with given IDs don't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", + description = "Not Found. Compute resource or compute resource property type with given IDs don't exist.") }, description = "Add a compute resource property (e.g. a certain number of qubits) that is provided by an compute resource. " + - "The compute resource property type has to be already created (e.g. via POST on /" + Constants.COMPUTE_RESOURCE_PROPERTY_TYPES + "). " + - "As a result only the ID is required for the compute resource property type, other attributes will be ignored not changed.") + "The compute resource property type has to be already created (e.g. via POST on /" + Constants.COMPUTE_RESOURCE_PROPERTY_TYPES + "). " + + "As a result only the ID is required for the compute resource property type, other attributes will be ignored not changed.") @PostMapping("/{computeResourceId}/" + Constants.COMPUTE_RESOURCE_PROPERTIES) public ResponseEntity> createComputeResourcePropertyForComputeResource( - @PathVariable UUID computeResourceId, - @Validated(ValidationGroups.Create.class) @RequestBody ComputeResourcePropertyDto computeResourcePropertyDto) { + @PathVariable UUID computeResourceId, + @Validated(ValidationGroups.Create.class) @RequestBody ComputeResourcePropertyDto computeResourcePropertyDto) { final var computeResourceProperty = ModelMapperUtils.convert(computeResourcePropertyDto, ComputeResourceProperty.class); final var createdComputeResourceProperty = computeResourcePropertyService - .addComputeResourcePropertyToComputeResource(computeResourceId, computeResourceProperty); + .addComputeResourcePropertyToComputeResource(computeResourceId, computeResourceProperty); return ResponseEntity.status(HttpStatus.CREATED).body(computeResourcePropertyAssembler.toModel(createdComputeResourceProperty)); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", - description = "Not Found. Compute resource, compute resource property or compute resource type with given IDs don't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", + description = "Not Found. Compute resource, compute resource property or compute resource type with given IDs don't exist.") }, description = "Update a Compute resource property of an compute resource. " + - "For the compute resource property type only the ID is required, " + - "other compute resource property type attributes will be ignored and not changed.") + "For the compute resource property type only the ID is required, " + + "other compute resource property type attributes will be ignored and not changed.") @PutMapping("/{computeResourceId}/" + Constants.COMPUTE_RESOURCE_PROPERTIES + "/{computeResourcePropertyId}") public ResponseEntity> updateComputeResourcePropertyOfComputeResource( - @PathVariable UUID computeResourceId, - @PathVariable UUID computeResourcePropertyId, - @Validated(ValidationGroups.Update.class) @RequestBody ComputeResourcePropertyDto computeResourcePropertyDto) { + @PathVariable UUID computeResourceId, + @PathVariable UUID computeResourcePropertyId, + @Validated(ValidationGroups.Update.class) @RequestBody ComputeResourcePropertyDto computeResourcePropertyDto) { computeResourcePropertyService.checkIfComputeResourcePropertyIsOfComputeResource(computeResourceId, computeResourcePropertyId); computeResourcePropertyDto.setId(computeResourcePropertyId); @@ -242,16 +240,16 @@ public ResponseEntity> updateComputeReso } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Compute resource or compute resource property with given IDs don't exist."), + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Compute resource or compute resource property with given IDs don't exist."), }, description = "Delete a Compute resource property of an compute resource. " + - "The compute resource property type is not affected by this.") + "The compute resource property type is not affected by this.") @DeleteMapping("/{computeResourceId}/" + Constants.COMPUTE_RESOURCE_PROPERTIES + "/{computeResourcePropertyId}") public HttpEntity deleteComputeResourcePropertyOfComputeResource( - @PathVariable UUID computeResourceId, - @PathVariable UUID computeResourcePropertyId) { + @PathVariable UUID computeResourceId, + @PathVariable UUID computeResourcePropertyId) { computeResourcePropertyService.checkIfComputeResourcePropertyIsOfComputeResource(computeResourceId, computeResourcePropertyId); computeResourcePropertyService.delete(computeResourcePropertyId); @@ -259,15 +257,15 @@ public HttpEntity deleteComputeResourcePropertyOfComputeResource( } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Compute resource or compute resource property with given IDs don't exist."), + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Compute resource or compute resource property with given IDs don't exist."), }, description = "Retrieve a specific compute resource property of an compute resource.") @GetMapping("/{computeResourceId}/" + Constants.COMPUTE_RESOURCE_PROPERTIES + "/{computeResourcePropertyId}") public HttpEntity> getComputeResourcePropertyOfComputeResource( - @PathVariable UUID computeResourceId, - @PathVariable UUID computeResourcePropertyId) { + @PathVariable UUID computeResourceId, + @PathVariable UUID computeResourcePropertyId) { computeResourcePropertyService.checkIfComputeResourcePropertyIsOfComputeResource(computeResourceId, computeResourcePropertyId); final var resource = computeResourcePropertyService.findById(computeResourcePropertyId); diff --git a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ComputeResourcePropertyTypeController.java b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ComputeResourcePropertyTypeController.java index f3945b260..fe869c29d 100644 --- a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ComputeResourcePropertyTypeController.java +++ b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ComputeResourcePropertyTypeController.java @@ -24,7 +24,6 @@ import org.planqk.atlas.core.model.ComputeResourcePropertyType; import org.planqk.atlas.core.services.ComputeResourcePropertyTypeService; import org.planqk.atlas.web.Constants; -import org.planqk.atlas.web.annotation.ApiVersion; import org.planqk.atlas.web.dtos.ComputeResourcePropertyTypeDto; import org.planqk.atlas.web.linkassembler.ComputeResourcePropertyTypeAssembler; import org.planqk.atlas.web.utils.ListParameters; @@ -57,7 +56,6 @@ @RestController @CrossOrigin(allowedHeaders = "*", origins = "*") @RequestMapping("/" + Constants.COMPUTE_RESOURCE_PROPERTY_TYPES) -@ApiVersion("v1") @AllArgsConstructor @Slf4j public class ComputeResourcePropertyTypeController { @@ -67,69 +65,69 @@ public class ComputeResourcePropertyTypeController { private final ComputeResourcePropertyTypeService computeResourcePropertyTypeService; @Operation(responses = { - @ApiResponse(responseCode = "200") + @ApiResponse(responseCode = "200") }, description = "Retrieve all compute resource property types.") @ListParametersDoc @GetMapping public ResponseEntity>> getResourcePropertyTypes( - @Parameter(hidden = true) ListParameters listParameters) { + @Parameter(hidden = true) ListParameters listParameters) { final var savedComputeResourcePropertyType = computeResourcePropertyTypeService.findAll(listParameters.getPageable()); return ResponseEntity.ok(computeResourcePropertyTypeAssembler.toModel(savedComputeResourcePropertyType)); } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), }, description = "Define the basic properties of an compute resource property type.") @PostMapping public ResponseEntity> createComputingResourcePropertyType( - @Validated(ValidationGroups.Create.class) @RequestBody ComputeResourcePropertyTypeDto computeResourcePropertyTypeDto) { + @Validated(ValidationGroups.Create.class) @RequestBody ComputeResourcePropertyTypeDto computeResourcePropertyTypeDto) { final var savedComputeResourcePropertyType = computeResourcePropertyTypeService.create( - ModelMapperUtils.convert(computeResourcePropertyTypeDto, ComputeResourcePropertyType.class)); + ModelMapperUtils.convert(computeResourcePropertyTypeDto, ComputeResourcePropertyType.class)); return new ResponseEntity<>(computeResourcePropertyTypeAssembler - .toModel(savedComputeResourcePropertyType), HttpStatus.CREATED); + .toModel(savedComputeResourcePropertyType), HttpStatus.CREATED); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", - description = "Not Found. Compute resource property type with given ID doesn't exist") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", + description = "Not Found. Compute resource property type with given ID doesn't exist") }, description = "Update the basic properties of an compute resource property type (e.g. name).") @PutMapping("/{computeResourcePropertyTypeId}") public ResponseEntity> updateComputingResourcePropertyType( - @PathVariable UUID computeResourcePropertyTypeId, - @Validated(ValidationGroups.Update.class) @RequestBody - ComputeResourcePropertyTypeDto computeResourcePropertyTypeDto) { + @PathVariable UUID computeResourcePropertyTypeId, + @Validated(ValidationGroups.Update.class) @RequestBody + ComputeResourcePropertyTypeDto computeResourcePropertyTypeDto) { computeResourcePropertyTypeDto.setId(computeResourcePropertyTypeId); final var savedComputeResourcePropertyType = computeResourcePropertyTypeService.update( - ModelMapperUtils.convert(computeResourcePropertyTypeDto, ComputeResourcePropertyType.class)); + ModelMapperUtils.convert(computeResourcePropertyTypeDto, ComputeResourcePropertyType.class)); return ResponseEntity.ok(computeResourcePropertyTypeAssembler.toModel(savedComputeResourcePropertyType)); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400", - description = "Bad Request. Compute resource property type is still in use by at least one compute resource property"), - @ApiResponse(responseCode = "404", - description = "Not Found. Compute resource property type with given ID doesn't exist") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400", + description = "Bad Request. Compute resource property type is still in use by at least one compute resource property"), + @ApiResponse(responseCode = "404", + description = "Not Found. Compute resource property type with given ID doesn't exist") }, description = "Delete an compute resource property type.") @DeleteMapping("/{computeResourcePropertyTypeId}") public ResponseEntity deleteComputingResourcePropertyType( - @PathVariable UUID computeResourcePropertyTypeId) { + @PathVariable UUID computeResourcePropertyTypeId) { computeResourcePropertyTypeService.delete(computeResourcePropertyTypeId); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Compute resource property type with given ID doesn't exist") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Compute resource property type with given ID doesn't exist") }, description = "Retrieve a specific compute resource property type and its basic properties.") @GetMapping("/{computeResourcePropertyTypeId}") public ResponseEntity> getComputingResourcePropertyType( - @PathVariable UUID computeResourcePropertyTypeId) { + @PathVariable UUID computeResourcePropertyTypeId) { final var computeResourcePropertyType = computeResourcePropertyTypeService.findById(computeResourcePropertyTypeId); return ResponseEntity.ok(computeResourcePropertyTypeAssembler.toModel(computeResourcePropertyType)); } diff --git a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/DiscussionCommentController.java b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/DiscussionCommentController.java index 1aa228a6c..664724f15 100644 --- a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/DiscussionCommentController.java +++ b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/DiscussionCommentController.java @@ -27,7 +27,6 @@ import org.planqk.atlas.core.services.DiscussionCommentService; import org.planqk.atlas.core.services.DiscussionTopicService; import org.planqk.atlas.web.Constants; -import org.planqk.atlas.web.annotation.ApiVersion; import org.planqk.atlas.web.dtos.DiscussionCommentDto; import org.planqk.atlas.web.linkassembler.DiscussionCommentAssembler; import org.planqk.atlas.web.utils.ListParameters; @@ -52,7 +51,6 @@ @Tag(name = Constants.TAG_DISCUSSION_TOPIC) @CrossOrigin(allowedHeaders = "*", origins = "*") @RestController("discussion-comment") -@ApiVersion("v1") @AllArgsConstructor @Slf4j public class DiscussionCommentController { @@ -64,28 +62,28 @@ public class DiscussionCommentController { private final DiscussionCommentAssembler discussionCommentAssembler; @Operation(responses = { - @ApiResponse(responseCode = "200") + @ApiResponse(responseCode = "200") }, description = "") @ListParametersDoc public ResponseEntity>> getDiscussionCommentsOfTopic( - @PathVariable("topicId") UUID topicId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable("topicId") UUID topicId, + @Parameter(hidden = true) ListParameters listParameters) { final var result = discussionCommentService.findAllByTopic(topicId, listParameters.getPageable()); return ResponseEntity.ok(discussionCommentAssembler.toModel(result)); } @Operation(responses = { - @ApiResponse(responseCode = "201") + @ApiResponse(responseCode = "201") }, description = "") public ResponseEntity> createDiscussionComment( - @Valid @RequestBody DiscussionCommentDto discussionCommentDto) { + @Valid @RequestBody DiscussionCommentDto discussionCommentDto) { final var comment = discussionCommentService.create(ModelMapperUtils.convert(discussionCommentDto, DiscussionComment.class)); return new ResponseEntity<>(discussionCommentAssembler.toModel(comment), HttpStatus.CREATED); } public ResponseEntity> createDiscussionComment( - @Valid @RequestBody DiscussionCommentDto discussionCommentDto, - KnowledgeArtifact knowledgeArtifact) { + @Valid @RequestBody DiscussionCommentDto discussionCommentDto, + KnowledgeArtifact knowledgeArtifact) { final DiscussionComment convertedDiscussionComment = ModelMapperUtils.convert(discussionCommentDto, DiscussionComment.class); convertedDiscussionComment.getDiscussionTopic().setKnowledgeArtifact(knowledgeArtifact); final var comment = discussionCommentService.create(convertedDiscussionComment); @@ -93,11 +91,11 @@ public ResponseEntity> createDiscussionComment } @Operation(responses = { - @ApiResponse(responseCode = "200") + @ApiResponse(responseCode = "200") }, description = "") public ResponseEntity> updateDiscussionComment( - @PathVariable UUID commentId, - @Valid @RequestBody DiscussionCommentDto discussionCommentDto) { + @PathVariable UUID commentId, + @Valid @RequestBody DiscussionCommentDto discussionCommentDto) { final var discussionCommentObject = discussionCommentService.findById(commentId); final var discussionComment = ModelMapperUtils.convert(discussionCommentDto, DiscussionComment.class); final var discussionTopic = discussionCommentObject.getDiscussionTopic(); @@ -107,9 +105,9 @@ public ResponseEntity> updateDiscussionComment } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Discussion comment with given id doesn't exist") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Discussion comment with given id doesn't exist") }) public ResponseEntity deleteDiscussionComment(@PathVariable UUID commentId) { discussionCommentService.findById(commentId); @@ -118,7 +116,7 @@ public ResponseEntity deleteDiscussionComment(@PathVariable UUID commentId } @Operation(responses = { - @ApiResponse(responseCode = "200") + @ApiResponse(responseCode = "200") }, description = "") public ResponseEntity> getDiscussionComment(@PathVariable UUID commentId) { final var discussionComment = discussionCommentService.findById(commentId); diff --git a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/DiscussionTopicController.java b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/DiscussionTopicController.java index c0b386d24..50567b226 100644 --- a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/DiscussionTopicController.java +++ b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/DiscussionTopicController.java @@ -27,7 +27,6 @@ import org.planqk.atlas.core.services.DiscussionCommentService; import org.planqk.atlas.core.services.DiscussionTopicService; import org.planqk.atlas.web.Constants; -import org.planqk.atlas.web.annotation.ApiVersion; import org.planqk.atlas.web.dtos.DiscussionCommentDto; import org.planqk.atlas.web.dtos.DiscussionTopicDto; import org.planqk.atlas.web.linkassembler.DiscussionTopicAssembler; @@ -62,7 +61,6 @@ @io.swagger.v3.oas.annotations.tags.Tag(name = Constants.TAG_DISCUSSION_TOPIC) @CrossOrigin(allowedHeaders = "*", origins = "*") @RequestMapping("/" + Constants.DISCUSSION_TOPICS) -@ApiVersion("v1") @Slf4j @AllArgsConstructor @RestController @@ -77,27 +75,27 @@ public class DiscussionTopicController { private final DiscussionCommentController discussionCommentController; @Operation(responses = { - @ApiResponse(responseCode = "200") + @ApiResponse(responseCode = "200") }, description = "") @ListParametersDoc @GetMapping public HttpEntity>> getDiscussionTopics( - @Parameter(hidden = true) ListParameters listParameters) { + @Parameter(hidden = true) ListParameters listParameters) { final var topics = discussionTopicService.findAll(listParameters.getPageable()); return ResponseEntity.ok(discussionTopicAssembler.toModel(topics)); } public HttpEntity>> getDiscussionTopics( - UUID knowledgeArtifactId, - @Parameter(hidden = true) ListParameters listParameters) { + UUID knowledgeArtifactId, + @Parameter(hidden = true) ListParameters listParameters) { final var topics = discussionTopicService.findByKnowledgeArtifactId(knowledgeArtifactId, listParameters.getPageable()); return ResponseEntity.ok(discussionTopicAssembler.toModel(topics)); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404") }, description = "") @GetMapping("/{topicId}") public HttpEntity> getDiscussionTopic(@PathVariable UUID topicId) { @@ -112,9 +110,9 @@ public HttpEntity> getDiscussionTopic(UUID knowl } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404") }, description = "") @DeleteMapping("/{topicId}") public HttpEntity deleteDiscussionTopic(@PathVariable UUID topicId) { @@ -129,20 +127,20 @@ public HttpEntity deleteDiscussionTopic(UUID knowledgeArtifactId, UUID top } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404") + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404") }, description = "") @PostMapping() public HttpEntity> createDiscussionTopic( - @Validated(ValidationGroups.Create.class) @RequestBody DiscussionTopicDto discussionTopicDto) { + @Validated(ValidationGroups.Create.class) @RequestBody DiscussionTopicDto discussionTopicDto) { final var discussionTopic = discussionTopicService.create(ModelMapperUtils.convert(discussionTopicDto, DiscussionTopic.class)); return new ResponseEntity<>(discussionTopicAssembler.toModel(discussionTopic), HttpStatus.CREATED); } public HttpEntity> createDiscussionTopic( - KnowledgeArtifact knowledgeArtifact, - @Validated(ValidationGroups.Create.class) @RequestBody DiscussionTopicDto discussionTopicDto) { + KnowledgeArtifact knowledgeArtifact, + @Validated(ValidationGroups.Create.class) @RequestBody DiscussionTopicDto discussionTopicDto) { final DiscussionTopic convertedDiscussionTopic = ModelMapperUtils.convert(discussionTopicDto, DiscussionTopic.class); convertedDiscussionTopic.setKnowledgeArtifact(knowledgeArtifact); final var discussionTopic = discussionTopicService.create(convertedDiscussionTopic); @@ -153,52 +151,52 @@ public HttpEntity> createDiscussionTopic( } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404") }, description = "") @ListParametersDoc @GetMapping("/{topicId}/" + Constants.DISCUSSION_COMMENTS) public HttpEntity>> getDiscussionComments( - @PathVariable UUID topicId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID topicId, + @Parameter(hidden = true) ListParameters listParameters) { return discussionCommentController.getDiscussionCommentsOfTopic(topicId, listParameters); } public HttpEntity>> getDiscussionComments( - UUID knowledgeArtifactId, - UUID topicId, - @Parameter(hidden = true) ListParameters listParameters) { + UUID knowledgeArtifactId, + UUID topicId, + @Parameter(hidden = true) ListParameters listParameters) { discussionTopicService.checkIfDiscussionTopicIsLinkedToKnowledgeArtifact(topicId, knowledgeArtifactId); return discussionCommentController.getDiscussionCommentsOfTopic(topicId, listParameters); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404") }, description = "") @GetMapping("/{topicId}/" + Constants.DISCUSSION_COMMENTS + "/{commentId}") public HttpEntity> getDiscussionComment( - @PathVariable UUID topicId, - @PathVariable UUID commentId) { + @PathVariable UUID topicId, + @PathVariable UUID commentId) { discussionCommentService.checkIfDiscussionCommentIsInDiscussionTopic(commentId, topicId); return discussionCommentController.getDiscussionComment(commentId); } public HttpEntity> getDiscussionComment( - UUID knowledgeArtifactId, - UUID topicId, - UUID commentId) { + UUID knowledgeArtifactId, + UUID topicId, + UUID commentId) { discussionTopicService.checkIfDiscussionTopicIsLinkedToKnowledgeArtifact(topicId, knowledgeArtifactId); discussionCommentService.checkIfDiscussionCommentIsInDiscussionTopic(commentId, topicId); return discussionCommentController.getDiscussionComment(commentId); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404") }, description = "") @DeleteMapping("/{topicId}/" + Constants.DISCUSSION_COMMENTS + "/{commentId}") public HttpEntity deleteDiscussionComment(@PathVariable UUID topicId, @PathVariable UUID commentId) { @@ -213,25 +211,25 @@ public HttpEntity deleteDiscussionComment(UUID knowledgeArtifactId, UUID t } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404") }, description = "") @PutMapping("/{topicId}/" + Constants.DISCUSSION_COMMENTS + "/{commentId}") public HttpEntity> updateDiscussionComment( - @PathVariable UUID topicId, - @PathVariable UUID commentId, - @Validated(ValidationGroups.Update.class) @RequestBody DiscussionCommentDto discussionCommentDto) { + @PathVariable UUID topicId, + @PathVariable UUID commentId, + @Validated(ValidationGroups.Update.class) @RequestBody DiscussionCommentDto discussionCommentDto) { discussionCommentService.checkIfDiscussionCommentIsInDiscussionTopic(commentId, topicId); discussionCommentDto.setId(commentId); return discussionCommentController.updateDiscussionComment(commentId, discussionCommentDto); } public HttpEntity> updateDiscussionComment( - UUID knowledgeArtifactId, - UUID topicId, - UUID commentId, - DiscussionCommentDto discussionCommentDto) { + UUID knowledgeArtifactId, + UUID topicId, + UUID commentId, + DiscussionCommentDto discussionCommentDto) { discussionTopicService.checkIfDiscussionTopicIsLinkedToKnowledgeArtifact(topicId, knowledgeArtifactId); discussionCommentService.checkIfDiscussionCommentIsInDiscussionTopic(commentId, topicId); discussionCommentDto.setId(commentId); @@ -239,23 +237,23 @@ public HttpEntity> updateDiscussionComment( } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404") + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404") }, description = "") @PostMapping("/{topicId}/" + Constants.DISCUSSION_COMMENTS) public HttpEntity> createDiscussionComment( - @PathVariable UUID topicId, - @Validated(ValidationGroups.Create.class) @RequestBody DiscussionCommentDto discussionCommentDto) { + @PathVariable UUID topicId, + @Validated(ValidationGroups.Create.class) @RequestBody DiscussionCommentDto discussionCommentDto) { final DiscussionTopic discussionTopic = discussionTopicService.findById(topicId); discussionCommentDto.setDiscussionTopic(ModelMapperUtils.convert(discussionTopic, DiscussionTopicDto.class)); return discussionCommentController.createDiscussionComment(discussionCommentDto); } public HttpEntity> createDiscussionComment( - UUID knowledgeArtifactId, - UUID topicId, - @Validated(ValidationGroups.Create.class) @RequestBody DiscussionCommentDto discussionCommentDto) { + UUID knowledgeArtifactId, + UUID topicId, + @Validated(ValidationGroups.Create.class) @RequestBody DiscussionCommentDto discussionCommentDto) { discussionTopicService.checkIfDiscussionTopicIsLinkedToKnowledgeArtifact(topicId, knowledgeArtifactId); final DiscussionTopic discussionTopic = discussionTopicService.findById(topicId); discussionCommentDto.setDiscussionTopic(ModelMapperUtils.convert(discussionTopic, DiscussionTopicDto.class)); @@ -263,23 +261,23 @@ public HttpEntity> createDiscussionComment( } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404") + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404") }, description = "") @PutMapping("/{topicId}") public HttpEntity> updateDiscussionTopic( - @PathVariable UUID topicId, - @Validated(ValidationGroups.Update.class) @RequestBody DiscussionTopicDto discussionTopicDto) { + @PathVariable UUID topicId, + @Validated(ValidationGroups.Update.class) @RequestBody DiscussionTopicDto discussionTopicDto) { discussionTopicDto.setId(topicId); final DiscussionTopic discussionTopic = discussionTopicService.update(ModelMapperUtils.convert(discussionTopicDto, DiscussionTopic.class)); return ResponseEntity.ok(discussionTopicAssembler.toModel(discussionTopic)); } public HttpEntity> updateDiscussionTopic( - KnowledgeArtifact knowledgeArtifact, - UUID topicId, - @Validated(ValidationGroups.Update.class) @RequestBody DiscussionTopicDto discussionTopicDto) { + KnowledgeArtifact knowledgeArtifact, + UUID topicId, + @Validated(ValidationGroups.Update.class) @RequestBody DiscussionTopicDto discussionTopicDto) { discussionTopicService.checkIfDiscussionTopicIsLinkedToKnowledgeArtifact(topicId, knowledgeArtifact.getId()); discussionTopicDto.setId(topicId); final DiscussionTopic convertedDiscussionTopic = ModelMapperUtils.convert(discussionTopicDto, DiscussionTopic.class); diff --git a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ImplementationController.java b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ImplementationController.java index 8c4075c22..6e41de842 100644 --- a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ImplementationController.java +++ b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ImplementationController.java @@ -36,7 +36,6 @@ import org.planqk.atlas.core.services.SoftwarePlatformService; import org.planqk.atlas.core.services.TagService; import org.planqk.atlas.web.Constants; -import org.planqk.atlas.web.annotation.ApiVersion; import org.planqk.atlas.web.dtos.ComputeResourcePropertyDto; import org.planqk.atlas.web.dtos.DiscussionCommentDto; import org.planqk.atlas.web.dtos.DiscussionTopicDto; @@ -91,7 +90,6 @@ @RestController @CrossOrigin(allowedHeaders = "*", origins = "*") @RequestMapping("/" + Constants.ALGORITHMS + "/{algorithmId}/" + Constants.IMPLEMENTATIONS) -@ApiVersion("v1") @AllArgsConstructor @Slf4j public class ImplementationController { diff --git a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ImplementationGlobalController.java b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ImplementationGlobalController.java index cfdfa5232..d91fa096c 100644 --- a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ImplementationGlobalController.java +++ b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ImplementationGlobalController.java @@ -23,7 +23,6 @@ import org.planqk.atlas.core.services.ImplementationService; import org.planqk.atlas.web.Constants; -import org.planqk.atlas.web.annotation.ApiVersion; import org.planqk.atlas.web.dtos.ImplementationDto; import org.planqk.atlas.web.linkassembler.ImplementationAssembler; import org.planqk.atlas.web.utils.ListParameters; @@ -51,7 +50,6 @@ @RestController @CrossOrigin(allowedHeaders = "*", origins = "*") @RequestMapping("/" + Constants.IMPLEMENTATIONS) -@ApiVersion("v1") @AllArgsConstructor @Slf4j public class ImplementationGlobalController { @@ -61,25 +59,25 @@ public class ImplementationGlobalController { private final ImplementationAssembler implementationAssembler; @Operation(responses = { - @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "200"), }, description = "Retrieve all implementations unaffected by its implemented algorithm") @ListParametersDoc @GetMapping public ResponseEntity>> getImplementations( - @Parameter(hidden = true) ListParameters listParameters) { + @Parameter(hidden = true) ListParameters listParameters) { final var implementations = implementationService.findAll(listParameters.getPageable()); return ResponseEntity.ok(implementationAssembler.toModel(implementations)); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Implementation with given ID doesn't exist") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Implementation with given ID doesn't exist") }, description = "Retrieve a specific implementation and its basic properties.") @GetMapping("/{implementationId}") public ResponseEntity> getImplementation( - @PathVariable UUID implementationId) { + @PathVariable UUID implementationId) { final var implementation = this.implementationService.findById(implementationId); return ResponseEntity.ok(implementationAssembler.toModel(implementation)); } diff --git a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/PatternRelationController.java b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/PatternRelationController.java index 90b09b3a2..13a00a8f2 100644 --- a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/PatternRelationController.java +++ b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/PatternRelationController.java @@ -24,7 +24,6 @@ import org.planqk.atlas.core.model.PatternRelation; import org.planqk.atlas.core.services.PatternRelationService; import org.planqk.atlas.web.Constants; -import org.planqk.atlas.web.annotation.ApiVersion; import org.planqk.atlas.web.dtos.PatternRelationDto; import org.planqk.atlas.web.linkassembler.PatternRelationAssembler; import org.planqk.atlas.web.utils.ListParameters; @@ -57,7 +56,6 @@ @RestController @CrossOrigin(allowedHeaders = "*", origins = "*") @RequestMapping("/" + Constants.PATTERN_RELATIONS) -@ApiVersion("v1") @AllArgsConstructor @Slf4j public class PatternRelationController { @@ -67,58 +65,58 @@ public class PatternRelationController { private final PatternRelationAssembler patternRelationAssembler; @Operation(responses = { - @ApiResponse(responseCode = "200") + @ApiResponse(responseCode = "200") }, description = "Retrieve all relations between pattern and algorithms.") @ListParametersDoc @GetMapping public ResponseEntity>> getPatternRelations( - @Parameter(hidden = true) ListParameters listParameters) { + @Parameter(hidden = true) ListParameters listParameters) { final var patternRelations = patternRelationService.findAll(listParameters.getPageable()); return ResponseEntity.ok(patternRelationAssembler.toModel(patternRelations)); } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or Pattern relation type with given IDs don't exist.") + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or Pattern relation type with given IDs don't exist.") }, description = "Create a relation between a pattern and an algorithm." + - "The pattern relation type has to be already created (e.g. via POST on /" + Constants.PATTERN_RELATION_TYPES + "). " + - "As a result only the ID is required for the pattern relation type, other attributes will be ignored not changed.") + "The pattern relation type has to be already created (e.g. via POST on /" + Constants.PATTERN_RELATION_TYPES + "). " + + "As a result only the ID is required for the pattern relation type, other attributes will be ignored not changed.") @PostMapping public ResponseEntity> createPatternRelation( - @Validated({ValidationGroups.Create.class}) @RequestBody PatternRelationDto patternRelationDto) { + @Validated({ValidationGroups.Create.class}) @RequestBody PatternRelationDto patternRelationDto) { final var savedPatternRelation = patternRelationService.create( - ModelMapperUtils.convert(patternRelationDto, PatternRelation.class)); + ModelMapperUtils.convert(patternRelationDto, PatternRelation.class)); return new ResponseEntity<>(patternRelationAssembler.toModel(savedPatternRelation), HttpStatus.CREATED); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400", - description = "Bad Request. Invalid request body or algorithm with given ID is not part of pattern relation."), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm, pattern relation or pattern relation type with given IDs don't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", + description = "Bad Request. Invalid request body or algorithm with given ID is not part of pattern relation."), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm, pattern relation or pattern relation type with given IDs don't exist.") }, description = "Update a relation between a pattern and an algorithm. " + - "For the pattern relation type only the ID is required," + - "other pattern relation type attributes will be ignored and not changed.") + "For the pattern relation type only the ID is required," + + "other pattern relation type attributes will be ignored and not changed.") @PutMapping("/{patternRelationId}") public ResponseEntity> updatePatternRelation( - @PathVariable UUID patternRelationId, - @Validated({ValidationGroups.Update.class}) @RequestBody PatternRelationDto patternRelationDto) { + @PathVariable UUID patternRelationId, + @Validated({ValidationGroups.Update.class}) @RequestBody PatternRelationDto patternRelationDto) { patternRelationDto.setId(patternRelationId); final var savedPatternRelation = patternRelationService.update( - ModelMapperUtils.convert(patternRelationDto, PatternRelation.class)); + ModelMapperUtils.convert(patternRelationDto, PatternRelation.class)); return ResponseEntity.ok(patternRelationAssembler.toModel(savedPatternRelation)); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or pattern relation with given IDs don't exist.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or pattern relation with given IDs don't exist.") }, description = "Delete a specific relation between a pattern and an algorithm. " + - "The pattern relation type is not affected by this.") + "The pattern relation type is not affected by this.") @DeleteMapping("/{patternRelationId}") public ResponseEntity deletePatternRelation(@PathVariable UUID patternRelationId) { patternRelationService.delete(patternRelationId); @@ -126,10 +124,10 @@ public ResponseEntity deletePatternRelation(@PathVariable UUID patternRela } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or pattern relation with given IDs don't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or pattern relation with given IDs don't exist.") }, description = "Retrieve a specific relation between a pattern and an algorithm.") @GetMapping("/{patternRelationId}") public ResponseEntity> getPatternRelation(@PathVariable UUID patternRelationId) { diff --git a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/PatternRelationTypeController.java b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/PatternRelationTypeController.java index 56c47cb43..9224b34bc 100644 --- a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/PatternRelationTypeController.java +++ b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/PatternRelationTypeController.java @@ -24,7 +24,6 @@ import org.planqk.atlas.core.model.PatternRelationType; import org.planqk.atlas.core.services.PatternRelationTypeService; import org.planqk.atlas.web.Constants; -import org.planqk.atlas.web.annotation.ApiVersion; import org.planqk.atlas.web.dtos.PatternRelationTypeDto; import org.planqk.atlas.web.linkassembler.PatternRelationTypeAssembler; import org.planqk.atlas.web.utils.ListParameters; @@ -57,7 +56,6 @@ @RestController @CrossOrigin(allowedHeaders = "*", origins = "*") @RequestMapping("/" + Constants.PATTERN_RELATION_TYPES) -@ApiVersion("v1") @AllArgsConstructor @Slf4j public class PatternRelationTypeController { @@ -67,67 +65,67 @@ public class PatternRelationTypeController { private final PatternRelationTypeAssembler patternRelationTypeAssembler; @Operation(responses = { - @ApiResponse(responseCode = "200") + @ApiResponse(responseCode = "200") }, description = "Retrieve all pattern relation types.") @ListParametersDoc @GetMapping public ResponseEntity>> getPatternRelationTypes( - @Parameter(hidden = true) ListParameters listParameters) { + @Parameter(hidden = true) ListParameters listParameters) { final var patternRelationTypes = patternRelationTypeService.findAll(listParameters.getPageable()); return ResponseEntity.ok(patternRelationTypeAssembler.toModel(patternRelationTypes)); } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body.") + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body.") }, description = "Define the basic properties of an pattern relation type.") @PostMapping public ResponseEntity> createPatternRelationType( - @Validated(ValidationGroups.Create.class) @RequestBody PatternRelationTypeDto patternRelationTypeDto) { + @Validated(ValidationGroups.Create.class) @RequestBody PatternRelationTypeDto patternRelationTypeDto) { final PatternRelationType savedRelationType = patternRelationTypeService - .create(ModelMapperUtils.convert(patternRelationTypeDto, PatternRelationType.class)); + .create(ModelMapperUtils.convert(patternRelationTypeDto, PatternRelationType.class)); return new ResponseEntity<>(patternRelationTypeAssembler.toModel(savedRelationType), HttpStatus.CREATED); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", - description = "Not Found. Pattern relation type with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", + description = "Not Found. Pattern relation type with given ID doesn't exist.") }, description = "Update the basic properties of an pattern relation type (e.g. name).") @PutMapping("/{patternRelationTypeId}") public ResponseEntity> updatePatternRelationType( - @PathVariable UUID patternRelationTypeId, - @Validated(ValidationGroups.Update.class) @RequestBody PatternRelationTypeDto patternRelationTypeDto) { + @PathVariable UUID patternRelationTypeId, + @Validated(ValidationGroups.Update.class) @RequestBody PatternRelationTypeDto patternRelationTypeDto) { patternRelationTypeDto.setId(patternRelationTypeId); final var relationType = patternRelationTypeService.update( - ModelMapperUtils.convert(patternRelationTypeDto, PatternRelationType.class)); + ModelMapperUtils.convert(patternRelationTypeDto, PatternRelationType.class)); return ResponseEntity.ok(patternRelationTypeAssembler.toModel(relationType)); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400", - description = "Bad Request. Pattern relation type is still in use by at least one pattern relation."), - @ApiResponse(responseCode = "404", - description = "Not Found. Pattern relation type with given ID doesn't exist.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400", + description = "Bad Request. Pattern relation type is still in use by at least one pattern relation."), + @ApiResponse(responseCode = "404", + description = "Not Found. Pattern relation type with given ID doesn't exist.") }, description = "Delete an pattern relation type.") @DeleteMapping("/{patternRelationTypeId}") public ResponseEntity deletePatternRelationType( - @PathVariable UUID patternRelationTypeId) { + @PathVariable UUID patternRelationTypeId) { patternRelationTypeService.delete(patternRelationTypeId); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Pattern relation type with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Pattern relation type with given ID doesn't exist.") }, description = "Retrieve a specific pattern relation type and its basic properties.") @GetMapping("/{patternRelationTypeId}") public ResponseEntity> getPatternRelationType( - @PathVariable UUID patternRelationTypeId) { + @PathVariable UUID patternRelationTypeId) { final var patternRelationType = patternRelationTypeService.findById(patternRelationTypeId); return ResponseEntity.ok(patternRelationTypeAssembler.toModel(patternRelationType)); } diff --git a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ProblemTypeController.java b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ProblemTypeController.java index 750c28c20..42ecb1115 100644 --- a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ProblemTypeController.java +++ b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/ProblemTypeController.java @@ -24,7 +24,6 @@ import org.planqk.atlas.core.model.ProblemType; import org.planqk.atlas.core.services.ProblemTypeService; import org.planqk.atlas.web.Constants; -import org.planqk.atlas.web.annotation.ApiVersion; import org.planqk.atlas.web.dtos.ProblemTypeDto; import org.planqk.atlas.web.linkassembler.ProblemTypeAssembler; import org.planqk.atlas.web.utils.ListParameters; @@ -58,7 +57,6 @@ @RestController @CrossOrigin(allowedHeaders = "*", origins = "*") @RequestMapping("/" + Constants.PROBLEM_TYPES) -@ApiVersion("v1") @AllArgsConstructor @Slf4j public class ProblemTypeController { @@ -68,47 +66,47 @@ public class ProblemTypeController { private final ProblemTypeAssembler problemTypeAssembler; @Operation(responses = { - @ApiResponse(responseCode = "200") + @ApiResponse(responseCode = "200") }, description = "Retrieve all problem types.") @ListParametersDoc @GetMapping public ResponseEntity>> getProblemTypes( - @Parameter(hidden = true) ListParameters listParameters) { + @Parameter(hidden = true) ListParameters listParameters) { return ResponseEntity.ok(problemTypeAssembler.toModel(problemTypeService.findAll(listParameters.getPageable(), listParameters.getSearch()))); } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), }, description = "Define the basic properties of an problem type.") @PostMapping public ResponseEntity> createProblemType( - @Validated(ValidationGroups.Create.class) @RequestBody ProblemTypeDto problemTypeDto) { + @Validated(ValidationGroups.Create.class) @RequestBody ProblemTypeDto problemTypeDto) { final var savedProblemType = problemTypeService.create(ModelMapperUtils.convert(problemTypeDto, ProblemType.class)); return new ResponseEntity<>(problemTypeAssembler.toModel(savedProblemType), HttpStatus.CREATED); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", description = "Not Found. Problem type with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", description = "Not Found. Problem type with given ID doesn't exist.") }, description = "Update the basic properties of an problem type (e.g. name).") @PutMapping("/{problemTypeId}") public ResponseEntity> updateProblemType( - @PathVariable UUID problemTypeId, - @Validated(ValidationGroups.Update.class) @RequestBody ProblemTypeDto problemTypeDto) { + @PathVariable UUID problemTypeId, + @Validated(ValidationGroups.Update.class) @RequestBody ProblemTypeDto problemTypeDto) { problemTypeDto.setId(problemTypeId); final var updatedProblemType = problemTypeService.update( - ModelMapperUtils.convert(problemTypeDto, ProblemType.class)); + ModelMapperUtils.convert(problemTypeDto, ProblemType.class)); return ResponseEntity.ok(problemTypeAssembler.toModel(updatedProblemType)); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Problem type with given ID doesn't exist.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Problem type with given ID doesn't exist.") }, description = "Delete an problem type. " + - "This also removes all references to other entities (e.g. algorithm).") + "This also removes all references to other entities (e.g. algorithm).") @DeleteMapping("/{problemTypeId}") public ResponseEntity deleteProblemType(@PathVariable UUID problemTypeId) { problemTypeService.delete(problemTypeId); @@ -116,9 +114,9 @@ public ResponseEntity deleteProblemType(@PathVariable UUID problemTypeId) } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Problem type with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Problem type with given ID doesn't exist.") }, description = "Retrieve a specific problem type and its basic properties.") @GetMapping("/{problemTypeId}") public ResponseEntity> getProblemType(@PathVariable UUID problemTypeId) { @@ -127,15 +125,15 @@ public ResponseEntity> getProblemType(@PathVariable } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", description = "Not Found. Problem type with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", description = "Not Found. Problem type with given ID doesn't exist.") }, description = "Retrieved all parent problem types of a specific problem type. " + - "If a problem type has not parent an empty list is returned") + "If a problem type has not parent an empty list is returned") @ListParametersDoc @GetMapping("/{problemTypeId}/" + Constants.PROBLEM_TYPE_PARENTS) public ResponseEntity>> getProblemTypeParentList( - @PathVariable UUID problemTypeId) { + @PathVariable UUID problemTypeId) { final var problemTypeParentList = problemTypeService.getParentList(problemTypeId); return ResponseEntity.ok(problemTypeAssembler.toModel(problemTypeParentList)); } diff --git a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/PublicationController.java b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/PublicationController.java index d10f13a7e..de2f3de1e 100644 --- a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/PublicationController.java +++ b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/PublicationController.java @@ -28,7 +28,6 @@ import org.planqk.atlas.core.services.LinkingService; import org.planqk.atlas.core.services.PublicationService; import org.planqk.atlas.web.Constants; -import org.planqk.atlas.web.annotation.ApiVersion; import org.planqk.atlas.web.dtos.AlgorithmDto; import org.planqk.atlas.web.dtos.DiscussionCommentDto; import org.planqk.atlas.web.dtos.DiscussionTopicDto; @@ -73,7 +72,6 @@ @CrossOrigin(allowedHeaders = "*", origins = "*") @AllArgsConstructor @RequestMapping("/" + Constants.PUBLICATIONS) -@ApiVersion("v1") public class PublicationController { private final PublicationService publicationService; @@ -97,48 +95,48 @@ public class PublicationController { private final LinkingService linkingService; @Operation(responses = { - @ApiResponse(responseCode = "200") + @ApiResponse(responseCode = "200") }, description = "Retrieve all publications.") @ListParametersDoc @GetMapping public ResponseEntity>> getPublications( - @Parameter(hidden = true) ListParameters listParameters) { + @Parameter(hidden = true) ListParameters listParameters) { final var entities = publicationService.findAll(listParameters.getPageable(), listParameters.getSearch()); return ResponseEntity.ok(publicationAssembler.toModel(entities)); } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body.") + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body.") }, description = "Define the basic properties of an publication.") @PostMapping public ResponseEntity> createPublication( - @Validated(ValidationGroups.Create.class) @RequestBody PublicationDto publicationDto) { + @Validated(ValidationGroups.Create.class) @RequestBody PublicationDto publicationDto) { final Publication publication = publicationService.create(ModelMapperUtils.convert(publicationDto, Publication.class)); return new ResponseEntity<>(publicationAssembler.toModel(publication), HttpStatus.CREATED); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", - description = "Not Found. Publication with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", + description = "Not Found. Publication with given ID doesn't exist.") }, description = "Update the basic properties of an publication (e.g. title).") @PutMapping("/{publicationId}") public ResponseEntity> updatePublication( - @PathVariable UUID publicationId, - @Validated(ValidationGroups.Update.class) @RequestBody PublicationDto publicationDto) { + @PathVariable UUID publicationId, + @Validated(ValidationGroups.Update.class) @RequestBody PublicationDto publicationDto) { publicationDto.setId(publicationId); final Publication publication = publicationService.update( - ModelMapperUtils.convert(publicationDto, Publication.class)); + ModelMapperUtils.convert(publicationDto, Publication.class)); return new ResponseEntity<>(publicationAssembler.toModel(publication), HttpStatus.OK); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Publication with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Publication with given ID doesn't exist.") }, description = "Retrieve a specific publication and its basic properties.") @GetMapping("/{publicationId}") public ResponseEntity> getPublication(@PathVariable UUID publicationId) { @@ -147,10 +145,10 @@ public ResponseEntity> getPublication(@PathVariable } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Publication with given ID doesn't exist.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Publication with given ID doesn't exist.") }, description = "Delete an publication. This also removes all references to other entities (e.g. algorithm).") @DeleteMapping("/{publicationId}") public ResponseEntity deletePublication(@PathVariable UUID publicationId) { @@ -159,63 +157,63 @@ public ResponseEntity deletePublication(@PathVariable UUID publicationId) } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Publication with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Publication with given ID doesn't exist.") }, description = "Retrieve referenced algorithms of an publication. If none are found an empty list is returned.") @ListParametersDoc @GetMapping("/{publicationId}/" + Constants.ALGORITHMS) public ResponseEntity>> getAlgorithmsOfPublication( - @PathVariable UUID publicationId, - @Parameter(hidden = true) ListParameters params) { + @PathVariable UUID publicationId, + @Parameter(hidden = true) ListParameters params) { final var publications = publicationService.findLinkedAlgorithms(publicationId, params.getPageable()); return ResponseEntity.ok(algorithmAssembler.toModel(publications)); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or publication with given IDs don't exist or " + - "reference was already added.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or publication with given IDs don't exist or " + + "reference was already added.") }, description = "Add a reference to an existing algorithm " + - "(that was previously created via a POST on e.g. /" + Constants.ALGORITHMS + "). " + - "Only the ID is required in the request body, other attributes will be ignored and not changed.") + "(that was previously created via a POST on e.g. /" + Constants.ALGORITHMS + "). " + + "Only the ID is required in the request body, other attributes will be ignored and not changed.") @PostMapping("/{publicationId}/" + Constants.ALGORITHMS) public ResponseEntity linkPublicationAndAlgorithm( - @PathVariable UUID publicationId, - @Validated({ValidationGroups.IDOnly.class}) @RequestBody AlgorithmDto algorithmDto) { + @PathVariable UUID publicationId, + @Validated({ValidationGroups.IDOnly.class}) @RequestBody AlgorithmDto algorithmDto) { linkingService.linkAlgorithmAndPublication(algorithmDto.getId(), publicationId); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or publication with given IDs don't exist or " + - "no reference exists.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or publication with given IDs don't exist or " + + "no reference exists.") }, description = "Delete a reference to a publication of an algorithm. The reference has to be previously created " + - "via a POST on /" + Constants.ALGORITHMS + "/{algorithmId}/" + Constants.PUBLICATIONS + "/{publicationId}).") + "via a POST on /" + Constants.ALGORITHMS + "/{algorithmId}/" + Constants.PUBLICATIONS + "/{publicationId}).") @DeleteMapping("/{publicationId}/" + Constants.ALGORITHMS + "/{algorithmId}") public ResponseEntity unlinkPublicationAndAlgorithm( - @PathVariable UUID algorithmId, - @PathVariable UUID publicationId) { + @PathVariable UUID algorithmId, + @PathVariable UUID publicationId) { linkingService.unlinkAlgorithmAndPublication(algorithmId, publicationId); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Algorithm or publication with given IDs don't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Algorithm or publication with given IDs don't exist.") }, description = "Retrieve a specific algorithm of a publication.") @GetMapping("/{publicationId}/" + Constants.ALGORITHMS + "/{algorithmId}") public ResponseEntity> getAlgorithmOfPublication( - @PathVariable UUID publicationId, - @PathVariable UUID algorithmId) { + @PathVariable UUID publicationId, + @PathVariable UUID algorithmId) { publicationService.checkIfAlgorithmIsLinkedToPublication(publicationId, algorithmId); final var algorithm = algorithmService.findById(algorithmId); @@ -223,197 +221,197 @@ public ResponseEntity> getAlgorithmOfPublication( } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Publication with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Publication with given ID doesn't exist.") }, description = "Retrieve discussion topics of a publication. If none are found an empty list is returned." ) @ListParametersDoc @GetMapping("/{publicationId}/" + Constants.DISCUSSION_TOPICS) public HttpEntity>> getDiscussionTopicsOfPublication( - @PathVariable UUID publicationId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID publicationId, + @Parameter(hidden = true) ListParameters listParameters) { return discussionTopicController.getDiscussionTopics(publicationId, listParameters); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Publication or discussion topic with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Publication or discussion topic with given ID doesn't exist.") }, description = "Retrieve discussion topic of a publication." ) @ListParametersDoc @GetMapping("/{publicationId}/" + Constants.DISCUSSION_TOPICS + "/{topicId}") public HttpEntity> getDiscussionTopicOfPublication( - @PathVariable UUID publicationId, - @PathVariable UUID topicId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID publicationId, + @PathVariable UUID topicId, + @Parameter(hidden = true) ListParameters listParameters) { return discussionTopicController.getDiscussionTopic(publicationId, topicId); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Publication or discussion topic with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Publication or discussion topic with given ID doesn't exist.") }, description = "Delete discussion topic of a publication." ) @ListParametersDoc @DeleteMapping("/{publicationId}/" + Constants.DISCUSSION_TOPICS + "/{topicId}") public HttpEntity deleteDiscussionTopicOfPublication( - @PathVariable UUID publicationId, - @PathVariable UUID topicId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID publicationId, + @PathVariable UUID topicId, + @Parameter(hidden = true) ListParameters listParameters) { return discussionTopicController.deleteDiscussionTopic(publicationId, topicId); } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Publication or discussion topic with given ID doesn't exist.") + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Publication or discussion topic with given ID doesn't exist.") }, description = "Create a discussion topic of a publication." ) @ListParametersDoc @PostMapping("/{publicationId}/" + Constants.DISCUSSION_TOPICS) public HttpEntity> createDiscussionTopicOfPublication( - @PathVariable UUID publicationId, - @Validated(ValidationGroups.Create.class) @RequestBody DiscussionTopicDto discussionTopicDto, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID publicationId, + @Validated(ValidationGroups.Create.class) @RequestBody DiscussionTopicDto discussionTopicDto, + @Parameter(hidden = true) ListParameters listParameters) { final var publication = publicationService.findById(publicationId); return discussionTopicController.createDiscussionTopic(publication, discussionTopicDto); } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Publication or discussion topic with given ID doesn't exist.") + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Publication or discussion topic with given ID doesn't exist.") }, description = "Update discussion topic of a publication." ) @ListParametersDoc @PutMapping("/{publicationId}/" + Constants.DISCUSSION_TOPICS + "/{topicId}") public HttpEntity> updateDiscussionTopicOfPublication( - @PathVariable UUID publicationId, - @PathVariable UUID topicId, - @Validated(ValidationGroups.Update.class) @RequestBody DiscussionTopicDto discussionTopicDto, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID publicationId, + @PathVariable UUID topicId, + @Validated(ValidationGroups.Update.class) @RequestBody DiscussionTopicDto discussionTopicDto, + @Parameter(hidden = true) ListParameters listParameters) { final var publication = publicationService.findById(publicationId); return discussionTopicController.updateDiscussionTopic(publication, topicId, discussionTopicDto); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Publication or discussion topic with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Publication or discussion topic with given ID doesn't exist.") }, description = "Retrieve discussion comments of a discussion topic of a publication. If none are found an empty list is returned." ) @ListParametersDoc @GetMapping("/{publicationId}/" + Constants.DISCUSSION_TOPICS + "/{topicId}/" + Constants.DISCUSSION_COMMENTS) public HttpEntity>> getDiscussionCommentsOfDiscussionTopicOfPublication( - @PathVariable UUID publicationId, - @PathVariable UUID topicId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID publicationId, + @PathVariable UUID topicId, + @Parameter(hidden = true) ListParameters listParameters) { return discussionTopicController.getDiscussionComments(publicationId, topicId, listParameters); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Publication, discussion topic or discussion comment with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Publication, discussion topic or discussion comment with given ID doesn't exist.") }, description = "Retrieve discussion comment of a discussion topic of a publication." ) @ListParametersDoc @GetMapping("/{publicationId}/" + Constants.DISCUSSION_TOPICS + "/{topicId}/" + Constants.DISCUSSION_COMMENTS + "/{commentId}") public HttpEntity> getDiscussionCommentOfDiscussionTopicOfPublication( - @PathVariable UUID publicationId, - @PathVariable UUID topicId, - @PathVariable UUID commentId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID publicationId, + @PathVariable UUID topicId, + @PathVariable UUID commentId, + @Parameter(hidden = true) ListParameters listParameters) { return discussionTopicController.getDiscussionComment(publicationId, topicId, commentId); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Publication, discussion topic or discussion comment with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Publication, discussion topic or discussion comment with given ID doesn't exist.") }, description = "Delete discussion comment of a discussion topic of a publication." ) @ListParametersDoc @DeleteMapping("/{publicationId}/" + Constants.DISCUSSION_TOPICS + "/{topicId}/" + Constants.DISCUSSION_COMMENTS + "/{commentId}") public HttpEntity deleteDiscussionCommentOfDiscussionTopicOfPublication( - @PathVariable UUID publicationId, - @PathVariable UUID topicId, - @PathVariable UUID commentId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID publicationId, + @PathVariable UUID topicId, + @PathVariable UUID commentId, + @Parameter(hidden = true) ListParameters listParameters) { return discussionTopicController.deleteDiscussionComment(publicationId, topicId, commentId); } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Publication or discussion topic with given ID doesn't exist.") + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Publication or discussion topic with given ID doesn't exist.") }, description = "Create discussion comment of a discussion topic of a publication." ) @ListParametersDoc @PostMapping("/{publicationId}/" + Constants.DISCUSSION_TOPICS + "/{topicId}/" + Constants.DISCUSSION_COMMENTS) public HttpEntity> createDiscussionCommentOfDiscussionTopicOfPublication( - @PathVariable UUID publicationId, - @PathVariable UUID topicId, - @Validated(ValidationGroups.Create.class) @RequestBody DiscussionCommentDto discussionCommentDto, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID publicationId, + @PathVariable UUID topicId, + @Validated(ValidationGroups.Create.class) @RequestBody DiscussionCommentDto discussionCommentDto, + @Parameter(hidden = true) ListParameters listParameters) { return discussionTopicController.createDiscussionComment(publicationId, topicId, discussionCommentDto); } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Publication or discussion topic with given ID doesn't exist.") + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Publication or discussion topic with given ID doesn't exist.") }, description = "Update discussion comment of a discussion topic of a publication." ) @ListParametersDoc @PutMapping("/{publicationId}/" + Constants.DISCUSSION_TOPICS + "/{topicId}/" + Constants.DISCUSSION_COMMENTS + "/{commentId}") public HttpEntity> updateDiscussionCommentOfDiscussionTopicOfPublication( - @PathVariable UUID publicationId, - @PathVariable UUID topicId, - @PathVariable UUID commentId, - @Validated(ValidationGroups.Update.class) @RequestBody DiscussionCommentDto discussionCommentDto, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID publicationId, + @PathVariable UUID topicId, + @PathVariable UUID commentId, + @Validated(ValidationGroups.Update.class) @RequestBody DiscussionCommentDto discussionCommentDto, + @Parameter(hidden = true) ListParameters listParameters) { return discussionTopicController.updateDiscussionComment(publicationId, topicId, commentId, discussionCommentDto); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Implementation or publication with given IDs don't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Implementation or publication with given IDs don't exist.") }, description = "Retrieve referenced implementations of an publication. If none are found an empty list is returned.") @ListParametersDoc @GetMapping("/{publicationId}/" + Constants.IMPLEMENTATIONS) public ResponseEntity>> getImplementationsOfPublication( - @PathVariable UUID publicationId, - @Parameter(hidden = true) ListParameters params) { + @PathVariable UUID publicationId, + @Parameter(hidden = true) ListParameters params) { final var implementations = publicationService.findLinkedImplementations(publicationId, params.getPageable()); return ResponseEntity.ok(implementationAssembler.toModel(implementations)); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Implementation or publication with given IDs don't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Implementation or publication with given IDs don't exist.") }, description = "Retrieve a specific implementation of a publication.") @GetMapping("/{publicationId}/" + Constants.IMPLEMENTATIONS + "/{implementationId}") public ResponseEntity> getImplementationOfPublication( - @PathVariable UUID publicationId, - @PathVariable UUID implementationId) { + @PathVariable UUID publicationId, + @PathVariable UUID implementationId) { publicationService.checkIfImplementationIsLinkedToPublication(publicationId, implementationId); final var implementation = implementationService.findById(implementationId); diff --git a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/SoftwarePlatformController.java b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/SoftwarePlatformController.java index 1c1ef04f9..e7f7bf592 100644 --- a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/SoftwarePlatformController.java +++ b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/SoftwarePlatformController.java @@ -26,7 +26,6 @@ import org.planqk.atlas.core.services.LinkingService; import org.planqk.atlas.core.services.SoftwarePlatformService; import org.planqk.atlas.web.Constants; -import org.planqk.atlas.web.annotation.ApiVersion; import org.planqk.atlas.web.dtos.CloudServiceDto; import org.planqk.atlas.web.dtos.ComputeResourceDto; import org.planqk.atlas.web.dtos.ImplementationDto; @@ -66,7 +65,6 @@ @RestController @CrossOrigin(allowedHeaders = "*", origins = "*") @RequestMapping("/" + Constants.SOFTWARE_PLATFORMS) -@ApiVersion("v1") @AllArgsConstructor @Slf4j public class SoftwarePlatformController { @@ -86,12 +84,12 @@ public class SoftwarePlatformController { private final LinkingService linkingService; @Operation(responses = { - @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "200"), }, description = "Retrieve all software platforms.") @ListParametersDoc @GetMapping public ResponseEntity>> getSoftwarePlatforms( - @Parameter(hidden = true) ListParameters listParameters) { + @Parameter(hidden = true) ListParameters listParameters) { final Page entities; if (listParameters.getSearch() == null || listParameters.getSearch().isEmpty()) { entities = softwarePlatformService.findAll(listParameters.getPageable()); @@ -102,44 +100,44 @@ public ResponseEntity>> getSoftwareP } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body.") + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body.") }, description = "Define the basic properties of a software platform. " + - "References to sub-objects (e.g. a compute resource) " + - "can be added via sub-routes (e.g. via POST on /" + Constants.COMPUTE_RESOURCES + ").") + "References to sub-objects (e.g. a compute resource) " + + "can be added via sub-routes (e.g. via POST on /" + Constants.COMPUTE_RESOURCES + ").") @PostMapping public ResponseEntity> createSoftwarePlatform( - @Validated({ValidationGroups.Create.class}) @RequestBody SoftwarePlatformDto softwarePlatformDto) { + @Validated({ValidationGroups.Create.class}) @RequestBody SoftwarePlatformDto softwarePlatformDto) { final var savedPlatform = softwarePlatformService.create(ModelMapperUtils.convert(softwarePlatformDto, SoftwarePlatform.class)); return new ResponseEntity<>(softwarePlatformAssembler.toModel(savedPlatform), HttpStatus.CREATED); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", - description = "Not Found. Software Platform with given ID doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", + description = "Not Found. Software Platform with given ID doesn't exist.") }, description = "Update the basic properties of a software platform (e.g. name). " + - "References to sub-objects (e.g. a compute resource) are not updated via this operation - " + - "use the corresponding sub-route for updating them (e.g. via PUT on /" + Constants.COMPUTE_RESOURCES + "/{computeResourceId}).") + "References to sub-objects (e.g. a compute resource) are not updated via this operation - " + + "use the corresponding sub-route for updating them (e.g. via PUT on /" + Constants.COMPUTE_RESOURCES + "/{computeResourceId}).") @PutMapping("/{softwarePlatformId}") public ResponseEntity> updateSoftwarePlatform( - @PathVariable UUID softwarePlatformId, - @Validated({ValidationGroups.Update.class}) @RequestBody SoftwarePlatformDto softwarePlatformDto) { + @PathVariable UUID softwarePlatformId, + @Validated({ValidationGroups.Update.class}) @RequestBody SoftwarePlatformDto softwarePlatformDto) { softwarePlatformDto.setId(softwarePlatformId); final var softwarePlatform = softwarePlatformService - .update( - ModelMapperUtils.convert(softwarePlatformDto, SoftwarePlatform.class)); + .update( + ModelMapperUtils.convert(softwarePlatformDto, SoftwarePlatform.class)); return ResponseEntity.ok(softwarePlatformAssembler.toModel(softwarePlatform)); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Software Platform with given ID doesn't exist.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Software Platform with given ID doesn't exist.") }, description = "Delete a software platform. " + - "This also removes all references to other entities (e.g. compute resource)") + "This also removes all references to other entities (e.g. compute resource)") @DeleteMapping("/{softwarePlatformId}") public ResponseEntity deleteSoftwarePlatform(@PathVariable UUID softwarePlatformId) { softwarePlatformService.delete(softwarePlatformId); @@ -147,77 +145,77 @@ public ResponseEntity deleteSoftwarePlatform(@PathVariable UUID softwarePl } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Software Platform with given ID doesn't exist."), + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Software Platform with given ID doesn't exist."), }, description = "Retrieve a specific software platform and its basic properties.") @GetMapping("/{softwarePlatformId}") public ResponseEntity> getSoftwarePlatform( - @PathVariable UUID softwarePlatformId) { + @PathVariable UUID softwarePlatformId) { final var softwarePlatform = softwarePlatformService.findById(softwarePlatformId); return ResponseEntity.ok(softwarePlatformAssembler.toModel(softwarePlatform)); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Software Platform or Implementation with given IDs don't exist."), + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Software Platform or Implementation with given IDs don't exist."), }, description = "Get a specific implementations of a software platform. If none are found an empty list is returned.") @ListParametersDoc @GetMapping("/{softwarePlatformId}/" + Constants.IMPLEMENTATIONS) public ResponseEntity>> getImplementationsOfSoftwarePlatform( - @PathVariable UUID softwarePlatformId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID softwarePlatformId, + @Parameter(hidden = true) ListParameters listParameters) { final var implementations = softwarePlatformService.findLinkedImplementations(softwarePlatformId, listParameters.getPageable()); return ResponseEntity.ok(implementationAssembler.toModel(implementations)); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", - description = "Not Found. Software platform or implementation with given IDs don't exist or " + - "reference was already added.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", + description = "Not Found. Software platform or implementation with given IDs don't exist or " + + "reference was already added.") }, description = "Add a reference to an existing implementation " + - "(that was previously created via a POST on e.g. /" + Constants.ALGORITHMS + "/{algorithmId}/ " + Constants.IMPLEMENTATIONS + "). " + - "Only the ID is required in the request body, other attributes will be ignored and not changed.") + "(that was previously created via a POST on e.g. /" + Constants.ALGORITHMS + "/{algorithmId}/ " + Constants.IMPLEMENTATIONS + "). " + + "Only the ID is required in the request body, other attributes will be ignored and not changed.") @PostMapping("/{softwarePlatformId}/" + Constants.IMPLEMENTATIONS) public ResponseEntity linkSoftwarePlatformAndImplementation( - @PathVariable UUID softwarePlatformId, - @Validated({ValidationGroups.IDOnly.class}) @RequestBody ImplementationDto implementationDto) { + @PathVariable UUID softwarePlatformId, + @Validated({ValidationGroups.IDOnly.class}) @RequestBody ImplementationDto implementationDto) { linkingService.linkImplementationAndSoftwarePlatform(implementationDto.getId(), softwarePlatformId); return ResponseEntity.noContent().build(); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Software platform or implementation with given IDs don't exist or " + - "no reference exists.") + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Software platform or implementation with given IDs don't exist or " + + "no reference exists.") }, description = "Delete a reference to a implementation of an software platform. " + - "The reference has to be previously created via a POST on " + - "/" + Constants.SOFTWARE_PLATFORMS + "/{softwarePlatformId}/" + Constants.IMPLEMENTATIONS + ").") + "The reference has to be previously created via a POST on " + + "/" + Constants.SOFTWARE_PLATFORMS + "/{softwarePlatformId}/" + Constants.IMPLEMENTATIONS + ").") @DeleteMapping("/{softwarePlatformId}/" + Constants.IMPLEMENTATIONS + "/{implementationId}") public ResponseEntity unlinkSoftwarePlatformAndImplementation( - @PathVariable UUID implementationId, - @PathVariable UUID softwarePlatformId) { + @PathVariable UUID implementationId, + @PathVariable UUID softwarePlatformId) { linkingService.unlinkImplementationAndSoftwarePlatform(implementationId, softwarePlatformId); return ResponseEntity.noContent().build(); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Software platform or implementation with given IDs don't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Software platform or implementation with given IDs don't exist.") }, description = "Retrieve a specific implementation of a software platform. If none are found an empty list is returned.") @GetMapping("/{softwarePlatformId}/" + Constants.IMPLEMENTATIONS + "/{implementationId}") public ResponseEntity> getImplementationOfSoftwarePlatform( - @PathVariable UUID softwarePlatformId, - @PathVariable UUID implementationId) { + @PathVariable UUID softwarePlatformId, + @PathVariable UUID implementationId) { softwarePlatformService.checkIfImplementationIsLinkedToSoftwarePlatform(softwarePlatformId, implementationId); final var implementation = implementationService.findById(implementationId); @@ -225,99 +223,99 @@ public ResponseEntity> getImplementationOfSoftwar } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Software platform or implementation with given IDs don't exist."), + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Software platform or implementation with given IDs don't exist."), }, description = "Retrieve referenced cloud services of a software platform. If none are found an empty list is returned.") @ListParametersDoc @GetMapping("/{softwarePlatformId}/" + Constants.CLOUD_SERVICES) public ResponseEntity>> getCloudServicesOfSoftwarePlatform( - @PathVariable UUID softwarePlatformId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID softwarePlatformId, + @Parameter(hidden = true) ListParameters listParameters) { final var cloudServices = softwarePlatformService.findLinkedCloudServices(softwarePlatformId, listParameters.getPageable()); return ResponseEntity.ok(cloudServiceAssembler.toModel(cloudServices)); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", - description = "Not Found. Software Platform or Cloud Service with given IDs don't exist or " + - "reference was already added."), + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", + description = "Not Found. Software Platform or Cloud Service with given IDs don't exist or " + + "reference was already added."), }, description = "Add a reference to an existing cloud service " + - "(that was previously created via a POST on e.g. /" + Constants.CLOUD_SERVICES + "). " + - "Only the ID is required in the request body, other attributes will be ignored and not changed.") + "(that was previously created via a POST on e.g. /" + Constants.CLOUD_SERVICES + "). " + + "Only the ID is required in the request body, other attributes will be ignored and not changed.") @PostMapping("/{softwarePlatformId}/" + Constants.CLOUD_SERVICES) public ResponseEntity linkSoftwarePlatformAndCloudService( - @PathVariable UUID softwarePlatformId, - @Validated({ValidationGroups.IDOnly.class}) @RequestBody CloudServiceDto cloudServiceDto) { + @PathVariable UUID softwarePlatformId, + @Validated({ValidationGroups.IDOnly.class}) @RequestBody CloudServiceDto cloudServiceDto) { linkingService.linkSoftwarePlatformAndCloudService(softwarePlatformId, cloudServiceDto.getId()); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Software Platform or Cloud Service with given IDs don't exist or " + - "no reference exists."), + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Software Platform or Cloud Service with given IDs don't exist or " + + "no reference exists."), }, description = "Delete a reference to a {object} of an {object}. " + - "The reference has to be previously created via a POST on " + - "/" + Constants.SOFTWARE_PLATFORMS + "/{softwarePlatformId}/" + Constants.CLOUD_SERVICES + ").") + "The reference has to be previously created via a POST on " + + "/" + Constants.SOFTWARE_PLATFORMS + "/{softwarePlatformId}/" + Constants.CLOUD_SERVICES + ").") @DeleteMapping("/{softwarePlatformId}/" + Constants.CLOUD_SERVICES + "/{cloudServiceId}") public ResponseEntity unlinkSoftwarePlatformAndCloudService( - @PathVariable UUID softwarePlatformId, - @PathVariable UUID cloudServiceId) { + @PathVariable UUID softwarePlatformId, + @PathVariable UUID cloudServiceId) { linkingService.unlinkSoftwarePlatformAndCloudService(softwarePlatformId, cloudServiceId); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Software Platform or Compute Resource with given IDs don't exist."), + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Software Platform or Compute Resource with given IDs don't exist."), }, description = "Retrieve referenced compute resources for a software platform. If none are found an empty list is returned.") @ListParametersDoc @GetMapping("/{softwarePlatformId}/" + Constants.COMPUTE_RESOURCES) public ResponseEntity>> getComputeResourcesOfSoftwarePlatform( - @PathVariable UUID softwarePlatformId, - @Parameter(hidden = true) ListParameters listParameters) { + @PathVariable UUID softwarePlatformId, + @Parameter(hidden = true) ListParameters listParameters) { final var computeResources = softwarePlatformService.findLinkedComputeResources(softwarePlatformId, listParameters.getPageable()); return ResponseEntity.ok(computeResourceAssembler.toModel(computeResources)); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), - @ApiResponse(responseCode = "404", - description = "Not Found. Software Platform or Compute Resource with given IDs don't exist or " + - "reference was already added."), + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body."), + @ApiResponse(responseCode = "404", + description = "Not Found. Software Platform or Compute Resource with given IDs don't exist or " + + "reference was already added."), }, description = "Add a reference to an existing compute resource " + - "(that was previously created via a POST on e.g. /" + Constants.COMPUTE_RESOURCES + "). " + - "Only the ID is required in the request body, other attributes will be ignored and not changed.") + "(that was previously created via a POST on e.g. /" + Constants.COMPUTE_RESOURCES + "). " + + "Only the ID is required in the request body, other attributes will be ignored and not changed.") @PostMapping("/{softwarePlatformId}/" + Constants.COMPUTE_RESOURCES) public ResponseEntity linkSoftwarePlatformAndComputeResource( - @PathVariable UUID softwarePlatformId, - @Validated({ValidationGroups.IDOnly.class}) @RequestBody ComputeResourceDto computeResourceDto) { + @PathVariable UUID softwarePlatformId, + @Validated({ValidationGroups.IDOnly.class}) @RequestBody ComputeResourceDto computeResourceDto) { linkingService.linkSoftwarePlatformAndComputeResource(softwarePlatformId, computeResourceDto.getId()); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Operation(responses = { - @ApiResponse(responseCode = "204"), - @ApiResponse(responseCode = "400"), - @ApiResponse(responseCode = "404", - description = "Not Found. Software Platform or Compute Resource with given IDs don't exist or " + - "no reference exists."), + @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "400"), + @ApiResponse(responseCode = "404", + description = "Not Found. Software Platform or Compute Resource with given IDs don't exist or " + + "no reference exists."), }, description = "Delete a reference to a {object} of an {object}. " + - "The reference has to be previously created via a POST on " + - "/" + Constants.SOFTWARE_PLATFORMS + "/{softwarePlatformId}/" + Constants.COMPUTE_RESOURCES + ").") + "The reference has to be previously created via a POST on " + + "/" + Constants.SOFTWARE_PLATFORMS + "/{softwarePlatformId}/" + Constants.COMPUTE_RESOURCES + ").") @DeleteMapping("/{softwarePlatformId}/" + Constants.COMPUTE_RESOURCES + "/{computeResourceId}") public ResponseEntity unlinkSoftwarePlatformAndComputeResource( - @PathVariable UUID softwarePlatformId, - @PathVariable UUID computeResourceId) { + @PathVariable UUID softwarePlatformId, + @PathVariable UUID computeResourceId) { linkingService.unlinkSoftwarePlatformAndComputeResource(softwarePlatformId, computeResourceId); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } diff --git a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/TagController.java b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/TagController.java index 6b319f19a..ff48be6bf 100644 --- a/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/TagController.java +++ b/org.planqk.atlas.web/src/main/java/org/planqk/atlas/web/controller/TagController.java @@ -22,7 +22,6 @@ import org.planqk.atlas.core.model.Tag; import org.planqk.atlas.core.services.TagService; import org.planqk.atlas.web.Constants; -import org.planqk.atlas.web.annotation.ApiVersion; import org.planqk.atlas.web.dtos.AlgorithmDto; import org.planqk.atlas.web.dtos.ImplementationDto; import org.planqk.atlas.web.dtos.TagDto; @@ -57,7 +56,6 @@ @RestController @CrossOrigin(allowedHeaders = "*", origins = "*") @RequestMapping("/" + Constants.TAGS) -@ApiVersion("v1") @AllArgsConstructor @Slf4j public class TagController { @@ -71,30 +69,30 @@ public class TagController { private final ImplementationAssembler implementationAssembler; @Operation(responses = { - @ApiResponse(responseCode = "200") + @ApiResponse(responseCode = "200") }, description = "Retrieve all created tags.") @ListParametersDoc @GetMapping public ResponseEntity>> getTags( - @Parameter(hidden = true) ListParameters listParameters) { + @Parameter(hidden = true) ListParameters listParameters) { return new ResponseEntity<>(tagAssembler.toModel( - this.tagService.findAllByContent(listParameters.getSearch(), listParameters.getPageable())), HttpStatus.OK); + this.tagService.findAllByContent(listParameters.getSearch(), listParameters.getPageable())), HttpStatus.OK); } @Operation(responses = { - @ApiResponse(responseCode = "201"), - @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body.") + @ApiResponse(responseCode = "201"), + @ApiResponse(responseCode = "400", description = "Bad Request. Invalid request body.") }, description = "Create a new tag with its value and category.") @PostMapping public ResponseEntity> createTag( - @Validated(ValidationGroups.Create.class) @RequestBody TagDto tagDto) { + @Validated(ValidationGroups.Create.class) @RequestBody TagDto tagDto) { final Tag savedTag = this.tagService.create(ModelMapperUtils.convert(tagDto, Tag.class)); return new ResponseEntity<>(tagAssembler.toModel(savedTag), HttpStatus.CREATED); } @Operation(responses = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "404", description = "Tag with given value doesn't exist.") + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "404", description = "Tag with given value doesn't exist.") }, description = "Retrieve a specific tag.") @GetMapping("/{value}") public ResponseEntity> getTag(@PathVariable String value) { @@ -104,7 +102,7 @@ public ResponseEntity> getTag(@PathVariable String value) { } @Operation(responses = { - @ApiResponse(responseCode = "200") + @ApiResponse(responseCode = "200") }, description = "Retrieve all algorithms under a specific tag.") @GetMapping("/{value}/" + Constants.ALGORITHMS) public ResponseEntity>> getAlgorithmsOfTag(@PathVariable String value) { @@ -116,11 +114,11 @@ public ResponseEntity>> getAlgorithmsO } @Operation(responses = { - @ApiResponse(responseCode = "200") + @ApiResponse(responseCode = "200") }, description = "Retrieve all implementations under a specific tag.") @GetMapping("/{value}/" + Constants.IMPLEMENTATIONS) public ResponseEntity>> getImplementationsOfTag( - @PathVariable String value) { + @PathVariable String value) { final Tag tag = this.tagService.findByValue(value); final CollectionModel> implementations = implementationAssembler.toModel(tag.getImplementations()); implementationAssembler.addLinks(implementations.getContent()); diff --git a/org.planqk.atlas.web/src/test/java/org/planqk/atlas/web/annotation/VersionedRequestHandlerMappingTest.java b/org.planqk.atlas.web/src/test/java/org/planqk/atlas/web/annotation/VersionedRequestHandlerMappingTest.java deleted file mode 100644 index 0fe3132d6..000000000 --- a/org.planqk.atlas.web/src/test/java/org/planqk/atlas/web/annotation/VersionedRequestHandlerMappingTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2020 the qc-atlas contributors. - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ - -package org.planqk.atlas.web.annotation; - -import static org.junit.Assert.assertEquals; - -import java.util.Set; - -import org.junit.jupiter.api.Test; -import org.springframework.web.bind.annotation.RequestMapping; - -class VersionedRequestHandlerMappingTest { - - private VersionedRequestHandlerMapping mapping = new VersionedRequestHandlerMapping(); - - @Test - void getMappingForMethod() throws NoSuchMethodException { - assertEquals(Set.of("/v1/unversioned/versioned"), getMethodPathMapping(Unversioned.class, "versioned")); - assertEquals(Set.of("/v1/versioned/unversioned"), getMethodPathMapping(Versioned.class, "unversioned")); - assertEquals(Set.of("/v1/versioned/versioned", "/v2/versioned/versioned"), - getMethodPathMapping(Versioned.class, "versioned")); - } - - private Set getMethodPathMapping(Class clazz, String methodName) throws NoSuchMethodException { - return mapping.getMappingForMethod(clazz.getMethod(methodName), clazz).getPatternsCondition().getPatterns(); - } - - @RequestMapping("/unversioned") - static class Unversioned { - @RequestMapping("/versioned") - @ApiVersion("v1") - public void versioned() { - } - } - - @RequestMapping("/versioned") - @ApiVersion("v1") - static class Versioned { - @RequestMapping("/unversioned") - public void unversioned() { - } - - @RequestMapping("/versioned") - @ApiVersion({"v1", "v2"}) - public void versioned() { - } - } -} diff --git a/org.planqk.atlas.web/src/test/java/org/planqk/atlas/web/controller/DiscussionCommentControllerTest.java b/org.planqk.atlas.web/src/test/java/org/planqk/atlas/web/controller/DiscussionCommentControllerTest.java index 73f51660c..0d62199bb 100644 --- a/org.planqk.atlas.web/src/test/java/org/planqk/atlas/web/controller/DiscussionCommentControllerTest.java +++ b/org.planqk.atlas.web/src/test/java/org/planqk/atlas/web/controller/DiscussionCommentControllerTest.java @@ -131,15 +131,15 @@ public void createDiscussionComment_returnDiscussionComment() throws Exception { discussionCommentDto.setId(null); MvcResult result = mockMvc - .perform(post( - "/" + Constants.API_VERSION + "/" + Constants.DISCUSSION_TOPICS + "/" + discussionTopic.getId() + "/" + Constants.DISCUSSION_COMMENTS) - .content(mapper.writeValueAsString(discussionCommentDto)) - .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isCreated()).andReturn(); + .perform(post( + "/" + Constants.DISCUSSION_TOPICS + "/" + discussionTopic.getId() + "/" + Constants.DISCUSSION_COMMENTS) + .content(mapper.writeValueAsString(discussionCommentDto)) + .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()).andReturn(); EntityModel response = mapper.readValue(result.getResponse().getContentAsString(), - new TypeReference>() { - }); + new TypeReference>() { + }); assertEquals(response.getContent().getText(), discussionCommentDto.getText()); } @@ -151,10 +151,11 @@ public void createDiscussionComment_returnBadRequest() throws Exception { // Missing required attribute discussionCommentDto.setDate(null); mockMvc.perform(post( - "/" + Constants.API_VERSION + "/" + Constants.DISCUSSION_TOPICS + "/" + discussionTopic.getId() + "/" + Constants.DISCUSSION_COMMENTS + - "/") - .content(mapper.writeValueAsString(discussionCommentDto)).contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)).andExpect(status().isBadRequest()); + "/" + Constants.DISCUSSION_TOPICS + "/" + discussionTopic.getId() + "/" + + Constants.DISCUSSION_COMMENTS + + "/") + .content(mapper.writeValueAsString(discussionCommentDto)).contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)).andExpect(status().isBadRequest()); } @Test @@ -163,14 +164,14 @@ public void getDiscussionComments_returnDiscussionComments() throws Exception { when(discussionTopicService.findById(discussionTopic.getId())).thenReturn(discussionTopic); MvcResult result = mockMvc - .perform(get("/" + Constants.API_VERSION + "/" + Constants.DISCUSSION_TOPICS + "/" + discussionTopic.getId() + "/" + - Constants.DISCUSSION_COMMENTS + "/").queryParam(Constants.PAGE, Integer.toString(page)) - .queryParam(Constants.SIZE, Integer.toString(size)).accept(MediaType.APPLICATION_JSON) - .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()).andReturn(); + .perform(get("/" + Constants.DISCUSSION_TOPICS + "/" + discussionTopic.getId() + "/" + + Constants.DISCUSSION_COMMENTS + "/").queryParam(Constants.PAGE, Integer.toString(page)) + .queryParam(Constants.SIZE, Integer.toString(size)).accept(MediaType.APPLICATION_JSON) + .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()).andReturn(); var resultList = ObjectMapperUtils.mapResponseToList(result.getResponse().getContentAsString(), - "discussionComments", DiscussionCommentDto.class); + "discussionComments", DiscussionCommentDto.class); assertEquals(resultList.size(), 1); assertEquals(resultList.get(0).getText(), discussionCommentDto.getText()); @@ -184,8 +185,9 @@ public void deleteDiscussionComment_returnNotFound() throws Exception { doThrow(new NoSuchElementException()).when(discussionCommentService).delete(id); mockMvc.perform(delete( - "/" + Constants.API_VERSION + "/" + Constants.DISCUSSION_TOPICS + "/" + discussionTopic.getId() + "/" + Constants.DISCUSSION_COMMENTS + - "/" + id).accept(MediaType.APPLICATION_JSON)).andExpect(status().isNotFound()); + "/" + Constants.DISCUSSION_TOPICS + "/" + discussionTopic.getId() + "/" + + Constants.DISCUSSION_COMMENTS + + "/" + id).accept(MediaType.APPLICATION_JSON)).andExpect(status().isNotFound()); } @Test @@ -193,13 +195,13 @@ public void getDiscussionComment_returnDiscussionComment() throws Exception { when(discussionCommentService.findById(discussionComment.getId())).thenReturn(discussionComment); MvcResult result = mockMvc.perform( - get("/" + Constants.API_VERSION + "/" + Constants.DISCUSSION_TOPICS + "/" + discussionTopic.getId() + "/" + - Constants.DISCUSSION_COMMENTS + "/" + discussionComment.getId()).accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()).andReturn(); + get("/" + Constants.DISCUSSION_TOPICS + "/" + discussionTopic.getId() + "/" + + Constants.DISCUSSION_COMMENTS + "/" + discussionComment.getId()).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()).andReturn(); EntityModel response = mapper.readValue( - result.getResponse().getContentAsString(), new TypeReference>() { - }); + result.getResponse().getContentAsString(), new TypeReference>() { + }); assertEquals(response.getContent().getId(), discussionCommentDto.getId()); assertEquals(response.getContent().getText(), discussionCommentDto.getText()); @@ -210,18 +212,19 @@ public void getDiscussionComment_returnDiscussionComment() throws Exception { public void getDiscussionComment_returnNotFound() throws Exception { when(discussionCommentService.findById(any(UUID.class))).thenThrow(new NoSuchElementException()); - mockMvc.perform(get("/" + Constants.API_VERSION + "/" + Constants.DISCUSSION_TOPICS + "/" + discussionTopic.getId() + "/" + - Constants.DISCUSSION_COMMENTS + "/" + UUID.randomUUID()).accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isNotFound()); + mockMvc.perform(get("/" + Constants.DISCUSSION_TOPICS + "/" + discussionTopic.getId() + "/" + + Constants.DISCUSSION_COMMENTS + "/" + UUID.randomUUID()).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isNotFound()); } @Test public void deleteDiscussionComment_returnOK() throws Exception { when(discussionCommentService.findById(discussionComment.getId())).thenReturn(discussionComment); mockMvc.perform(delete( - "/" + Constants.API_VERSION + "/" + Constants.DISCUSSION_TOPICS + "/" + discussionTopic.getId() + "/" + Constants.DISCUSSION_COMMENTS + - "/{id}", this.discussionComment.getId())) - .andExpect(status().isOk()).andReturn(); + "/" + Constants.DISCUSSION_TOPICS + "/" + discussionTopic.getId() + "/" + + Constants.DISCUSSION_COMMENTS + + "/{id}", this.discussionComment.getId())) + .andExpect(status().isOk()).andReturn(); } @Test @@ -229,14 +232,14 @@ public void updateDiscussionComment_returnDiscussionComment() throws Exception { when(discussionCommentService.findById(discussionComment.getId())).thenReturn(discussionComment); when(discussionCommentService.update(discussionComment)).thenReturn(discussionComment); - MvcResult result = mockMvc.perform(put("/" + Constants.API_VERSION + "/" + Constants.DISCUSSION_TOPICS + "/" + discussionTopic.getId() + "/" + - Constants.DISCUSSION_COMMENTS + "/" + discussionComment.getId()) - .content(mapper.writeValueAsString(discussionCommentDto)).contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andReturn(); + MvcResult result = mockMvc.perform(put("/" + Constants.DISCUSSION_TOPICS + "/" + discussionTopic.getId() + "/" + + Constants.DISCUSSION_COMMENTS + "/" + discussionComment.getId()) + .content(mapper.writeValueAsString(discussionCommentDto)).contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andReturn(); EntityModel response = mapper.readValue(result.getResponse().getContentAsString(), - new TypeReference>() { - }); + new TypeReference>() { + }); assertEquals(response.getContent().getText(), discussionCommentDto.getText()); assertEquals(response.getContent().getId(), discussionCommentDto.getId()); @@ -250,9 +253,9 @@ public void updateDiscussionComment_returnBadRequest() throws Exception { discussionComment.setDate(null); when(discussionCommentService.update(discussionComment)).thenReturn(discussionComment); - mockMvc.perform(put("/" + Constants.API_VERSION + "/" + Constants.DISCUSSION_TOPICS + "/" + discussionTopic.getId() + "/" + - Constants.DISCUSSION_COMMENTS + "/" + discussionComment.getId()) - .content(mapper.writeValueAsString(discussionComment)).contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)).andExpect(status().isBadRequest()); + mockMvc.perform(put("/" + Constants.DISCUSSION_TOPICS + "/" + discussionTopic.getId() + "/" + + Constants.DISCUSSION_COMMENTS + "/" + discussionComment.getId()) + .content(mapper.writeValueAsString(discussionComment)).contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)).andExpect(status().isBadRequest()); } } diff --git a/org.planqk.atlas.web/src/test/java/org/planqk/atlas/web/linkassembler/DummyController.java b/org.planqk.atlas.web/src/test/java/org/planqk/atlas/web/linkassembler/DummyController.java deleted file mode 100644 index 8ee31e54c..000000000 --- a/org.planqk.atlas.web/src/test/java/org/planqk/atlas/web/linkassembler/DummyController.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2020 the qc-atlas contributors. - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ - -package org.planqk.atlas.web.linkassembler; - -import org.planqk.atlas.web.annotation.ApiVersion; -import org.springframework.http.HttpEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("/controller") -@ApiVersion("v1") -public class DummyController { - @GetMapping("/test") - public HttpEntity test() { - return null; - } -} diff --git a/org.planqk.atlas.web/src/test/java/org/planqk/atlas/web/linkassembler/LinkBuilderServiceIntegrationTest.java b/org.planqk.atlas.web/src/test/java/org/planqk/atlas/web/linkassembler/LinkBuilderServiceIntegrationTest.java deleted file mode 100644 index dc1973d24..000000000 --- a/org.planqk.atlas.web/src/test/java/org/planqk/atlas/web/linkassembler/LinkBuilderServiceIntegrationTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2020 the qc-atlas contributors. - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ - -package org.planqk.atlas.web.linkassembler; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; - -import org.junit.jupiter.api.Test; -import org.planqk.atlas.web.WebConfiguration; -import org.planqk.atlas.web.controller.RootController; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.context.annotation.Import; -import org.springframework.hateoas.IanaLinkRelations; - -@WebMvcTest({RootController.class, DummyController.class}) -@EnableLinkAssemblers -@Import(WebConfiguration.class) -public class LinkBuilderServiceIntegrationTest { - @Autowired - private LinkBuilderService service; - - @Test - public void resolvesAsUnversioned() { - var link = service.linkTo(methodOn(RootController.class).root()).withSelfRel(); - assertEquals(IanaLinkRelations.SELF, link.getRel()); - assertEquals("/", link.getHref()); - } - - @Test - public void resolvesAsVersioned() { - var link = service.linkTo(methodOn(DummyController.class).test()).withSelfRel(); - assertEquals(IanaLinkRelations.SELF, link.getRel()); - assertEquals("/v1/controller/test", link.getHref()); - } -} diff --git a/pom.xml b/pom.xml index 3266db7b3..a12f45f31 100644 --- a/pom.xml +++ b/pom.xml @@ -107,6 +107,13 @@ + + maven-surefire-plugin + 3.0.0-M5 + + true + +