From 0b89282a2286d405d32c71ff1ec2b73ecbdefab6 Mon Sep 17 00:00:00 2001 From: Alexander Gordt <100141498+alexgordtop@users.noreply.github.com> Date: Thu, 30 Nov 2023 13:39:47 +0100 Subject: [PATCH] Migration to spring3/jakarta/java17 (#139) --- .github/workflows/maven_run_test.yml | 28 +- .gitignore | 3 + .../basyx.aasdiscoveryservice-http/pom.xml | 9 +- .../aasdiscoveryservice/http/LookupApi.java | 155 +++++----- .../http/LookupApiController.java | 57 ++-- .../http/pagination/InlineResponse200.java | 15 +- .../basyx.aasenvironment-core/pom.xml | 9 +- .../DefaultAASEnvironmentSerialization.java | 41 ++- .../TestAASEnvironmentSerialization.java | 47 ++- .../basyx.aasenvironment-http/pom.xml | 8 +- .../http/AASEnvironmentHTTPApi.java | 68 +++-- .../http/SerializationApiController.java | 30 +- .../src/test/resources/application.properties | 2 + .../basyx.aasenvironment.component/Dockerfile | 10 +- .../basyx.aasenvironment.component/pom.xml | 2 +- .../basyx.aasregistry-client-native/pom.xml | 18 +- .../basyx.aasregistry-paths/pom.xml | 4 +- .../basyx.aasregistry-plugins/pom.xml | 3 +- .../pom.xml | 8 +- .../pom.xml | 4 +- .../pom.xml | 4 +- ...ThreadSafeAasRegistryStorageDecorator.java | 29 +- .../api/BasyxRegistryApiDelegateTest.java | 27 +- .../pom.xml | 4 +- .../pom.xml | 19 +- .../mongodb/MongoDbAasRegistryStorage.java | 32 +- .../storage/mongodb/SearchQueryBuilder.java | 14 +- .../pom.xml | 4 +- .../src/main/docker/Dockerfile | 4 +- .../pom.xml | 4 +- .../src/main/docker/Dockerfile | 4 +- .../pom.xml | 4 +- .../src/main/docker/Dockerfile | 4 +- .../pom.xml | 4 +- .../src/main/docker/Dockerfile | 4 +- .../basyx.aasregistry-service/pom.xml | 19 +- .../service/api/BasyxRegistryApiDelegate.java | 22 +- .../ServletHeaderConfiguration.java | 31 +- .../service/errors/BasyxControllerAdvice.java | 15 +- .../service/events/RegistryEvent.java | 16 +- .../service/storage/AasRegistryStorage.java | 21 +- .../storage/AasRegistryStorageDelegate.java | 21 +- ...trationEventSendingAasRegistryStorage.java | 25 +- .../aasregistry/service/tests/FilterTest.java | 20 +- .../docker-compose/build-images.sh | 3 +- basyx.aasregistry/pom.xml | 33 ++- .../pom.xml | 11 +- .../basyx.aasrepository-http/pom.xml | 8 +- .../http/AasRepositoryApiHTTPController.java | 46 +-- .../http/AasRepositoryHTTPApi.java | 42 ++- .../GetAssetAdministrationShellsResult.java | 18 +- .../http/pagination/GetReferencesResult.java | 18 +- .../basyx.aasrepository.component/Dockerfile | 8 +- .../basyx.aasrepository.component/pom.xml | 6 +- .../model/PackageDescription.java | 11 +- .../aasxfileserver/model/PackagesBody.java | 11 +- .../basyx.aasxfileserver.component/Dockerfile | 2 +- basyx.common/basyx.http/pom.xml | 23 +- .../http/Base64UrlEncodedIdentifierSize.java | 27 ++ ...se64UrlEncodedIdentifierSizeValidator.java | 35 +++ .../http/description/ServiceDescription.java | 11 +- .../basyx/http/model/BaseOperationResult.java | 193 ++++++------ .../digitaltwin/basyx/http/model/Message.java | 23 +- .../basyx/http/model/OperationRequest.java | 278 +++++++++--------- .../basyx/http/model/OperationResult.java | 227 +++++++------- .../digitaltwin/basyx/http/model/Result.java | 156 +++++----- .../basyx/http/pagination/PagedResult.java | 18 +- .../pagination/PagedResultPagingMetadata.java | 15 +- .../pom.xml | 17 +- ...escriptionRepositoryApiHTTPController.java | 32 +- .../ConceptDescriptionRepositoryHTTPApi.java | 34 +-- .../GetConceptDescriptionsResult.java | 18 +- .../Dockerfile | 6 +- .../pom.xml | 14 +- .../pom.xml | 19 +- .../pom.xml | 14 +- .../pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 14 +- .../pom.xml | 4 +- .../src/main/docker/Dockerfile | 4 +- .../pom.xml | 4 +- .../src/main/docker/Dockerfile | 4 +- .../pom.xml | 4 +- .../src/main/docker/Dockerfile | 4 +- .../pom.xml | 4 +- .../src/main/docker/Dockerfile | 4 +- .../basyx.submodelregistry-service/pom.xml | 23 +- .../service/errors/BasyxControllerAdvice.java | 14 +- .../service/events/RegistryEvent.java | 10 +- basyx.submodelregistry/pom.xml | 34 ++- .../basyx.submodelrepository-http/pom.xml | 8 +- .../SubmodelRepositoryApiHTTPController.java | 40 +-- .../http/SubmodelRepositoryHTTPApi.java | 179 ++++++----- .../http/pagination/GetSubmodelsResult.java | 15 +- .../Dockerfile | 6 +- .../pom.xml | 6 +- .../pagination/GetSubmodelElementsResult.java | 15 +- .../http/SubmodelServiceHTTPApi.java | 14 +- .../SubmodelServiceHTTPApiController.java | 52 ++-- .../Dockerfile | 2 +- pom.xml | 23 +- 103 files changed, 1381 insertions(+), 1367 deletions(-) create mode 100644 basyx.aasenvironment/basyx.aasenvironment-http/src/test/resources/application.properties create mode 100644 basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/Base64UrlEncodedIdentifierSize.java create mode 100644 basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/Base64UrlEncodedIdentifierSizeValidator.java diff --git a/.github/workflows/maven_run_test.yml b/.github/workflows/maven_run_test.yml index c312bbe2f..e100136c0 100644 --- a/.github/workflows/maven_run_test.yml +++ b/.github/workflows/maven_run_test.yml @@ -11,18 +11,18 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up JDK 11 - uses: actions/setup-java@v3 - with: - java-version: '11' - distribution: 'adopt' - cache: maven - - name: Start environment - run: docker compose up -d --wait - - name: Install BaSyx - run: mvn clean install - - name: Stop environment - if: always() - run: docker compose down + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + cache: maven + - name: Start environment + run: docker compose up -d --wait + - name: Install BaSyx + run: mvn clean install + - name: Stop environment + if: always() + run: docker compose down diff --git a/.gitignore b/.gitignore index 729324cec..1cda58599 100644 --- a/.gitignore +++ b/.gitignore @@ -86,3 +86,6 @@ local.properties **/open-api/Plattform_i40-Registry-and-Discovery.yaml **/open-api/Plattform_i40-SubmodelRegistry-and-Discovery.yaml **/open-api/temporary-extensions-result-file.yaml +/.env + +**.iml diff --git a/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice-http/pom.xml b/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice-http/pom.xml index da15d07c6..730714029 100644 --- a/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice-http/pom.xml +++ b/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice-http/pom.xml @@ -1,5 +1,6 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 @@ -48,11 +49,7 @@ org.springdoc - springdoc-openapi-ui - - - javax.validation - validation-api + springdoc-openapi-starter-webmvc-ui org.eclipse.digitaltwin.aas4j diff --git a/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice-http/src/main/java/org/eclipse/digitaltwin/basyx/aasdiscoveryservice/http/LookupApi.java b/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice-http/src/main/java/org/eclipse/digitaltwin/basyx/aasdiscoveryservice/http/LookupApi.java index 3b625a2bd..9e0b8bd92 100644 --- a/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice-http/src/main/java/org/eclipse/digitaltwin/basyx/aasdiscoveryservice/http/LookupApi.java +++ b/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice-http/src/main/java/org/eclipse/digitaltwin/basyx/aasdiscoveryservice/http/LookupApi.java @@ -1,27 +1,24 @@ -/******************************************************************************* +/** * Copyright (C) 2023 the Eclipse BaSyx Authors - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + *

+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to the following conditions: + *

+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + * Software. + *

+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *

* SPDX-License-Identifier: MIT - ******************************************************************************/ + *

+ * NOTE: This class is auto generated by the swagger code generator program (3.0.46). + * https://github.com/swagger-api/swagger-codegen Do not edit the class manually. + */ /** * NOTE: This class is auto generated by the swagger code generator program (3.0.46). @@ -50,68 +47,66 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; -import javax.validation.Valid; -import javax.validation.constraints.*; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; import java.util.List; -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-10-10T10:16:17.046754509Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-10-10T10:16:17.046754509Z[GMT]") @Validated public interface LookupApi { + @Operation(summary = "Deletes all specific Asset identifiers linked to an Asset Administration Shell to edit discoverable content", description = "", tags={ "Asset Administration Shell Basic Discovery API" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "204", description = "Specific Asset identifiers deleted successfully"), - @Operation(summary = "Deletes all specific Asset identifiers linked to an Asset Administration Shell to edit discoverable content", description = "", tags={ "Asset Administration Shell Basic Discovery API" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "204", description = "Specific Asset identifiers deleted successfully"), - - @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "200", description = "Default error handling for unmentioned status codes", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))) }) - @RequestMapping(value = "/lookup/shells/{aasIdentifier}", - produces = { "application/json" }, - method = RequestMethod.DELETE) - ResponseEntity deleteAllAssetLinksById(@Parameter(in = ParameterIn.PATH, description = "The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)", required=true, schema=@Schema()) @PathVariable("aasIdentifier") Base64UrlEncodedIdentifier aasIdentifier); - - - @Operation(summary = "Returns a list of Asset Administration Shell ids linked to specific Asset identifiers", description = "", tags={ "Asset Administration Shell Basic Discovery API" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Requested Asset Administration Shell ids", content = @Content(mediaType = "application/json", schema = @Schema(implementation = InlineResponse200.class))), - - @ApiResponse(responseCode = "200", description = "Default error handling for unmentioned status codes", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))) }) - @RequestMapping(value = "/lookup/shells", - produces = { "application/json" }, - method = RequestMethod.GET) - ResponseEntity getAllAssetAdministrationShellIdsByAssetLink(@Parameter(in = ParameterIn.QUERY, description = "A list of specific Asset identifiers. Each Asset identifier is a base64-url-encoded [SpecificAssetId](https://api.swaggerhub.com/domains/Plattform_i40/Part1-MetaModel-Schemas/V3.0.1#/components/schemas/SpecificAssetId)" ,schema=@Schema()) @Valid @RequestParam(value = "assetIds", required = false) List assetIds, @Min(1)@Parameter(in = ParameterIn.QUERY, description = "The maximum number of elements in the response array" ,schema=@Schema(allowableValues={ "1" }, minimum="1" -)) @Valid @RequestParam(value = "limit", required = false) Integer limit, @Parameter(in = ParameterIn.QUERY, description = "A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue" ,schema=@Schema()) @Valid @RequestParam(value = "cursor", required = false) String cursor); - - - @Operation(summary = "Returns a list of specific Asset identifiers based on an Asset Administration Shell id to edit discoverable content", description = "", tags={ "Asset Administration Shell Basic Discovery API" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Requested specific Asset identifiers", content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = SpecificAssetId.class)))), - - @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "200", description = "Default error handling for unmentioned status codes", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))) }) - @RequestMapping(value = "/lookup/shells/{aasIdentifier}", - produces = { "application/json" }, - method = RequestMethod.GET) - ResponseEntity> getAllAssetLinksById(@Parameter(in = ParameterIn.PATH, description = "The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)", required=true, schema=@Schema()) @PathVariable("aasIdentifier") Base64UrlEncodedIdentifier aasIdentifier); - - - @Operation(summary = "Creates specific Asset identifiers linked to an Asset Administration Shell to edit discoverable content", description = "", tags={ "Asset Administration Shell Basic Discovery API" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "201", description = "Specific Asset identifiers created successfully", content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = SpecificAssetId.class)))), - - @ApiResponse(responseCode = "400", description = "Bad Request, e.g. the request parameters of the format of the request body is wrong.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "409", description = "Conflict, a resource which shall be created exists already. Might be thrown if a Submodel or SubmodelElement with the same ShortId is contained in a POST request.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "200", description = "Default error handling for unmentioned status codes", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))) }) - @RequestMapping(value = "/lookup/shells/{aasIdentifier}", - produces = { "application/json" }, - consumes = { "application/json" }, - method = RequestMethod.POST) - ResponseEntity> postAllAssetLinksById(@Parameter(in = ParameterIn.PATH, description = "The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)", required=true, schema=@Schema()) @PathVariable("aasIdentifier") Base64UrlEncodedIdentifier aasIdentifier, @Parameter(in = ParameterIn.DEFAULT, description = "A list of specific Asset identifiers", required=true, schema=@Schema()) @Valid @RequestBody List body); + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), -} + @ApiResponse(responseCode = "200", description = "Default error handling for unmentioned status codes", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))) }) + @RequestMapping(value = "/lookup/shells/{aasIdentifier}", + produces = { "application/json" }, + method = RequestMethod.DELETE) + ResponseEntity deleteAllAssetLinksById(@Parameter(in = ParameterIn.PATH, description = "The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)", required=true, schema=@Schema()) @PathVariable("aasIdentifier") Base64UrlEncodedIdentifier aasIdentifier); + + + @Operation(summary = "Returns a list of Asset Administration Shell ids linked to specific Asset identifiers", description = "", tags={ "Asset Administration Shell Basic Discovery API" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Requested Asset Administration Shell ids", content = @Content(mediaType = "application/json", schema = @Schema(implementation = InlineResponse200.class))), + + @ApiResponse(responseCode = "200", description = "Default error handling for unmentioned status codes", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))) }) + @RequestMapping(value = "/lookup/shells", + produces = { "application/json" }, + method = RequestMethod.GET) + ResponseEntity getAllAssetAdministrationShellIdsByAssetLink(@Parameter(in = ParameterIn.QUERY, description = "A list of specific Asset identifiers. Each Asset identifier is a base64-url-encoded [SpecificAssetId](https://api.swaggerhub.com/domains/Plattform_i40/Part1-MetaModel-Schemas/V3.0.1#/components/schemas/SpecificAssetId)" ,schema=@Schema()) @Valid @RequestParam(value = "assetIds", required = false) List assetIds, @Min(1)@Parameter(in = ParameterIn.QUERY, description = "The maximum number of elements in the response array" ,schema=@Schema(allowableValues={ "1" }, minimum="1" + )) @Valid @RequestParam(value = "limit", required = false) Integer limit, @Parameter(in = ParameterIn.QUERY, description = "A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue" ,schema=@Schema()) @Valid @RequestParam(value = "cursor", required = false) String cursor); + + + @Operation(summary = "Returns a list of specific Asset identifiers based on an Asset Administration Shell id to edit discoverable content", description = "", tags={ "Asset Administration Shell Basic Discovery API" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Requested specific Asset identifiers", content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = SpecificAssetId.class)))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "200", description = "Default error handling for unmentioned status codes", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))) }) + @RequestMapping(value = "/lookup/shells/{aasIdentifier}", + produces = { "application/json" }, + method = RequestMethod.GET) + ResponseEntity> getAllAssetLinksById(@Parameter(in = ParameterIn.PATH, description = "The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)", required=true, schema=@Schema()) @PathVariable("aasIdentifier") Base64UrlEncodedIdentifier aasIdentifier); + + + @Operation(summary = "Creates specific Asset identifiers linked to an Asset Administration Shell to edit discoverable content", description = "", tags={ "Asset Administration Shell Basic Discovery API" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "201", description = "Specific Asset identifiers created successfully", content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = SpecificAssetId.class)))), + + @ApiResponse(responseCode = "400", description = "Bad Request, e.g. the request parameters of the format of the request body is wrong.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "409", description = "Conflict, a resource which shall be created exists already. Might be thrown if a Submodel or SubmodelElement with the same ShortId is contained in a POST request.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "200", description = "Default error handling for unmentioned status codes", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))) }) + @RequestMapping(value = "/lookup/shells/{aasIdentifier}", + produces = { "application/json" }, + consumes = { "application/json" }, + method = RequestMethod.POST) + ResponseEntity> postAllAssetLinksById(@Parameter(in = ParameterIn.PATH, description = "The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)", required=true, schema=@Schema()) @PathVariable("aasIdentifier") Base64UrlEncodedIdentifier aasIdentifier, @Parameter(in = ParameterIn.DEFAULT, description = "A list of specific Asset identifiers", required=true, schema=@Schema()) @Valid @RequestBody List body); + +} diff --git a/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice-http/src/main/java/org/eclipse/digitaltwin/basyx/aasdiscoveryservice/http/LookupApiController.java b/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice-http/src/main/java/org/eclipse/digitaltwin/basyx/aasdiscoveryservice/http/LookupApiController.java index 2bc8a1744..5bf0679ab 100644 --- a/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice-http/src/main/java/org/eclipse/digitaltwin/basyx/aasdiscoveryservice/http/LookupApiController.java +++ b/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice-http/src/main/java/org/eclipse/digitaltwin/basyx/aasdiscoveryservice/http/LookupApiController.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 the Eclipse BaSyx Authors - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,7 +19,7 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ @@ -44,43 +44,49 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; -import javax.validation.Valid; -import javax.validation.constraints.*; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-10-10T10:16:17.046754509Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-10-10T10:16:17.046754509Z[GMT]") @RestController public class LookupApiController implements LookupApi { - private final AasDiscoveryService aasDiscoveryService; + private final AasDiscoveryService aasDiscoveryService; - @Autowired - public LookupApiController(AasDiscoveryService aasDiscoveryService) { - this.aasDiscoveryService = aasDiscoveryService; - } + @Autowired + public LookupApiController(AasDiscoveryService aasDiscoveryService) { + this.aasDiscoveryService = aasDiscoveryService; + } + + public ResponseEntity deleteAllAssetLinksById( + @Parameter(in = ParameterIn.PATH, description = "The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)", required = true, schema = @Schema()) @PathVariable("aasIdentifier") Base64UrlEncodedIdentifier aasIdentifier) { + aasDiscoveryService.deleteAllAssetLinksById(aasIdentifier.getIdentifier()); - public ResponseEntity deleteAllAssetLinksById(@Parameter(in = ParameterIn.PATH, description = "The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)", required=true, schema=@Schema()) @PathVariable("aasIdentifier") Base64UrlEncodedIdentifier aasIdentifier) { - aasDiscoveryService.deleteAllAssetLinksById(aasIdentifier.getIdentifier()); - return new ResponseEntity(HttpStatus.NO_CONTENT); - } + } - public ResponseEntity getAllAssetAdministrationShellIdsByAssetLink(@Parameter(in = ParameterIn.QUERY, description = "A list of specific Asset identifiers. Each Asset identifier is a base64-url-encoded [SpecificAssetId](https://api.swaggerhub.com/domains/Plattform_i40/Part1-MetaModel-Schemas/V3.0.1#/components/schemas/SpecificAssetId)" ,schema=@Schema()) @Valid @RequestParam(value = "assetIds", required = false) List assetIds,@Min(1)@Parameter(in = ParameterIn.QUERY, description = "The maximum number of elements in the response array" ,schema=@Schema(allowableValues={ "1" }, minimum="1" -)) @Valid @RequestParam(value = "limit", required = false) Integer limit,@Parameter(in = ParameterIn.QUERY, description = "A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue" ,schema=@Schema()) @Valid @RequestParam(value = "cursor", required = false) String cursor) { - - if (limit == null) + public ResponseEntity getAllAssetAdministrationShellIdsByAssetLink( + @Parameter(in = ParameterIn.QUERY, description = "A list of specific Asset identifiers. Each Asset identifier is a base64-url-encoded [SpecificAssetId](https://api.swaggerhub.com/domains/Plattform_i40/Part1-MetaModel-Schemas/V3.0.1#/components/schemas/SpecificAssetId)", schema = @Schema()) @Valid @RequestParam(value = "assetIds", required = false) List assetIds, + @Min(1) @Parameter(in = ParameterIn.QUERY, description = "The maximum number of elements in the response array", schema = @Schema(allowableValues = { + "1" }, minimum = "1")) @Valid @RequestParam(value = "limit", required = false) Integer limit, + @Parameter(in = ParameterIn.QUERY, description = "A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue", schema = @Schema()) @Valid @RequestParam(value = "cursor", required = false) String cursor) { + + if (limit == null) { limit = 100; - - if (cursor == null) + } + + if (cursor == null) { cursor = ""; + } PaginationInfo pInfo = new PaginationInfo(limit, cursor); - + List decodedAssetIds = getDecodedAssetIds(assetIds); - + CursorResult> filteredResult = aasDiscoveryService.getAllAssetAdministrationShellIdsByAssetLink(pInfo, decodedAssetIds); InlineResponse200 paginatedAasIds = new InlineResponse200(); @@ -104,8 +110,9 @@ public ResponseEntity> postAllAssetLinksById(@Parameter(in private List getDecodedAssetIds(List assetIds) { - if (assetIds == null) + if (assetIds == null) { return new ArrayList<>(); + } return assetIds.stream().map(assetId -> assetId.getIdentifier()).collect(Collectors.toList()); } diff --git a/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice-http/src/main/java/org/eclipse/digitaltwin/basyx/aasdiscoveryservice/http/pagination/InlineResponse200.java b/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice-http/src/main/java/org/eclipse/digitaltwin/basyx/aasdiscoveryservice/http/pagination/InlineResponse200.java index c1bc7569b..4764301c3 100644 --- a/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice-http/src/main/java/org/eclipse/digitaltwin/basyx/aasdiscoveryservice/http/pagination/InlineResponse200.java +++ b/basyx.aasdiscoveryservice/basyx.aasdiscoveryservice-http/src/main/java/org/eclipse/digitaltwin/basyx/aasdiscoveryservice/http/pagination/InlineResponse200.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 the Eclipse BaSyx Authors - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,7 +19,7 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ @@ -33,15 +33,16 @@ import org.eclipse.digitaltwin.basyx.http.pagination.PagedResult; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; +import jakarta.validation.Valid; /** * InlineResponse200 */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-10-10T10:16:17.046754509Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-10-10T10:16:17.046754509Z[GMT]") public class InlineResponse200 extends PagedResult { + @JsonProperty("result") @Valid private List result = null; @@ -61,7 +62,7 @@ public InlineResponse200 addResultItem(String resultItem) { /** * Get result - * + * * @return result **/ @Schema(description = "") diff --git a/basyx.aasenvironment/basyx.aasenvironment-core/pom.xml b/basyx.aasenvironment/basyx.aasenvironment-core/pom.xml index 9e03df07b..d2e7bc743 100644 --- a/basyx.aasenvironment/basyx.aasenvironment-core/pom.xml +++ b/basyx.aasenvironment/basyx.aasenvironment-core/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 @@ -87,8 +88,8 @@ - javax.validation - validation-api + jakarta.validation + jakarta.validation-api @@ -132,4 +133,4 @@ - \ No newline at end of file + diff --git a/basyx.aasenvironment/basyx.aasenvironment-core/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/base/DefaultAASEnvironmentSerialization.java b/basyx.aasenvironment/basyx.aasenvironment-core/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/base/DefaultAASEnvironmentSerialization.java index 80196a2ca..7bb7c1632 100644 --- a/basyx.aasenvironment/basyx.aasenvironment-core/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/base/DefaultAASEnvironmentSerialization.java +++ b/basyx.aasenvironment/basyx.aasenvironment-core/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/base/DefaultAASEnvironmentSerialization.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 the Eclipse BaSyx Authors - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,20 +19,18 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.aasenvironment.base; +import jakarta.validation.Valid; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.List; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; - -import javax.validation.Valid; - import org.eclipse.digitaltwin.aas4j.v3.dataformat.SerializationException; import org.eclipse.digitaltwin.aas4j.v3.dataformat.aasx.AASXSerializer; import org.eclipse.digitaltwin.aas4j.v3.dataformat.json.JsonSerializer; @@ -54,14 +52,13 @@ /** * Default implementation of {@link AasEnvironmentSerialization} - * - * @author zhangzai, danish * + * @author zhangzai, danish */ public class DefaultAASEnvironmentSerialization implements AasEnvironmentSerialization { - + private static Logger logger = LoggerFactory.getLogger(DefaultAASEnvironmentSerialization.class); - + private AasRepository aasRepository; private SubmodelRepository submodelRepository; private ConceptDescriptionRepository conceptDescriptionRepository; @@ -69,7 +66,7 @@ public class DefaultAASEnvironmentSerialization implements AasEnvironmentSeriali private XmlSerializer xmlSerializer = new XmlSerializer(); private AASXSerializer aasxSerializer = new AASXSerializer(); private MetamodelCloneCreator cloneCreator = new MetamodelCloneCreator(); - + public DefaultAASEnvironmentSerialization(AasRepository aasRepository, SubmodelRepository submodelRepository, ConceptDescriptionRepository conceptDescriptionRepository) { this.aasRepository = aasRepository; this.submodelRepository = submodelRepository; @@ -101,14 +98,15 @@ public byte[] createAASXAASEnvironmentSerialization(@Valid List aasIds, private Environment createEnvironment(List aasIds, List submodelIds, boolean includeConceptDescriptions) { List shells = aasIds.stream().map(aasRepository::getAas).collect(Collectors.toList()); List submodels = submodelIds.stream().map(submodelRepository::getSubmodel).collect(Collectors.toList()); - + Environment aasEnvironment = new DefaultEnvironment(); aasEnvironment.setAssetAdministrationShells(cloneCreator.cloneAssetAdministrationShells(shells)); aasEnvironment.setSubmodels(cloneCreator.cloneSubmodels(submodels)); - - if (includeConceptDescriptions) + + if (includeConceptDescriptions) { includeConceptDescriptions(aasEnvironment); - + } + return aasEnvironment; } @@ -116,16 +114,17 @@ private void includeConceptDescriptions(Environment aasEnvironment) { List conceptDescriptions = cloneCreator.cloneConceptDescriptions(getConceptDescriptions(aasEnvironment)); aasEnvironment.setConceptDescriptions(conceptDescriptions); } - + private List getConceptDescriptions(Environment env) { - if (conceptDescriptionRepository == null) + if (conceptDescriptionRepository == null) { throw new NullPointerException("The parameter includeConceptDescriptions is set to true but ConceptDescriptionRepository is null"); - + } + Set cdIds = new ConceptDescriptionIdCollector(env).collect(); - + return cdIds.stream().map(this::fetchConceptDescriptionFromRepo).filter(Objects::nonNull).collect(Collectors.toList()); } - + private ConceptDescription fetchConceptDescriptionFromRepo(String conceptDescriptionId) { try { return conceptDescriptionRepository.getConceptDescription(conceptDescriptionId); diff --git a/basyx.aasenvironment/basyx.aasenvironment-core/src/test/java/org/eclipse/digitaltwin/basyx/aasenvironment/TestAASEnvironmentSerialization.java b/basyx.aasenvironment/basyx.aasenvironment-core/src/test/java/org/eclipse/digitaltwin/basyx/aasenvironment/TestAASEnvironmentSerialization.java index 12d6fa3d7..8420dc8f2 100644 --- a/basyx.aasenvironment/basyx.aasenvironment-core/src/test/java/org/eclipse/digitaltwin/basyx/aasenvironment/TestAASEnvironmentSerialization.java +++ b/basyx.aasenvironment/basyx.aasenvironment-core/src/test/java/org/eclipse/digitaltwin/basyx/aasenvironment/TestAASEnvironmentSerialization.java @@ -10,7 +10,6 @@ import java.util.Collection; import java.util.List; import java.util.stream.Collectors; - import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.exceptions.InvalidOperationException; import org.eclipse.digitaltwin.aas4j.v3.dataformat.DeserializationException; @@ -45,6 +44,7 @@ import org.xml.sax.SAXException; public class TestAASEnvironmentSerialization { + private static final PaginationInfo NO_LIMIT_PAGINATION_INFO = new PaginationInfo(0, ""); public static final String AAS_TECHNICAL_DATA_ID = "shell001"; public static final String AAS_OPERATIONAL_DATA_ID = "shell002"; @@ -70,7 +70,7 @@ public void setup() { for (AssetAdministrationShell shell : createDummyShells()) { aasRepository.createAas(shell); } - + aasEnvironment = new DefaultAASEnvironmentSerialization(aasRepository, submodelRepository, conceptDescriptionRepository); } @@ -96,40 +96,40 @@ private static Collection createDummyShells() { @Test public void testAASEnviromentSerializationWithJSON() throws SerializationException, IOException, DeserializationException { boolean includeConceptDescription = true; - + String jsonSerialization = aasEnvironment.createJSONAASEnvironmentSerialization(getShellIds(createDummyShells()), getSubmodelIds(createDummySubmodels()), includeConceptDescription); validateJSON(jsonSerialization, includeConceptDescription); - + validateRepositoriesState(); } @Test public void testAASEnviromentSerializationWithXML() throws SerializationException, IOException, SAXException, DeserializationException { boolean includeConceptDescription = true; - + String xmlSerialization = aasEnvironment.createXMLAASEnvironmentSerialization(getShellIds(createDummyShells()), getSubmodelIds(createDummySubmodels()), includeConceptDescription); validateXml(xmlSerialization, includeConceptDescription); - + validateRepositoriesState(); } @Test public void testAASEnviromentSerializationWithAASX() throws SerializationException, IOException, InvalidOperationException, InvalidFormatException, DeserializationException { boolean includeConceptDescription = true; - + byte[] serialization = aasEnvironment.createAASXAASEnvironmentSerialization(getShellIds(createDummyShells()), getSubmodelIds(createDummySubmodels()), includeConceptDescription); checkAASX(new ByteArrayInputStream(serialization), includeConceptDescription); - + validateRepositoriesState(); } - + @Test public void testAASEnviromentSerializationWithJSONExcludeCD() throws SerializationException, IOException, DeserializationException { boolean includeConceptDescription = false; - + String jsonSerialization = aasEnvironment.createJSONAASEnvironmentSerialization(getShellIds(createDummyShells()), getSubmodelIds(createDummySubmodels()), includeConceptDescription); validateJSON(jsonSerialization, includeConceptDescription); - + validateRepositoriesState(); } @@ -153,24 +153,25 @@ public static void checkAASX(InputStream inputStream, boolean includeConceptDesc checkAASEnvironment(environment, includeConceptDescription); inputStream.close(); } - + public static Collection createDummyConceptDescriptions() { Collection conceptDescriptions = new ArrayList<>(); - + conceptDescriptions.add(new DefaultConceptDescription.Builder().id(SubmodelServiceHelper.SUBMODEL_TECHNICAL_DATA_SEMANTIC_ID_PROPERTY).build()); conceptDescriptions.add(new DefaultConceptDescription.Builder().id(DummySubmodelFactory.SUBMODEL_OPERATIONAL_DATA_SEMANTIC_ID_PROPERTY).build()); conceptDescriptions.add(new DefaultConceptDescription.Builder().id(CONCEPT_DESCRIPTION_ID_NOT_INCLUDED_IN_ENV).build()); - + return conceptDescriptions; } - + private static void checkAASEnvironment(Environment aasEnvironment, boolean areConceptDescriptionsIncluded) { assertAasIds(aasEnvironment); assertSubmodelIds(aasEnvironment); - - if (areConceptDescriptionsIncluded) + + if (areConceptDescriptionsIncluded) { assertConceptDescriptionIds(aasEnvironment); + } } private static void assertConceptDescriptionIds(Environment aasEnvironment) { @@ -199,7 +200,7 @@ private List getSubmodelIds(Collection submodels) { private List getShellIds(Collection shells) { return shells.stream().map(shell -> ((DefaultAssetAdministrationShell) shell).getId()).collect(Collectors.toList()); } - + private static List retrieveSubmodelIds(Environment aasEnvironment) { List submodelIds = new ArrayList<>(); aasEnvironment.getSubmodels().forEach(s -> { @@ -216,17 +217,15 @@ private static List retrieveShellIds(Environment aasEnvironment) { }); return aasIds; } - + private static List retrieveConceptDescriptionIds(Environment aasEnvironment) { return aasEnvironment.getConceptDescriptions().stream().map(cd -> cd.getId()).collect(Collectors.toList()); } - + private void validateRepositoriesState() { assertTrue(aasRepository.getAllAas(NO_LIMIT_PAGINATION_INFO).getResult().containsAll(createDummyShells())); - assertTrue(submodelRepository.getAllSubmodels(NO_LIMIT_PAGINATION_INFO).getResult() - .containsAll(createDummySubmodels())); - assertTrue(conceptDescriptionRepository.getAllConceptDescriptions(NO_LIMIT_PAGINATION_INFO).getResult() - .containsAll(createDummyConceptDescriptions())); + assertTrue(submodelRepository.getAllSubmodels(NO_LIMIT_PAGINATION_INFO).getResult().containsAll(createDummySubmodels())); + assertTrue(conceptDescriptionRepository.getAllConceptDescriptions(NO_LIMIT_PAGINATION_INFO).getResult().containsAll(createDummyConceptDescriptions())); } } diff --git a/basyx.aasenvironment/basyx.aasenvironment-http/pom.xml b/basyx.aasenvironment/basyx.aasenvironment-http/pom.xml index 111d379c6..f0892de0f 100644 --- a/basyx.aasenvironment/basyx.aasenvironment-http/pom.xml +++ b/basyx.aasenvironment/basyx.aasenvironment-http/pom.xml @@ -54,11 +54,11 @@ org.springdoc - springdoc-openapi-ui + springdoc-openapi-starter-webmvc-ui - javax.validation - validation-api + jakarta.validation + jakarta.validation-api org.eclipse.digitaltwin.aas4j @@ -84,4 +84,4 @@ test - \ No newline at end of file + diff --git a/basyx.aasenvironment/basyx.aasenvironment-http/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/http/AASEnvironmentHTTPApi.java b/basyx.aasenvironment/basyx.aasenvironment-http/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/http/AASEnvironmentHTTPApi.java index 1018b03ed..f459acd0d 100644 --- a/basyx.aasenvironment/basyx.aasenvironment-http/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/http/AASEnvironmentHTTPApi.java +++ b/basyx.aasenvironment/basyx.aasenvironment-http/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/http/AASEnvironmentHTTPApi.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 the Eclipse BaSyx Authors - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,16 +19,21 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.aasenvironment.http; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import jakarta.validation.Valid; import java.util.List; - -import javax.validation.Valid; - import org.eclipse.digitaltwin.basyx.http.model.Result; import org.springframework.core.io.Resource; import org.springframework.http.ResponseEntity; @@ -37,36 +42,29 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.enums.ParameterIn; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; - -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-05-08T12:36:05.278579031Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-05-08T12:36:05.278579031Z[GMT]") @Validated public interface AASEnvironmentHTTPApi { - @Operation(summary = "Returns an appropriate serialization based on the specified format (see SerializationFormat)", description = "", tags={ "Serialization API" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Requested serialization based on SerializationFormat", content = @Content(mediaType = "application/asset-administration-shell-package+xml", schema = @Schema(implementation = Resource.class))), - - @ApiResponse(responseCode = "400", description = "Bad Request, e.g. the request parameters of the format of the request body is wrong.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "401", description = "Unauthorized, e.g. the server refused the authorization attempt.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "200", description = "Default error handling for unmentioned status codes", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))) }) - @RequestMapping(value = "/serialization", - produces = { "application/asset-administration-shell-package+xml", "application/json", "application/xml" }, - method = RequestMethod.GET) - ResponseEntity generateSerializationByIds(@Parameter(in = ParameterIn.QUERY, description = "The Asset Administration Shells' unique ids (UTF8-BASE64-URL-encoded)" ,schema=@Schema()) @Valid @RequestParam(value = "aasIds", required = false) List aasIds, @Parameter(in = ParameterIn.QUERY, description = "The Submodels' unique ids (UTF8-BASE64-URL-encoded)" ,schema=@Schema()) @Valid @RequestParam(value = "submodelIds", required = false) List submodelIds, @Parameter(in = ParameterIn.QUERY, description = "Include Concept Descriptions?" ,schema=@Schema( defaultValue="true")) @Valid @RequestParam(value = "includeConceptDescriptions", required = false, defaultValue="true") Boolean includeConceptDescriptions); + @Operation(summary = "Returns an appropriate serialization based on the specified format (see SerializationFormat)", description = "", tags = { "Serialization API" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Requested serialization based on SerializationFormat", content = @Content(mediaType = "application/asset-administration-shell-package+xml", schema = @Schema(implementation = Resource.class))), + + @ApiResponse(responseCode = "400", description = "Bad Request, e.g. the request parameters of the format of the request body is wrong.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "401", description = "Unauthorized, e.g. the server refused the authorization attempt.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "200", description = "Default error handling for unmentioned status codes", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))) }) + @RequestMapping(value = "/serialization", produces = { "application/asset-administration-shell-package+xml", "application/json", "application/xml" }, method = RequestMethod.GET) + ResponseEntity generateSerializationByIds( + @Parameter(in = ParameterIn.QUERY, description = "The Asset Administration Shells' unique ids (UTF8-BASE64-URL-encoded)", schema = @Schema()) @Valid @RequestParam(value = "aasIds", required = false) List aasIds, + @Parameter(in = ParameterIn.QUERY, description = "The Submodels' unique ids (UTF8-BASE64-URL-encoded)", schema = @Schema()) @Valid @RequestParam(value = "submodelIds", required = false) List submodelIds, + @Parameter(in = ParameterIn.QUERY, description = "Include Concept Descriptions?", schema = @Schema(defaultValue = "true")) @Valid @RequestParam(value = "includeConceptDescriptions", required = false, defaultValue = "true") Boolean includeConceptDescriptions); } diff --git a/basyx.aasenvironment/basyx.aasenvironment-http/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/http/SerializationApiController.java b/basyx.aasenvironment/basyx.aasenvironment-http/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/http/SerializationApiController.java index 2a45c6f61..c3b9c5df9 100644 --- a/basyx.aasenvironment/basyx.aasenvironment-http/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/http/SerializationApiController.java +++ b/basyx.aasenvironment/basyx.aasenvironment-http/src/main/java/org/eclipse/digitaltwin/basyx/aasenvironment/http/SerializationApiController.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 the Eclipse BaSyx Authors - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,19 +19,20 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.aasenvironment.http; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.validation.Valid; import java.io.IOException; import java.util.ArrayList; import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.validation.Valid; - import org.eclipse.digitaltwin.aas4j.v3.dataformat.SerializationException; import org.eclipse.digitaltwin.basyx.aasenvironment.AasEnvironmentSerialization; import org.eclipse.digitaltwin.basyx.core.exceptions.ElementDoesNotExistException; @@ -44,13 +45,10 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.enums.ParameterIn; -import io.swagger.v3.oas.annotations.media.Schema; - -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-05-08T12:36:05.278579031Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-05-08T12:36:05.278579031Z[GMT]") @RestController public class SerializationApiController implements AASEnvironmentHTTPApi { + private static final String ACCEPT_JSON = "application/json"; private static final String ACCEPT_XML = "application/xml"; private static final String ACCEPT_AASX = "application/asset-administration-shell-package+xml"; @@ -72,8 +70,9 @@ public ResponseEntity generateSerializationByIds( @Parameter(in = ParameterIn.QUERY, description = "Include Concept Descriptions?", schema = @Schema(defaultValue = "true")) @Valid @RequestParam(value = "includeConceptDescriptions", required = false, defaultValue = "true") Boolean includeConceptDescriptions) { String accept = request.getHeader("Accept"); - if (!areParametersValid(accept, aasIds, submodelIds)) + if (!areParametersValid(accept, aasIds, submodelIds)) { return new ResponseEntity(HttpStatus.BAD_REQUEST); + } try { if (accept.equals(ACCEPT_AASX)) { @@ -104,8 +103,9 @@ private List getOriginalIds(List ids) { } private boolean areParametersValid(String accept, @Valid List aasIds, @Valid List submodelIds) { - if (aasIds.isEmpty() || submodelIds.isEmpty()) + if (aasIds.isEmpty() || submodelIds.isEmpty()) { return false; + } return (accept.equals(ACCEPT_AASX) || accept.equals(ACCEPT_JSON) || accept.equals(ACCEPT_XML)); } } diff --git a/basyx.aasenvironment/basyx.aasenvironment-http/src/test/resources/application.properties b/basyx.aasenvironment/basyx.aasenvironment-http/src/test/resources/application.properties new file mode 100644 index 000000000..471b9a61d --- /dev/null +++ b/basyx.aasenvironment/basyx.aasenvironment-http/src/test/resources/application.properties @@ -0,0 +1,2 @@ +server.port=8081 +basyx.backend = InMemory \ No newline at end of file diff --git a/basyx.aasenvironment/basyx.aasenvironment.component/Dockerfile b/basyx.aasenvironment/basyx.aasenvironment.component/Dockerfile index ba63c3d14..1c3e9648d 100644 --- a/basyx.aasenvironment/basyx.aasenvironment.component/Dockerfile +++ b/basyx.aasenvironment/basyx.aasenvironment.component/Dockerfile @@ -1,11 +1,11 @@ -FROM amazoncorretto:11 +FROM amazoncorretto:17 USER nobody WORKDIR /application ARG JAR_FILE=target/*-exec.jar COPY ${JAR_FILE} basyxExecutable.jar COPY src/main/resources/application.properties application.properties ARG PORT=8081 -ENV PORT=${PORT} -EXPOSE ${PORT} -HEALTHCHECK --interval=30s --timeout=3s --retries=3 --start-period=15s CMD curl --fail http://localhost:${PORT}/actuator/health || exit 1 -ENTRYPOINT ["java","-jar","basyxExecutable.jar"] \ No newline at end of file +ENV SERVER_PORT=${PORT} +EXPOSE ${SERVER_PORT} +HEALTHCHECK --interval=30s --timeout=3s --retries=3 --start-period=15s CMD curl --fail http://localhost:${SERVER_PORT}/actuator/health || exit 1 +ENTRYPOINT ["java","-jar","basyxExecutable.jar"] diff --git a/basyx.aasenvironment/basyx.aasenvironment.component/pom.xml b/basyx.aasenvironment/basyx.aasenvironment.component/pom.xml index 5ff190487..10dfb5acb 100644 --- a/basyx.aasenvironment/basyx.aasenvironment.component/pom.xml +++ b/basyx.aasenvironment/basyx.aasenvironment.component/pom.xml @@ -125,7 +125,7 @@ - ${docker.username}/${docker.image.name} + ${docker.namespace}/${docker.image.name} ${docker.image.tag} diff --git a/basyx.aasregistry/basyx.aasregistry-client-native/pom.xml b/basyx.aasregistry/basyx.aasregistry-client-native/pom.xml index 8004b6c8a..0008b5cd7 100644 --- a/basyx.aasregistry/basyx.aasregistry-client-native/pom.xml +++ b/basyx.aasregistry/basyx.aasregistry-client-native/pom.xml @@ -7,7 +7,6 @@ org.eclipse.digitaltwin.basyx basyx.aasregistry ${revision} - .. basyx.aasregistry-client-native @@ -58,7 +57,7 @@ - + org.openapitools openapi-generator-maven-plugin @@ -81,18 +80,21 @@ false true ${project.basedir}/templates - AbstractOpenApiSchema.java,ServerConfiguration.java,ServerVariable.java,Configuration.java,JSON.java,ApiException.java,ApiResponse.java,ApiClient.java,Pair.java,RFC3339DateFormat.java + + AbstractOpenApiSchema.java,ServerConfiguration.java,ServerVariable.java,Configuration.java,JSON.java,ApiException.java,ApiResponse.java,ApiClient.java,Pair.java,RFC3339DateFormat.java + true java8 java + true - + @@ -110,8 +112,12 @@ jackson-databind-nullable - javax.annotation - javax.annotation-api + jakarta.annotation + jakarta.annotation-api + + + jakarta.validation + jakarta.validation-api com.fasterxml.jackson.core diff --git a/basyx.aasregistry/basyx.aasregistry-paths/pom.xml b/basyx.aasregistry/basyx.aasregistry-paths/pom.xml index dcf94c465..fa2bf65c0 100644 --- a/basyx.aasregistry/basyx.aasregistry-paths/pom.xml +++ b/basyx.aasregistry/basyx.aasregistry-paths/pom.xml @@ -7,7 +7,7 @@ org.eclipse.digitaltwin.basyx basyx.aasregistry ${revision} - .. + basyx.aasregistry-paths @@ -70,4 +70,4 @@ provided - \ No newline at end of file + diff --git a/basyx.aasregistry/basyx.aasregistry-plugins/pom.xml b/basyx.aasregistry/basyx.aasregistry-plugins/pom.xml index 1163879b8..24a0a84fe 100644 --- a/basyx.aasregistry/basyx.aasregistry-plugins/pom.xml +++ b/basyx.aasregistry/basyx.aasregistry-plugins/pom.xml @@ -4,7 +4,6 @@ org.eclipse.digitaltwin.basyx basyx.aasregistry ${revision} - .. basyx.aasregistry-plugins maven-plugin @@ -45,4 +44,4 @@ test - \ No newline at end of file + diff --git a/basyx.aasregistry/basyx.aasregistry-service-basemodel/pom.xml b/basyx.aasregistry/basyx.aasregistry-service-basemodel/pom.xml index fd70752c9..77726f303 100644 --- a/basyx.aasregistry/basyx.aasregistry-service-basemodel/pom.xml +++ b/basyx.aasregistry/basyx.aasregistry-service-basemodel/pom.xml @@ -7,7 +7,6 @@ org.eclipse.digitaltwin.basyx basyx.aasregistry ${revision} - .. basyx.aasregistry-service-basemodel @@ -60,7 +59,7 @@ - + org.openapitools openapi-generator-maven-plugin @@ -87,6 +86,7 @@ true org.eclipse.digitaltwin.basyx.aasregistry.model array=ArrayList,map=HashMap + true @@ -108,11 +108,11 @@ org.springdoc - springdoc-openapi-ui + springdoc-openapi-starter-webmvc-ui org.springframework.boot spring-boot-starter-validation - \ No newline at end of file + diff --git a/basyx.aasregistry/basyx.aasregistry-service-basetests/pom.xml b/basyx.aasregistry/basyx.aasregistry-service-basetests/pom.xml index 9db186d7b..c074dc877 100644 --- a/basyx.aasregistry/basyx.aasregistry-service-basetests/pom.xml +++ b/basyx.aasregistry/basyx.aasregistry-service-basetests/pom.xml @@ -7,7 +7,7 @@ org.eclipse.digitaltwin.basyx basyx.aasregistry ${revision} - .. + basyx.aasregistry-service-basetests @@ -74,4 +74,4 @@ - \ No newline at end of file + diff --git a/basyx.aasregistry/basyx.aasregistry-service-inmemory-storage/pom.xml b/basyx.aasregistry/basyx.aasregistry-service-inmemory-storage/pom.xml index f44e3ef57..7b8842e20 100644 --- a/basyx.aasregistry/basyx.aasregistry-service-inmemory-storage/pom.xml +++ b/basyx.aasregistry/basyx.aasregistry-service-inmemory-storage/pom.xml @@ -7,7 +7,7 @@ org.eclipse.digitaltwin.basyx basyx.aasregistry ${revision} - .. + basyx.aasregistry-service-inmemory-storage @@ -38,4 +38,4 @@ true - \ No newline at end of file + diff --git a/basyx.aasregistry/basyx.aasregistry-service-inmemory-storage/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/memory/ThreadSafeAasRegistryStorageDecorator.java b/basyx.aasregistry/basyx.aasregistry-service-inmemory-storage/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/memory/ThreadSafeAasRegistryStorageDecorator.java index eca78a42a..471588c6d 100644 --- a/basyx.aasregistry/basyx.aasregistry-service-inmemory-storage/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/memory/ThreadSafeAasRegistryStorageDecorator.java +++ b/basyx.aasregistry/basyx.aasregistry-service-inmemory-storage/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/memory/ThreadSafeAasRegistryStorageDecorator.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 DFKI GmbH (https://www.dfki.de/en/web) - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,16 +19,16 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.aasregistry.service.storage.memory; +import jakarta.validation.Valid; import java.util.List; import java.util.Set; - -import javax.validation.Valid; - +import lombok.NonNull; +import lombok.RequiredArgsConstructor; import org.eclipse.digitaltwin.basyx.aasregistry.model.AssetAdministrationShellDescriptor; import org.eclipse.digitaltwin.basyx.aasregistry.model.ShellDescriptorSearchRequest; import org.eclipse.digitaltwin.basyx.aasregistry.model.ShellDescriptorSearchResponse; @@ -41,18 +41,15 @@ import org.eclipse.digitaltwin.basyx.core.pagination.CursorResult; import org.eclipse.digitaltwin.basyx.core.pagination.PaginationInfo; -import lombok.NonNull; -import lombok.RequiredArgsConstructor; - @RequiredArgsConstructor public class ThreadSafeAasRegistryStorageDecorator implements AasRegistryStorage { private final AasRegistryStorage storage; private final ThreadSafeAccess access = new ThreadSafeAccess(); - + @Override - public CursorResult> getAllAasDescriptors(@NonNull PaginationInfo pRequest, @NonNull DescriptorFilter filter) { + public CursorResult> getAllAasDescriptors(@NonNull PaginationInfo pRequest, @NonNull DescriptorFilter filter) { return access.read(storage::getAllAasDescriptors, pRequest, filter); } @@ -65,9 +62,9 @@ public void removeAasDescriptor(@NonNull String aasDescriptorId) { public AssetAdministrationShellDescriptor getAasDescriptor(@NonNull String aasDescriptorId) throws AasDescriptorNotFoundException { return access.read(storage::getAasDescriptor, aasDescriptorId); } - + @Override - public CursorResult> getAllSubmodels(@NonNull String aasDescriptorId, @NonNull PaginationInfo pRequest) throws AasDescriptorNotFoundException { + public CursorResult> getAllSubmodels(@NonNull String aasDescriptorId, @NonNull PaginationInfo pRequest) throws AasDescriptorNotFoundException { return access.read(storage::getAllSubmodels, aasDescriptorId, pRequest); } @@ -83,7 +80,7 @@ public void insertSubmodel(@NonNull String aasDescriptorId, @NonNull SubmodelDes @Override public void removeSubmodel(@NonNull String aasDescrId, @NonNull String submodelId) { - access.write(storage::removeSubmodel, aasDescrId, submodelId); + access.write(storage::removeSubmodel, aasDescrId, submodelId); } @Override @@ -110,4 +107,4 @@ public void replaceAasDescriptor(@NonNull String aasDescritorId, @NonNull AssetA public void replaceSubmodel(@NonNull String aasDescriptorId, @NonNull String submodelId, @NonNull SubmodelDescriptor submodel) throws AasDescriptorNotFoundException, SubmodelNotFoundException { access.write(storage::replaceSubmodel, aasDescriptorId, submodelId, submodel); } -} \ No newline at end of file +} diff --git a/basyx.aasregistry/basyx.aasregistry-service-inmemory-storage/src/test/java/org/eclipse/digitaltwin/basyx/aasregistry/service/tests/api/BasyxRegistryApiDelegateTest.java b/basyx.aasregistry/basyx.aasregistry-service-inmemory-storage/src/test/java/org/eclipse/digitaltwin/basyx/aasregistry/service/tests/api/BasyxRegistryApiDelegateTest.java index 406c75688..88ed9c638 100644 --- a/basyx.aasregistry/basyx.aasregistry-service-inmemory-storage/src/test/java/org/eclipse/digitaltwin/basyx/aasregistry/service/tests/api/BasyxRegistryApiDelegateTest.java +++ b/basyx.aasregistry/basyx.aasregistry-service-inmemory-storage/src/test/java/org/eclipse/digitaltwin/basyx/aasregistry/service/tests/api/BasyxRegistryApiDelegateTest.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 DFKI GmbH (https://www.dfki.de/en/web) - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,7 +19,7 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.aasregistry.service.tests.api; @@ -28,11 +28,9 @@ import static org.junit.Assert.assertThrows; import java.io.IOException; -import java.net.URI; import java.nio.charset.StandardCharsets; import java.util.Base64; import java.util.List; - import org.eclipse.digitaltwin.basyx.aasregistry.model.AssetAdministrationShellDescriptor; import org.eclipse.digitaltwin.basyx.aasregistry.model.GetAssetAdministrationShellDescriptorsResult; import org.eclipse.digitaltwin.basyx.aasregistry.model.GetSubmodelDescriptorsResult; @@ -58,22 +56,18 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.TestComponent; import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.boot.test.mock.mockito.MockBeans; -import org.springframework.context.annotation.Bean; import org.springframework.http.HttpStatus; +import org.springframework.http.HttpStatusCode; import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Component; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; - @RunWith(SpringRunner.class) -@ContextConfiguration(classes = { BasyxSearchApiDelegate.class, BasyxRegistryApiDelegate.class, SearchApiController.class, ShellDescriptorsApiController.class, InMemoryAasStorageConfiguration.class }) +@ContextConfiguration(classes = { BasyxSearchApiDelegate.class, BasyxRegistryApiDelegate.class, SearchApiController.class, ShellDescriptorsApiController.class, InMemoryAasStorageConfiguration.class }) @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) @TestPropertySource(properties = { "registry.type=inMemory" }) public class BasyxRegistryApiDelegateTest { @@ -92,11 +86,10 @@ public class BasyxRegistryApiDelegateTest { @MockBean private RegistryEventSink listener; - + @MockBean private LocationBuilder locationBuilder; - @Autowired private AasRegistryStorage storage; @@ -233,7 +226,7 @@ public void whenPostAssetAdministrationShellDescriptorById_thenCreated() throws @Test public void whenPostSubmodelDescriptorDescriptorById_thenNoContent() throws IOException { AssetAdministrationShellDescriptor descr = new AssetAdministrationShellDescriptor(ID_2); - assertThat(aasController.putAssetAdministrationShellDescriptorById(encode(ID_2), descr).getStatusCode()).isEqualByComparingTo(HttpStatus.NO_CONTENT); + assertThat(aasController.putAssetAdministrationShellDescriptorById(encode(ID_2), descr).getStatusCode()).isEqualTo(HttpStatusCode.valueOf(HttpStatus.NO_CONTENT.value())); SubmodelDescriptor input = new SubmodelDescriptor(ID_2_3, List.of()); ResponseEntity response = aasController.postSubmodelDescriptorThroughSuperpath(encode(ID_2), input); assertThat(response.getStatusCode()).isEqualTo(HttpStatus.CREATED); @@ -315,8 +308,8 @@ public void whenRegexSearchForAasDescriptor_thenReturnResult() { assertThat(result.size()).isEqualTo(1); assertThat(result.get(0)).isEqualTo(input); } - + private byte[] encode(String id) { return Base64.getUrlEncoder().encode(id.getBytes(StandardCharsets.UTF_8)); } -} \ No newline at end of file +} diff --git a/basyx.aasregistry/basyx.aasregistry-service-kafka-events/pom.xml b/basyx.aasregistry/basyx.aasregistry-service-kafka-events/pom.xml index 54c4de520..c5b7c5b65 100644 --- a/basyx.aasregistry/basyx.aasregistry-service-kafka-events/pom.xml +++ b/basyx.aasregistry/basyx.aasregistry-service-kafka-events/pom.xml @@ -7,7 +7,7 @@ org.eclipse.digitaltwin.basyx basyx.aasregistry ${revision} - .. + basyx.aasregistry-service-kafka-events @@ -52,4 +52,4 @@ - \ No newline at end of file + diff --git a/basyx.aasregistry/basyx.aasregistry-service-mongodb-storage/pom.xml b/basyx.aasregistry/basyx.aasregistry-service-mongodb-storage/pom.xml index fdb7c35a4..c9c7c793e 100644 --- a/basyx.aasregistry/basyx.aasregistry-service-mongodb-storage/pom.xml +++ b/basyx.aasregistry/basyx.aasregistry-service-mongodb-storage/pom.xml @@ -7,7 +7,6 @@ org.eclipse.digitaltwin.basyx basyx.aasregistry ${revision} - .. basyx.aasregistry-service-mongodb-storage @@ -17,7 +16,8 @@ 2020.0.4 ${project.basedir}/${openapi.folder.name} ${openapi.folder}/${openapi.mongodb.file.name} - ${openapi.folder}/temporary-extensions-result-file.yaml + ${openapi.folder}/temporary-extensions-result-file.yaml + ${openapi.folder}/${openapi.name} patch-mongodb-annotations.yaml @@ -46,7 +46,7 @@ - + de.dfki.cos.basys.common jsonpatch-maven-plugin @@ -109,6 +109,7 @@ org.eclipse.digitaltwin.basyx.aasregistry.service org.eclipse.digitaltwin.basyx.aasregistry.model true + true @@ -144,17 +145,13 @@ - javax.validation - validation-api + jakarta.validation + jakarta.validation-api org.springframework.boot spring-boot-starter-validation - - javax.xml.bind - jaxb-api - com.google.guava guava @@ -163,6 +160,10 @@ org.eclipse.digitaltwin.basyx basyx.aasregistry-service + + org.eclipse.digitaltwin.basyx + basyx.aasregistry-service-basemodel + org.eclipse.digitaltwin.basyx basyx.aasregistry-paths diff --git a/basyx.aasregistry/basyx.aasregistry-service-mongodb-storage/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/mongodb/MongoDbAasRegistryStorage.java b/basyx.aasregistry/basyx.aasregistry-service-mongodb-storage/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/mongodb/MongoDbAasRegistryStorage.java index df50917e2..ebee38d43 100644 --- a/basyx.aasregistry/basyx.aasregistry-service-mongodb-storage/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/mongodb/MongoDbAasRegistryStorage.java +++ b/basyx.aasregistry/basyx.aasregistry-service-mongodb-storage/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/mongodb/MongoDbAasRegistryStorage.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 DFKI GmbH (https://www.dfki.de/en/web) - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,11 +19,13 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.aasregistry.service.storage.mongodb; +import com.mongodb.ClientSessionOptions; +import jakarta.validation.Valid; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -32,9 +34,8 @@ import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; - -import javax.validation.Valid; - +import lombok.NonNull; +import lombok.RequiredArgsConstructor; import org.eclipse.digitaltwin.basyx.aasregistry.model.AssetAdministrationShellDescriptor; import org.eclipse.digitaltwin.basyx.aasregistry.model.AssetKind; import org.eclipse.digitaltwin.basyx.aasregistry.model.ShellDescriptorQuery; @@ -62,19 +63,12 @@ import org.springframework.data.mongodb.core.aggregation.ArrayOperators; import org.springframework.data.mongodb.core.aggregation.ComparisonOperators; import org.springframework.data.mongodb.core.aggregation.MatchOperation; -import org.springframework.data.mongodb.core.aggregation.SetOperation; import org.springframework.data.mongodb.core.aggregation.SortOperation; import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Update; import org.springframework.data.mongodb.core.query.UpdateDefinition; -import com.mongodb.ClientSessionOptions; -import com.mongodb.internal.operation.UpdateOperation; - -import lombok.NonNull; -import lombok.RequiredArgsConstructor; - @RequiredArgsConstructor public class MongoDbAasRegistryStorage implements AasRegistryStorage { @@ -88,7 +82,7 @@ public class MongoDbAasRegistryStorage implements AasRegistryStorage { private static final String ASSET_KIND = "assetKind"; private final MongoTemplate template; - + @Override public CursorResult> getAllAasDescriptors(@NonNull PaginationInfo pRequest, @NonNull DescriptorFilter filter) { List allAggregations = new LinkedList<>(); @@ -127,7 +121,7 @@ private void applyFilter(DescriptorFilter filter, List all Optional filterCriteria = createFilterCriteria(filter); filterCriteria.map(Aggregation::match).ifPresent(allAggregations::add); } - + public Optional createFilterCriteria(DescriptorFilter filter) { if (!filter.isFiltered()) { return Optional.empty(); @@ -276,7 +270,7 @@ private void assertReplacePerformed(AssetAdministrationShellDescriptor descr, St public void removeSubmodel(@NonNull String aasDescriptorId, @NonNull String submodelId) throws AasDescriptorNotFoundException, SubmodelNotFoundException { AggregationExpression notEquals = ComparisonOperators.valueOf(SUBMODEL_DESCRIPTORS_ID).notEqualToValue(submodelId); AggregationExpression filterArray = ArrayOperators.arrayOf(SUBMODEL_DESCRIPTORS).filter().as(SUBMODEL_DESCRIPTORS).by(notEquals); - AggregationUpdate update = AggregationUpdate.update().set(SUBMODEL_DESCRIPTORS).toValue(filterArray); + AggregationUpdate update = AggregationUpdate.update().set(SUBMODEL_DESCRIPTORS).toValue(filterArray); AssetAdministrationShellDescriptor old = template.findAndModify(Query.query(Criteria.where(ID).is(aasDescriptorId)), update, AssetAdministrationShellDescriptor.class); if (old == null) { throw new AasDescriptorNotFoundException(submodelId); @@ -314,7 +308,7 @@ public ShellDescriptorSearchResponse searchAasDescriptors(@NonNull ShellDescript ShellDescriptorQuery dQuery = request.getQuery(); GroupedQueries grouped = ShellDescriptorSearchRequests.groupQueries(dQuery); Criteria mongoCriteria = qBuilder.buildCriteria(grouped); - + long total = template.count(Query.query(mongoCriteria), AssetAdministrationShellDescriptor.class); List aggregationOps = new LinkedList<>(); @@ -330,4 +324,4 @@ public ShellDescriptorSearchResponse searchAasDescriptors(@NonNull ShellDescript List descriptors = results.getMappedResults(); return new ShellDescriptorSearchResponse(total, descriptors); } -} \ No newline at end of file +} diff --git a/basyx.aasregistry/basyx.aasregistry-service-mongodb-storage/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/mongodb/SearchQueryBuilder.java b/basyx.aasregistry/basyx.aasregistry-service-mongodb-storage/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/mongodb/SearchQueryBuilder.java index 805c96786..ed50da108 100644 --- a/basyx.aasregistry/basyx.aasregistry-service-mongodb-storage/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/mongodb/SearchQueryBuilder.java +++ b/basyx.aasregistry/basyx.aasregistry-service-mongodb-storage/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/mongodb/SearchQueryBuilder.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 DFKI GmbH (https://www.dfki.de/en/web) - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,19 +19,17 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.aasregistry.service.storage.mongodb; +import jakarta.validation.Valid; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; - -import javax.validation.Valid; - import org.eclipse.digitaltwin.basyx.aasregistry.model.AssetAdministrationShellDescriptor; import org.eclipse.digitaltwin.basyx.aasregistry.model.Page; import org.eclipse.digitaltwin.basyx.aasregistry.model.ShellDescriptorQuery; @@ -152,4 +150,4 @@ public void withProjection(List submodelQueries, Listorg.eclipse.digitaltwin.basyx basyx.aasregistry ${revision} - .. + basyx.aasregistry-service-release-kafka-mem @@ -57,4 +57,4 @@ test - \ No newline at end of file + diff --git a/basyx.aasregistry/basyx.aasregistry-service-release-kafka-mem/src/main/docker/Dockerfile b/basyx.aasregistry/basyx.aasregistry-service-release-kafka-mem/src/main/docker/Dockerfile index 3885885ec..d2f18bda8 100644 --- a/basyx.aasregistry/basyx.aasregistry-service-release-kafka-mem/src/main/docker/Dockerfile +++ b/basyx.aasregistry/basyx.aasregistry-service-release-kafka-mem/src/main/docker/Dockerfile @@ -1,8 +1,8 @@ -FROM amazoncorretto:11.0.20-alpine3.18 as builder +FROM amazoncorretto:17.0.8-alpine3.18 as builder COPY maven/${project.build.finalName}.jar ./ RUN java -Djarmode=layertools -jar ${project.build.finalName}.jar extract -FROM amazoncorretto:11.0.20-alpine3.18 +FROM amazoncorretto:17.0.8-alpine3.18 RUN mkdir /workspace WORKDIR /workspace COPY --from=builder dependencies/ ./ diff --git a/basyx.aasregistry/basyx.aasregistry-service-release-kafka-mongodb/pom.xml b/basyx.aasregistry/basyx.aasregistry-service-release-kafka-mongodb/pom.xml index 7d90be211..8636a00e5 100644 --- a/basyx.aasregistry/basyx.aasregistry-service-release-kafka-mongodb/pom.xml +++ b/basyx.aasregistry/basyx.aasregistry-service-release-kafka-mongodb/pom.xml @@ -7,7 +7,7 @@ org.eclipse.digitaltwin.basyx basyx.aasregistry ${revision} - .. + basyx.aasregistry-service-release-kafka-mongodb @@ -51,4 +51,4 @@ test - \ No newline at end of file + diff --git a/basyx.aasregistry/basyx.aasregistry-service-release-kafka-mongodb/src/main/docker/Dockerfile b/basyx.aasregistry/basyx.aasregistry-service-release-kafka-mongodb/src/main/docker/Dockerfile index a1109eddc..2c473daf5 100644 --- a/basyx.aasregistry/basyx.aasregistry-service-release-kafka-mongodb/src/main/docker/Dockerfile +++ b/basyx.aasregistry/basyx.aasregistry-service-release-kafka-mongodb/src/main/docker/Dockerfile @@ -1,8 +1,8 @@ -FROM amazoncorretto:11.0.20-alpine3.18 as builder +FROM amazoncorretto:17.0.8-alpine3.18 as builder COPY maven/${project.build.finalName}.jar ./ RUN java -Djarmode=layertools -jar ${project.build.finalName}.jar extract -FROM amazoncorretto:11.0.20-alpine3.18 +FROM amazoncorretto:17.0.8-alpine3.18 RUN mkdir /workspace WORKDIR /workspace COPY --from=builder dependencies/ ./ diff --git a/basyx.aasregistry/basyx.aasregistry-service-release-log-mem/pom.xml b/basyx.aasregistry/basyx.aasregistry-service-release-log-mem/pom.xml index 9965c7d3c..b0ad5e554 100644 --- a/basyx.aasregistry/basyx.aasregistry-service-release-log-mem/pom.xml +++ b/basyx.aasregistry/basyx.aasregistry-service-release-log-mem/pom.xml @@ -7,7 +7,7 @@ org.eclipse.digitaltwin.basyx basyx.aasregistry ${revision} - .. + basyx.aasregistry-service-release-log-mem @@ -52,4 +52,4 @@ test - \ No newline at end of file + diff --git a/basyx.aasregistry/basyx.aasregistry-service-release-log-mem/src/main/docker/Dockerfile b/basyx.aasregistry/basyx.aasregistry-service-release-log-mem/src/main/docker/Dockerfile index 1cca6627b..0f007a16d 100644 --- a/basyx.aasregistry/basyx.aasregistry-service-release-log-mem/src/main/docker/Dockerfile +++ b/basyx.aasregistry/basyx.aasregistry-service-release-log-mem/src/main/docker/Dockerfile @@ -1,8 +1,8 @@ -FROM amazoncorretto:11.0.20-alpine3.18 as builder +FROM amazoncorretto:17.0.8-alpine3.18 as builder COPY maven/${project.build.finalName}.jar ./ RUN java -Djarmode=layertools -jar ${project.build.finalName}.jar extract -FROM amazoncorretto:11.0.20-alpine3.18 +FROM amazoncorretto:17.0.8-alpine3.18 RUN mkdir /workspace WORKDIR /workspace COPY --from=builder dependencies/ ./ diff --git a/basyx.aasregistry/basyx.aasregistry-service-release-log-mongodb/pom.xml b/basyx.aasregistry/basyx.aasregistry-service-release-log-mongodb/pom.xml index 0197882a9..8c240fe47 100644 --- a/basyx.aasregistry/basyx.aasregistry-service-release-log-mongodb/pom.xml +++ b/basyx.aasregistry/basyx.aasregistry-service-release-log-mongodb/pom.xml @@ -7,7 +7,7 @@ org.eclipse.digitaltwin.basyx basyx.aasregistry ${revision} - .. + basyx.aasregistry-service-release-log-mongodb @@ -44,4 +44,4 @@ - \ No newline at end of file + diff --git a/basyx.aasregistry/basyx.aasregistry-service-release-log-mongodb/src/main/docker/Dockerfile b/basyx.aasregistry/basyx.aasregistry-service-release-log-mongodb/src/main/docker/Dockerfile index fc39fee0a..cfe5b3b39 100644 --- a/basyx.aasregistry/basyx.aasregistry-service-release-log-mongodb/src/main/docker/Dockerfile +++ b/basyx.aasregistry/basyx.aasregistry-service-release-log-mongodb/src/main/docker/Dockerfile @@ -1,8 +1,8 @@ -FROM amazoncorretto:11.0.20-alpine3.18 as builder +FROM amazoncorretto:17.0.8-alpine3.18 as builder COPY maven/${project.build.finalName}.jar ./ RUN java -Djarmode=layertools -jar ${project.build.finalName}.jar extract -FROM amazoncorretto:11.0.20-alpine3.18 +FROM amazoncorretto:17.0.8-alpine3.18 RUN mkdir /workspace WORKDIR /workspace COPY --from=builder dependencies/ ./ diff --git a/basyx.aasregistry/basyx.aasregistry-service/pom.xml b/basyx.aasregistry/basyx.aasregistry-service/pom.xml index f6f4f6498..eabd8acee 100644 --- a/basyx.aasregistry/basyx.aasregistry-service/pom.xml +++ b/basyx.aasregistry/basyx.aasregistry-service/pom.xml @@ -7,7 +7,6 @@ org.eclipse.digitaltwin.basyx basyx.aasregistry ${revision} - .. basyx.aasregistry-service @@ -109,6 +108,7 @@ org.eclipse.digitaltwin.basyx.aasregistry.model true springdoc + true @@ -132,25 +132,16 @@ org.springdoc - springdoc-openapi-webmvc-core - 1.7.0 + springdoc-openapi-starter-webmvc-ui - org.springdoc - springdoc-openapi-ui - - - javax.validation - validation-api + jakarta.validation + jakarta.validation-api org.springframework.boot spring-boot-starter-validation - - javax.xml.bind - jaxb-api - org.springframework.boot spring-boot-starter-actuator @@ -175,7 +166,7 @@ org.eclipse.digitaltwin.basyx basyx.core - + diff --git a/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/api/BasyxRegistryApiDelegate.java b/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/api/BasyxRegistryApiDelegate.java index 25f86d647..0072ce210 100644 --- a/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/api/BasyxRegistryApiDelegate.java +++ b/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/api/BasyxRegistryApiDelegate.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 DFKI GmbH (https://www.dfki.de/en/web) - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,16 +19,14 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.aasregistry.service.api; +import jakarta.validation.Valid; import java.net.URI; import java.util.List; - -import javax.validation.Valid; - import org.eclipse.digitaltwin.basyx.aasregistry.model.AssetAdministrationShellDescriptor; import org.eclipse.digitaltwin.basyx.aasregistry.model.AssetKind; import org.eclipse.digitaltwin.basyx.aasregistry.model.GetAssetAdministrationShellDescriptorsResult; @@ -49,7 +47,7 @@ public class BasyxRegistryApiDelegate implements ShellDescriptorsApiDelegate { private final AasRegistryStorage storage; - + private final LocationBuilder locationBuilder; public BasyxRegistryApiDelegate(AasRegistryStorage storage, RegistryEventSink eventSink, LocationBuilder builder) { @@ -86,11 +84,11 @@ public ResponseEntity getAllAssetA public ResponseEntity getAllSubmodelDescriptorsThroughSuperpath(String aasIdentifier, Integer limit, String cursor) { PaginationInfo pInfo = new PaginationInfo(limit, cursor); CursorResult> allSubmodels = storage.getAllSubmodels(aasIdentifier, pInfo); - + GetSubmodelDescriptorsResult result = new GetSubmodelDescriptorsResult(); result.setPagingMetadata(resolvePagingMeta(allSubmodels)); result.setResult(allSubmodels.getResult()); - + return new ResponseEntity<>(result, HttpStatus.OK); } @@ -109,7 +107,7 @@ public ResponseEntity getSubmodelDescriptorByIdThroughSuperp @Override public ResponseEntity postSubmodelDescriptorThroughSuperpath(String aasIdentifier, SubmodelDescriptor body) { storage.insertSubmodel(aasIdentifier, body); - URI location = locationBuilder.getSubmodelLocation(aasIdentifier, body.getId()); + URI location = locationBuilder.getSubmodelLocation(aasIdentifier, body.getId()); return ResponseEntity.created(location).body(body); } @@ -143,4 +141,4 @@ private PagedResultPagingMetadata resolvePagingMeta(CursorResult result) meta.setCursor(result.getCursor()); return meta; } -} \ No newline at end of file +} diff --git a/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/configuration/ServletHeaderConfiguration.java b/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/configuration/ServletHeaderConfiguration.java index b0bec9070..bc5f4893d 100644 --- a/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/configuration/ServletHeaderConfiguration.java +++ b/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/configuration/ServletHeaderConfiguration.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 DFKI GmbH (https://www.dfki.de/en/web) - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,34 +19,31 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.aasregistry.service.configuration; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - +import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.util.AntPathMatcher; -import lombok.Data; - @Configuration @lombok.Data @ConfigurationProperties(prefix = "servlet") @@ -154,4 +151,4 @@ public static final class HeaderDefinition { private String[] methods; } -} \ No newline at end of file +} diff --git a/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/errors/BasyxControllerAdvice.java b/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/errors/BasyxControllerAdvice.java index 74bc72122..af97f8831 100644 --- a/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/errors/BasyxControllerAdvice.java +++ b/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/errors/BasyxControllerAdvice.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 DFKI GmbH (https://www.dfki.de/en/web) - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,13 +19,12 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.aasregistry.service.errors; import java.time.OffsetDateTime; - import org.eclipse.digitaltwin.basyx.aasregistry.model.Message; import org.eclipse.digitaltwin.basyx.aasregistry.model.Message.MessageTypeEnum; import org.eclipse.digitaltwin.basyx.aasregistry.model.Result; @@ -53,9 +52,9 @@ public ResponseEntity handleValidationException(MethodArgumentNotValidEx @ExceptionHandler(ResponseStatusException.class) public ResponseEntity handleExceptions(ResponseStatusException ex) { - return newResultEntity(ex, ex.getStatus()); + return newResultEntity(ex, HttpStatus.valueOf(ex.getStatusCode().value())); } - + @ExceptionHandler(Exception.class) public ResponseEntity handleExceptions(Exception ex) { return newResultEntity(ex, HttpStatus.INTERNAL_SERVER_ERROR); @@ -76,4 +75,4 @@ private Message newExceptionMessage(String msg, HttpStatus status) { message.setText(msg); return message; } -} \ No newline at end of file +} diff --git a/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/events/RegistryEvent.java b/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/events/RegistryEvent.java index f03be7a07..9b542861b 100644 --- a/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/events/RegistryEvent.java +++ b/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/events/RegistryEvent.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 DFKI GmbH (https://www.dfki.de/en/web) - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,20 +19,18 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.aasregistry.service.events; -import javax.annotation.Nullable; - -import org.eclipse.digitaltwin.basyx.aasregistry.model.AssetAdministrationShellDescriptor; -import org.eclipse.digitaltwin.basyx.aasregistry.model.SubmodelDescriptor; - +import jakarta.annotation.Nullable; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import org.eclipse.digitaltwin.basyx.aasregistry.model.AssetAdministrationShellDescriptor; +import org.eclipse.digitaltwin.basyx.aasregistry.model.SubmodelDescriptor; @Data @Builder diff --git a/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/AasRegistryStorage.java b/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/AasRegistryStorage.java index 21a090f4f..9165f82a4 100644 --- a/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/AasRegistryStorage.java +++ b/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/AasRegistryStorage.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 DFKI GmbH (https://www.dfki.de/en/web) - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,16 +19,15 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.aasregistry.service.storage; +import jakarta.validation.Valid; import java.util.List; import java.util.Set; - -import javax.validation.Valid; - +import lombok.NonNull; import org.eclipse.digitaltwin.basyx.aasregistry.model.AssetAdministrationShellDescriptor; import org.eclipse.digitaltwin.basyx.aasregistry.model.ShellDescriptorSearchRequest; import org.eclipse.digitaltwin.basyx.aasregistry.model.ShellDescriptorSearchResponse; @@ -40,8 +39,6 @@ import org.eclipse.digitaltwin.basyx.core.pagination.CursorResult; import org.eclipse.digitaltwin.basyx.core.pagination.PaginationInfo; -import lombok.NonNull; - public interface AasRegistryStorage { CursorResult> getAllAasDescriptors(@NonNull PaginationInfo pRequest, @NonNull DescriptorFilter filter); @@ -49,19 +46,19 @@ public interface AasRegistryStorage { AssetAdministrationShellDescriptor getAasDescriptor(@NonNull String aasDescriptorId) throws AasDescriptorNotFoundException; void insertAasDescriptor(@Valid AssetAdministrationShellDescriptor descr) throws AasDescriptorAlreadyExistsException; - + void replaceAasDescriptor(@NonNull String aasDescriptorId, @NonNull AssetAdministrationShellDescriptor descriptor) throws AasDescriptorNotFoundException; void removeAasDescriptor(@NonNull String aasDescriptorId) throws AasDescriptorNotFoundException; - CursorResult> getAllSubmodels(@NonNull String aasDescriptorId,@NonNull PaginationInfo pRequest) throws AasDescriptorNotFoundException; + CursorResult> getAllSubmodels(@NonNull String aasDescriptorId, @NonNull PaginationInfo pRequest) throws AasDescriptorNotFoundException; SubmodelDescriptor getSubmodel(@NonNull String aasDescriptorId, @NonNull String submodelId) throws AasDescriptorNotFoundException, SubmodelNotFoundException; void insertSubmodel(@NonNull String aasDescriptorId, @NonNull SubmodelDescriptor submodel) throws AasDescriptorNotFoundException, SubmodelAlreadyExistsException; void replaceSubmodel(@NonNull String aasDescriptorId, @NonNull String submodelId, @NonNull SubmodelDescriptor submodel) throws AasDescriptorNotFoundException, SubmodelNotFoundException; - + void removeSubmodel(@NonNull String aasDescriptorId, @NonNull String submodelId) throws AasDescriptorNotFoundException, SubmodelNotFoundException; Set clear(); diff --git a/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/AasRegistryStorageDelegate.java b/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/AasRegistryStorageDelegate.java index f36c1656e..62a74a063 100644 --- a/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/AasRegistryStorageDelegate.java +++ b/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/AasRegistryStorageDelegate.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 DFKI GmbH (https://www.dfki.de/en/web) - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,16 +19,15 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.aasregistry.service.storage; +import jakarta.validation.Valid; import java.util.List; import java.util.Set; - -import javax.validation.Valid; - +import lombok.NonNull; import org.eclipse.digitaltwin.basyx.aasregistry.model.AssetAdministrationShellDescriptor; import org.eclipse.digitaltwin.basyx.aasregistry.model.ShellDescriptorSearchRequest; import org.eclipse.digitaltwin.basyx.aasregistry.model.ShellDescriptorSearchResponse; @@ -40,14 +39,10 @@ import org.eclipse.digitaltwin.basyx.core.pagination.CursorResult; import org.eclipse.digitaltwin.basyx.core.pagination.PaginationInfo; -import lombok.NonNull; -import lombok.RequiredArgsConstructor; - - public abstract class AasRegistryStorageDelegate implements AasRegistryStorage { protected final AasRegistryStorage storage; - + public AasRegistryStorageDelegate(AasRegistryStorage storage) { this.storage = storage; } @@ -111,4 +106,4 @@ public Set clear() { public ShellDescriptorSearchResponse searchAasDescriptors(@NonNull ShellDescriptorSearchRequest request) { return storage.searchAasDescriptors(request); } -} \ No newline at end of file +} diff --git a/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/RegistrationEventSendingAasRegistryStorage.java b/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/RegistrationEventSendingAasRegistryStorage.java index b857a338f..59eb973ca 100644 --- a/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/RegistrationEventSendingAasRegistryStorage.java +++ b/basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/storage/RegistrationEventSendingAasRegistryStorage.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 DFKI GmbH (https://www.dfki.de/en/web) - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,15 +19,14 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.aasregistry.service.storage; +import jakarta.validation.Valid; import java.util.Set; - -import javax.validation.Valid; - +import lombok.NonNull; import org.eclipse.digitaltwin.basyx.aasregistry.model.AssetAdministrationShellDescriptor; import org.eclipse.digitaltwin.basyx.aasregistry.model.SubmodelDescriptor; import org.eclipse.digitaltwin.basyx.aasregistry.service.errors.AasDescriptorAlreadyExistsException; @@ -37,13 +36,11 @@ import org.eclipse.digitaltwin.basyx.aasregistry.service.events.RegistryEvent.EventType; import org.eclipse.digitaltwin.basyx.aasregistry.service.events.RegistryEventSink; -import lombok.NonNull; - public class RegistrationEventSendingAasRegistryStorage extends AasRegistryStorageDelegate { @NonNull private final RegistryEventSink eventSink; - + public RegistrationEventSendingAasRegistryStorage(AasRegistryStorage storage, RegistryEventSink eventSink) { super(storage); this.eventSink = eventSink; @@ -53,7 +50,7 @@ public RegistrationEventSendingAasRegistryStorage(AasRegistryStorage storage, Re public void replaceAasDescriptor(@NonNull String aasDescriptorId, @NonNull AssetAdministrationShellDescriptor descriptor) throws AasDescriptorNotFoundException { storage.replaceAasDescriptor(aasDescriptorId, descriptor); if (!aasDescriptorId.equals(descriptor.getId())) { - aasDescriptorUnregistered(aasDescriptorId); + aasDescriptorUnregistered(aasDescriptorId); } aasDescriptorRegistered(descriptor); } @@ -101,7 +98,7 @@ public Set clear() { } return unregistredDescriptors; } - + private void aasDescriptorRegistered(@NonNull AssetAdministrationShellDescriptor descriptor) { RegistryEvent evt = RegistryEvent.builder().id(descriptor.getId()).type(RegistryEvent.EventType.AAS_REGISTERED).aasDescriptor(descriptor).build(); eventSink.consumeEvent(evt); @@ -111,7 +108,7 @@ private void aasDescriptorUnregistered(String aasDescriptorId) { RegistryEvent evt = RegistryEvent.builder().id(aasDescriptorId).type(RegistryEvent.EventType.AAS_UNREGISTERED).build(); eventSink.consumeEvent(evt); } - + private void submodelRegistered(@NonNull String aasDescriptorId, @NonNull SubmodelDescriptor submodel) { RegistryEvent evt = RegistryEvent.builder().id(aasDescriptorId).submodelId(submodel.getId()).type(RegistryEvent.EventType.SUBMODEL_REGISTERED).submodelDescriptor(submodel).build(); eventSink.consumeEvent(evt); @@ -121,4 +118,4 @@ private void submodelUnregistered(@NonNull String aasDescriptorId, @NonNull Stri RegistryEvent evt = RegistryEvent.builder().id(aasDescriptorId).submodelId(submodelId).type(RegistryEvent.EventType.SUBMODEL_UNREGISTERED).build(); eventSink.consumeEvent(evt); } -} \ No newline at end of file +} diff --git a/basyx.aasregistry/basyx.aasregistry-service/src/test/java/org/eclipse/digitaltwin/basyx/aasregistry/service/tests/FilterTest.java b/basyx.aasregistry/basyx.aasregistry-service/src/test/java/org/eclipse/digitaltwin/basyx/aasregistry/service/tests/FilterTest.java index d37fb623e..be18266d3 100644 --- a/basyx.aasregistry/basyx.aasregistry-service/src/test/java/org/eclipse/digitaltwin/basyx/aasregistry/service/tests/FilterTest.java +++ b/basyx.aasregistry/basyx.aasregistry-service/src/test/java/org/eclipse/digitaltwin/basyx/aasregistry/service/tests/FilterTest.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 DFKI GmbH (https://www.dfki.de/en/web) - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,23 +19,21 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.aasregistry.service.tests; import static org.assertj.core.api.Assertions.assertThat; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; import java.util.Map; - -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.eclipse.digitaltwin.basyx.aasregistry.service.configuration.ServletHeaderConfiguration.HeaderDefinition; import org.eclipse.digitaltwin.basyx.aasregistry.service.configuration.ServletHeaderConfiguration.MappingsHeaderApplier; import org.junit.jupiter.api.Test; diff --git a/basyx.aasregistry/docker-compose/build-images.sh b/basyx.aasregistry/docker-compose/build-images.sh index ddfa72baf..f5b27759c 100644 --- a/basyx.aasregistry/docker-compose/build-images.sh +++ b/basyx.aasregistry/docker-compose/build-images.sh @@ -4,8 +4,9 @@ trap 'cd $OLD_WORK_DIR' EXIT cd $(dirname "${BASH_SOURCE[0]}")/.. -MAVEN_OPS='-Xmx2048 -Xms1024' mvn clean install -DskipTests -Ddocker.username=aas-registry-test -Ddocker.password="" +MAVEN_OPS='-Xmx2048 -Xms1024' mvn clean install -DskipTests -Ddocker.namespace=aas-registry-test -Ddocker.password="" +read -p "Press any key to continue... " -n1 -s cd $OLD_WORK_DIR diff --git a/basyx.aasregistry/pom.xml b/basyx.aasregistry/pom.xml index 6f4cbb7ba..d20c24047 100644 --- a/basyx.aasregistry/pom.xml +++ b/basyx.aasregistry/pom.xml @@ -23,14 +23,15 @@ 3.0.42 3.0.0 open-api - Plattform_i40-AssetAdministrationShellRegistryServiceSpecification-V3.0.1_SSP-001-resolved.yaml + Plattform_i40-AssetAdministrationShellRegistryServiceSpecification-V3.0.1_SSP-001-resolved.yaml + Plattform_i40-Registry-and-Discovery.yaml 31.0.1-jre 3.6.0 3.0-alpha-2 0.9.4 - 1.30 - 0.40.1 + 2.2 + 0.43.4 ${project.artifactId} docker.io linux/amd64,linux/arm64 @@ -49,13 +50,13 @@ basyx.aasregistry-paths basyx.aasregistry-service basyx.aasregistry-service-basetests - basyx.aasregistry-service-kafka-events + basyx.aasregistry-service-inmemory-storage basyx.aasregistry-service-mongodb-storage basyx.aasregistry-service-release-log-mem basyx.aasregistry-service-release-log-mongodb - basyx.aasregistry-service-release-kafka-mem - basyx.aasregistry-service-release-kafka-mongodb + + @@ -94,7 +95,8 @@ ${swagger.codegen.version} - + org.openapitools openapi-generator-maven-plugin ${openapitools.version} @@ -257,13 +259,13 @@ dockerbuild - + src/main/docker/Dockerfile - docker.username + docker.namespace @@ -298,7 +300,7 @@ - ${docker.username}/${docker.image.name} + ${docker.namespace}/${docker.image.name} artifact @@ -309,6 +311,7 @@ Dockerfile ${project.basedir}/src/main/docker + true @@ -324,7 +327,7 @@ - ${docker.username}/${docker.image.name} + ${docker.namespace}/${docker.image.name} https://index.docker.io/v1/ @@ -338,7 +341,11 @@ ${project.basedir}/src/main/docker ${docker.target.platforms} + + ${docker.provenance} + + true @@ -350,4 +357,4 @@ - \ No newline at end of file + diff --git a/basyx.aasrepository/basyx.aasrepository-backend-mongodb/pom.xml b/basyx.aasrepository/basyx.aasrepository-backend-mongodb/pom.xml index 74a6aaf8d..c50464d2a 100644 --- a/basyx.aasrepository/basyx.aasrepository-backend-mongodb/pom.xml +++ b/basyx.aasrepository/basyx.aasrepository-backend-mongodb/pom.xml @@ -1,5 +1,6 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 @@ -43,11 +44,11 @@ org.springframework.boot - spring-boot-starter + spring-boot-starter-data-mongodb - org.springframework.boot - spring-boot-starter-data-mongodb + commons-io + commons-io - \ No newline at end of file + diff --git a/basyx.aasrepository/basyx.aasrepository-http/pom.xml b/basyx.aasrepository/basyx.aasrepository-http/pom.xml index 9f4d9215c..a99116b4e 100644 --- a/basyx.aasrepository/basyx.aasrepository-http/pom.xml +++ b/basyx.aasrepository/basyx.aasrepository-http/pom.xml @@ -47,11 +47,11 @@ org.springdoc - springdoc-openapi-ui + springdoc-openapi-starter-webmvc-ui - javax.validation - validation-api + jakarta.validation + jakarta.validation-api org.eclipse.digitaltwin.aas4j @@ -68,4 +68,4 @@ test - \ No newline at end of file + diff --git a/basyx.aasrepository/basyx.aasrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/http/AasRepositoryApiHTTPController.java b/basyx.aasrepository/basyx.aasrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/http/AasRepositoryApiHTTPController.java index b45989dce..7268cab43 100644 --- a/basyx.aasrepository/basyx.aasrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/http/AasRepositoryApiHTTPController.java +++ b/basyx.aasrepository/basyx.aasrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/http/AasRepositoryApiHTTPController.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 the Eclipse BaSyx Authors - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,17 +19,18 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.aasrepository.http; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Min; import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.Min; - import org.eclipse.digitaltwin.aas4j.v3.model.AssetAdministrationShell; import org.eclipse.digitaltwin.aas4j.v3.model.AssetInformation; import org.eclipse.digitaltwin.aas4j.v3.model.Reference; @@ -50,13 +51,10 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.enums.ParameterIn; -import io.swagger.v3.oas.annotations.media.Schema; - -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2022-01-10T15:59:05.892Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2022-01-10T15:59:05.892Z[GMT]") @RestController public class AasRepositoryApiHTTPController implements AasRepositoryHTTPApi { + private final AasRepository aasRepository; @Autowired @@ -100,21 +98,22 @@ public ResponseEntity deleteSubmodelReferenceByIdAasRepository(Base64UrlEn @Override public ResponseEntity getAllAssetAdministrationShells(@Valid List assetIds, @Valid String idShort, @Min(1) @Valid Integer limit, @Valid Base64UrlEncodedCursor cursor) { - if (limit == null) + if (limit == null) { limit = 100; - + } + String decodedCursor = ""; - if (cursor != null) + if (cursor != null) { decodedCursor = cursor.getDecodedCursor(); + } PaginationInfo paginationInfo = new PaginationInfo(limit, decodedCursor); CursorResult> paginatedAAS = aasRepository.getAllAas(paginationInfo); - GetAssetAdministrationShellsResult result = new GetAssetAdministrationShellsResult(); - + String encodedCursor = getEncodedCursorFromCursorResult(paginatedAAS); - + result.setResult(paginatedAAS.getResult()); result.setPagingMetadata(new PagedResultPagingMetadata().cursor(encodedCursor)); @@ -123,12 +122,14 @@ public ResponseEntity getAllAssetAdministrationShells(@Valid List getAllSubmodelReferencesAasRepository(Base64UrlEncodedIdentifier aasIdentifier, @Min(1) @Valid Integer limit, @Valid Base64UrlEncodedCursor cursor) { - if (limit == null) + if (limit == null) { limit = 100; + } String decodedCursor = ""; - if (cursor != null) + if (cursor != null) { decodedCursor = cursor.getDecodedCursor(); + } PaginationInfo paginationInfo = new PaginationInfo(limit, decodedCursor); CursorResult> submodelReferences = aasRepository.getSubmodelReferences(aasIdentifier.getIdentifier(), paginationInfo); @@ -161,8 +162,9 @@ public ResponseEntity putAssetInformationAasRepository(Base64UrlEncodedIde } private String getEncodedCursorFromCursorResult(CursorResult cursorResult) { - if (cursorResult == null || cursorResult.getCursor() == null) + if (cursorResult == null || cursorResult.getCursor() == null) { return null; + } return Base64UrlEncodedCursor.encodeCursor(cursorResult.getCursor()); } diff --git a/basyx.aasrepository/basyx.aasrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/http/AasRepositoryHTTPApi.java b/basyx.aasrepository/basyx.aasrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/http/AasRepositoryHTTPApi.java index 83c37ddff..8ed0b9616 100644 --- a/basyx.aasrepository/basyx.aasrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/http/AasRepositoryHTTPApi.java +++ b/basyx.aasrepository/basyx.aasrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/http/AasRepositoryHTTPApi.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 the Eclipse BaSyx Authors - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,7 +19,7 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ @@ -27,15 +27,20 @@ /** * NOTE: This class is auto generated by the swagger code generator program (3.0.29). - * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. + * https://github.com/swagger-api/swagger-codegen Do not edit the class manually. */ +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Min; import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.Min; - import org.eclipse.digitaltwin.aas4j.v3.model.AssetAdministrationShell; import org.eclipse.digitaltwin.aas4j.v3.model.AssetInformation; import org.eclipse.digitaltwin.aas4j.v3.model.Reference; @@ -54,16 +59,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.enums.ParameterIn; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; - -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2022-01-10T15:59:05.892Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2022-01-10T15:59:05.892Z[GMT]") @Validated public interface AasRepositoryHTTPApi { @@ -103,7 +99,8 @@ ResponseEntity deleteSubmodelReferenceByIdAasRepository( @Parameter(in = ParameterIn.PATH, description = "The Submodel’s unique id (UTF8-BASE64-URL-encoded)", required = true, schema = @Schema()) @PathVariable("submodelIdentifier") Base64UrlEncodedIdentifier submodelIdentifier); @Operation(summary = "Returns all Asset Administration Shells", description = "", tags = { "Asset Administration Shell Repository API" }) - @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Requested Asset Administration Shells", content = @Content(mediaType = "application/json", schema = @Schema(implementation = GetAssetAdministrationShellsResult.class))), + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Requested Asset Administration Shells", content = @Content(mediaType = "application/json", schema = @Schema(implementation = GetAssetAdministrationShellsResult.class))), @ApiResponse(responseCode = "400", description = "Bad Request, e.g. the request parameters of the format of the request body is wrong.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), @@ -123,7 +120,8 @@ ResponseEntity getAllAssetAdministrationShells( @Parameter(in = ParameterIn.QUERY, description = "A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue", schema = @Schema()) @Valid @RequestParam(value = "cursor", required = false) Base64UrlEncodedCursor cursor); @Operation(summary = "Returns all submodel references", description = "", tags = { "Asset Administration Shell Repository API" }) - @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Requested submodel references", content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GetReferencesResult.class)))), + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Requested submodel references", content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = GetReferencesResult.class)))), @ApiResponse(responseCode = "400", description = "Bad Request, e.g. the request parameters of the format of the request body is wrong.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), diff --git a/basyx.aasrepository/basyx.aasrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/http/pagination/GetAssetAdministrationShellsResult.java b/basyx.aasrepository/basyx.aasrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/http/pagination/GetAssetAdministrationShellsResult.java index f9e75cd75..f111756b8 100644 --- a/basyx.aasrepository/basyx.aasrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/http/pagination/GetAssetAdministrationShellsResult.java +++ b/basyx.aasrepository/basyx.aasrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/http/pagination/GetAssetAdministrationShellsResult.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 the Eclipse BaSyx Authors - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,31 +19,31 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.aasrepository.http.pagination; -import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; import java.util.ArrayList; import java.util.List; - +import java.util.Objects; import org.eclipse.digitaltwin.aas4j.v3.model.AssetAdministrationShell; import org.eclipse.digitaltwin.basyx.aasrepository.AasRepository; import org.eclipse.digitaltwin.basyx.http.pagination.PagedResult; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; /** * Paginated wrapper for {@link AasRepository#getAllAas()} */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-05-22T07:02:56.105163402Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-05-22T07:02:56.105163402Z[GMT]") public class GetAssetAdministrationShellsResult extends PagedResult { + @JsonProperty("result") @Valid private List result = null; @@ -63,7 +63,7 @@ public GetAssetAdministrationShellsResult addResultItem(AssetAdministrationShell /** * Get result - * + * * @return result **/ @Schema(description = "") diff --git a/basyx.aasrepository/basyx.aasrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/http/pagination/GetReferencesResult.java b/basyx.aasrepository/basyx.aasrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/http/pagination/GetReferencesResult.java index 9bc93c2b4..4e704bbae 100644 --- a/basyx.aasrepository/basyx.aasrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/http/pagination/GetReferencesResult.java +++ b/basyx.aasrepository/basyx.aasrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/http/pagination/GetReferencesResult.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 the Eclipse BaSyx Authors - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,31 +19,31 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.aasrepository.http.pagination; -import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; import java.util.ArrayList; import java.util.List; - +import java.util.Objects; import org.eclipse.digitaltwin.aas4j.v3.model.Reference; import org.eclipse.digitaltwin.basyx.aasrepository.AasRepository; import org.eclipse.digitaltwin.basyx.http.pagination.PagedResult; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; /** * Paginated wrapper for {@link AasRepository#getSubmodelReferences(String)} */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-05-22T07:02:56.105163402Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-05-22T07:02:56.105163402Z[GMT]") public class GetReferencesResult extends PagedResult { + @JsonProperty("result") @Valid private List result = null; @@ -63,7 +63,7 @@ public GetReferencesResult addResultItem(Reference resultItem) { /** * Get result - * + * * @return result **/ @Schema(description = "") diff --git a/basyx.aasrepository/basyx.aasrepository.component/Dockerfile b/basyx.aasrepository/basyx.aasrepository.component/Dockerfile index aae318acd..1c3e9648d 100644 --- a/basyx.aasrepository/basyx.aasrepository.component/Dockerfile +++ b/basyx.aasrepository/basyx.aasrepository.component/Dockerfile @@ -1,11 +1,11 @@ -FROM amazoncorretto:11 +FROM amazoncorretto:17 USER nobody WORKDIR /application ARG JAR_FILE=target/*-exec.jar COPY ${JAR_FILE} basyxExecutable.jar COPY src/main/resources/application.properties application.properties ARG PORT=8081 -ENV PORT=${PORT} -EXPOSE ${PORT} -HEALTHCHECK --interval=30s --timeout=3s --retries=3 --start-period=15s CMD curl --fail http://localhost:${PORT}/actuator/health || exit 1 +ENV SERVER_PORT=${PORT} +EXPOSE ${SERVER_PORT} +HEALTHCHECK --interval=30s --timeout=3s --retries=3 --start-period=15s CMD curl --fail http://localhost:${SERVER_PORT}/actuator/health || exit 1 ENTRYPOINT ["java","-jar","basyxExecutable.jar"] diff --git a/basyx.aasrepository/basyx.aasrepository.component/pom.xml b/basyx.aasrepository/basyx.aasrepository.component/pom.xml index eb586e7fb..41aef57ae 100644 --- a/basyx.aasrepository/basyx.aasrepository.component/pom.xml +++ b/basyx.aasrepository/basyx.aasrepository.component/pom.xml @@ -127,11 +127,11 @@ io.fabric8 docker-maven-plugin - 0.43.0 + 0.43.4 - ${docker.username}/${docker.image.name} + ${docker.namespace}/${docker.image.name} ${docker.image.tag} @@ -201,4 +201,4 @@ - \ No newline at end of file + diff --git a/basyx.aasxfileserver/basyx.aasxfileserver-core/src/main/java/org/eclipse/digitaltwin/basyx/aasxfileserver/model/PackageDescription.java b/basyx.aasxfileserver/basyx.aasxfileserver-core/src/main/java/org/eclipse/digitaltwin/basyx/aasxfileserver/model/PackageDescription.java index a42093974..a6a05e92a 100644 --- a/basyx.aasxfileserver/basyx.aasxfileserver-core/src/main/java/org/eclipse/digitaltwin/basyx/aasxfileserver/model/PackageDescription.java +++ b/basyx.aasxfileserver/basyx.aasxfileserver-core/src/main/java/org/eclipse/digitaltwin/basyx/aasxfileserver/model/PackageDescription.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 the Eclipse BaSyx Authors - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,7 +19,7 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ @@ -34,10 +34,9 @@ /** * Specifies the PackageDescription for {@link AASXFileServer} - * */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-06-22T10:58:56.694021713Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-06-22T10:58:56.694021713Z[GMT]") public class PackageDescription { diff --git a/basyx.aasxfileserver/basyx.aasxfileserver-core/src/main/java/org/eclipse/digitaltwin/basyx/aasxfileserver/model/PackagesBody.java b/basyx.aasxfileserver/basyx.aasxfileserver-core/src/main/java/org/eclipse/digitaltwin/basyx/aasxfileserver/model/PackagesBody.java index 0e84fbf49..8fa8cf463 100644 --- a/basyx.aasxfileserver/basyx.aasxfileserver-core/src/main/java/org/eclipse/digitaltwin/basyx/aasxfileserver/model/PackagesBody.java +++ b/basyx.aasxfileserver/basyx.aasxfileserver-core/src/main/java/org/eclipse/digitaltwin/basyx/aasxfileserver/model/PackagesBody.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 the Eclipse BaSyx Authors - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,7 +19,7 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ @@ -35,10 +35,9 @@ /** * Specifies the PackagesBody for {@link AASXFileServer} - * */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-06-22T10:58:56.694021713Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-06-22T10:58:56.694021713Z[GMT]") public class PackagesBody { private List aasIds = null; diff --git a/basyx.aasxfileserver/basyx.aasxfileserver.component/Dockerfile b/basyx.aasxfileserver/basyx.aasxfileserver.component/Dockerfile index aae318acd..61c48a0f4 100644 --- a/basyx.aasxfileserver/basyx.aasxfileserver.component/Dockerfile +++ b/basyx.aasxfileserver/basyx.aasxfileserver.component/Dockerfile @@ -1,4 +1,4 @@ -FROM amazoncorretto:11 +FROM amazoncorretto:17 USER nobody WORKDIR /application ARG JAR_FILE=target/*-exec.jar diff --git a/basyx.common/basyx.http/pom.xml b/basyx.common/basyx.http/pom.xml index d875b59f1..39e10aec9 100644 --- a/basyx.common/basyx.http/pom.xml +++ b/basyx.common/basyx.http/pom.xml @@ -16,7 +16,18 @@ org.eclipse.digitaltwin.basyx basyx.core - + + jakarta.validation + jakarta.validation-api + + + org.hibernate.validator + hibernate-validator + + + jakarta.annotation + jakarta.annotation-api + org.springframework spring-context @@ -25,6 +36,10 @@ org.springframework.boot spring-boot-starter-web + + org.springdoc + springdoc-openapi-starter-webmvc-ui + org.eclipse.digitaltwin.aas4j dataformat-json @@ -34,14 +49,10 @@ httpclient5 test - - org.springdoc - springdoc-openapi-ui - commons-io commons-io test - \ No newline at end of file + diff --git a/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/Base64UrlEncodedIdentifierSize.java b/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/Base64UrlEncodedIdentifierSize.java new file mode 100644 index 000000000..c00036b50 --- /dev/null +++ b/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/Base64UrlEncodedIdentifierSize.java @@ -0,0 +1,27 @@ +package org.eclipse.digitaltwin.basyx.http; + +import jakarta.validation.Constraint; +import jakarta.validation.Payload; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.*; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +@Documented +@Constraint(validatedBy = Base64UrlEncodedIdentifierSizeValidator.class) +@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) +@Retention(RUNTIME) +public @interface Base64UrlEncodedIdentifierSize { + String message() default "Invalid size for Base64UrlEncodedIdentifier"; + Class[] groups() default {}; + Class[] payload() default {}; + + int min() default 0; + int max() default Integer.MAX_VALUE; + + // Additional attributes and methods +} + diff --git a/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/Base64UrlEncodedIdentifierSizeValidator.java b/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/Base64UrlEncodedIdentifierSizeValidator.java new file mode 100644 index 000000000..662980370 --- /dev/null +++ b/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/Base64UrlEncodedIdentifierSizeValidator.java @@ -0,0 +1,35 @@ +package org.eclipse.digitaltwin.basyx.http; + +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; +import jakarta.validation.constraints.Size; +import org.springframework.stereotype.Component; + +@Component +public class Base64UrlEncodedIdentifierSizeValidator implements ConstraintValidator { + + private int min; + private int max; + + @Override + public void initialize(Base64UrlEncodedIdentifierSize constraintAnnotation) { + this.min = constraintAnnotation.min(); + this.max = constraintAnnotation.max(); + } + + @Override + public boolean isValid(Base64UrlEncodedIdentifier value, ConstraintValidatorContext context) { + if (value == null) { + return true; // null values are considered valid + } + // Implement your logic to check the size of Base64UrlEncodedIdentifier + int size = determineSize(value); + return size >= min && size <= max; + } + + private int determineSize(Base64UrlEncodedIdentifier value) { + // Your logic to determine the size of Base64UrlEncodedIdentifier + // For example, the length of its string representation + return value.getIdentifier().length(); + } +} diff --git a/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/description/ServiceDescription.java b/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/description/ServiceDescription.java index beace7fca..f99ffe99c 100644 --- a/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/description/ServiceDescription.java +++ b/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/description/ServiceDescription.java @@ -2,10 +2,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; - -import javax.annotation.Generated; -import javax.validation.Valid; -import javax.validation.constraints.Size; +import jakarta.annotation.Generated; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -18,9 +17,9 @@ */ @Schema(name = "ServiceDescription", - description = "The Description object enables servers to present their capabilities to the clients, in particular which profiles they implement. At least one defined profile is required. Additional, proprietary attributes might be included. Nevertheless, the server must not expect that a regular client understands them.") + description = "The Description object enables servers to present their capabilities to the clients, in particular which profiles they implement. At least one defined profile is required. Additional, proprietary attributes might be included. Nevertheless, the server must not expect that a regular client understands them.") @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", - date = "2023-09-29T10:10:24.413141+02:00[Europe/Berlin]") + date = "2023-09-29T10:10:24.413141+02:00[Europe/Berlin]") public class ServiceDescription implements Serializable { private static final long serialVersionUID = 1L; diff --git a/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/model/BaseOperationResult.java b/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/model/BaseOperationResult.java index e1bc027f1..1c77dc124 100644 --- a/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/model/BaseOperationResult.java +++ b/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/model/BaseOperationResult.java @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -24,108 +24,103 @@ ******************************************************************************/ package org.eclipse.digitaltwin.basyx.http.model; -import java.util.Objects; - -import javax.validation.Valid; - -import org.springframework.validation.annotation.Validated; - import com.fasterxml.jackson.annotation.JsonProperty; - import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import java.util.Objects; +import org.springframework.validation.annotation.Validated; /** * BaseOperationResult */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-08-10T13:45:22.063686165Z[GMT]") - - -public class BaseOperationResult extends Result { - @JsonProperty("executionState") - private ExecutionState executionState = null; - - @JsonProperty("success") - private Boolean success = null; - - public BaseOperationResult executionState(ExecutionState executionState) { - this.executionState = executionState; - return this; - } - - /** - * Get executionState - * @return executionState - **/ - @Schema(description = "") - - @Valid - public ExecutionState getExecutionState() { - return executionState; - } - - public void setExecutionState(ExecutionState executionState) { - this.executionState = executionState; - } - - public BaseOperationResult success(Boolean success) { - this.success = success; - return this; - } - - /** - * Get success - * @return success - **/ - @Schema(description = "") - - public Boolean isSuccess() { - return success; - } - - public void setSuccess(Boolean success) { - this.success = success; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BaseOperationResult baseOperationResult = (BaseOperationResult) o; - return Objects.equals(this.executionState, baseOperationResult.executionState) && - Objects.equals(this.success, baseOperationResult.success) && - super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(executionState, success, super.hashCode()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BaseOperationResult {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" executionState: ").append(toIndentedString(executionState)).append("\n"); - sb.append(" success: ").append(toIndentedString(success)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-08-10T13:45:22.063686165Z[GMT]") + +public class BaseOperationResult extends Result { + + @JsonProperty("executionState") + private ExecutionState executionState = null; + + @JsonProperty("success") + private Boolean success = null; + + public BaseOperationResult executionState(ExecutionState executionState) { + this.executionState = executionState; + return this; + } + + /** + * Get executionState + * + * @return executionState + **/ + @Schema(description = "") + + @Valid + public ExecutionState getExecutionState() { + return executionState; + } + + public void setExecutionState(ExecutionState executionState) { + this.executionState = executionState; + } + + public BaseOperationResult success(Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * + * @return success + **/ + @Schema(description = "") + + public Boolean isSuccess() { + return success; + } + + public void setSuccess(Boolean success) { + this.success = success; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BaseOperationResult baseOperationResult = (BaseOperationResult) o; + return Objects.equals(this.executionState, baseOperationResult.executionState) && Objects.equals(this.success, baseOperationResult.success) && super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(executionState, success, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BaseOperationResult {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" executionState: ").append(toIndentedString(executionState)).append("\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/model/Message.java b/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/model/Message.java index 155c7a53f..ff3190196 100644 --- a/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/model/Message.java +++ b/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/model/Message.java @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -24,21 +24,20 @@ ******************************************************************************/ package org.eclipse.digitaltwin.basyx.http.model; -import java.util.Objects; - -import org.springframework.validation.annotation.Validated; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import org.springframework.validation.annotation.Validated; /** * Message */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-04-24T09:29:02.769762272Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-04-24T09:29:02.769762272Z[GMT]") public class Message { + @JsonProperty("code") private String code = null; @@ -98,7 +97,7 @@ public Message code(String code) { /** * Get code - * + * * @return code **/ public String getCode() { @@ -116,7 +115,7 @@ public Message correlationId(String correlationId) { /** * Get correlationId - * + * * @return correlationId **/ public String getCorrelationId() { @@ -134,7 +133,7 @@ public Message messageType(MessageTypeEnum messageType) { /** * Get messageType - * + * * @return messageType **/ public MessageTypeEnum getMessageType() { @@ -152,7 +151,7 @@ public Message text(String text) { /** * Get text - * + * * @return text **/ public String getText() { @@ -170,7 +169,7 @@ public Message timestamp(String timestamp) { /** * Get timestamp - * + * * @return timestamp **/ public String getTimestamp() { diff --git a/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/model/OperationRequest.java b/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/model/OperationRequest.java index b2df34207..0e84e7939 100644 --- a/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/model/OperationRequest.java +++ b/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/model/OperationRequest.java @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -24,152 +24,150 @@ ******************************************************************************/ package org.eclipse.digitaltwin.basyx.http.model; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Pattern; import java.util.ArrayList; import java.util.List; import java.util.Objects; - -import javax.validation.Valid; -import javax.validation.constraints.Pattern; - import org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable; import org.springframework.validation.annotation.Validated; -import com.fasterxml.jackson.annotation.JsonProperty; - -import io.swagger.v3.oas.annotations.media.Schema; - /** * OperationRequest */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-08-10T13:45:22.063686165Z[GMT]") - - -public class OperationRequest { - @JsonProperty("inoutputArguments") - @Valid - private List inoutputArguments = null; - - @JsonProperty("inputArguments") - @Valid - private List inputArguments = null; - - @JsonProperty("clientTimeoutDuration") - private String clientTimeoutDuration = null; - - public OperationRequest inoutputArguments(List inoutputArguments) { - this.inoutputArguments = inoutputArguments; - return this; - } - - public OperationRequest addInoutputArgumentsItem(OperationVariable inoutputArgumentsItem) { - if (this.inoutputArguments == null) { - this.inoutputArguments = new ArrayList(); - } - this.inoutputArguments.add(inoutputArgumentsItem); - return this; - } - - /** - * Get inoutputArguments - * @return inoutputArguments - **/ - @Schema(description = "") - @Valid - public List getInoutputArguments() { - return inoutputArguments; - } - - public void setInoutputArguments(List inoutputArguments) { - this.inoutputArguments = inoutputArguments; - } - - public OperationRequest inputArguments(List inputArguments) { - this.inputArguments = inputArguments; - return this; - } - - public OperationRequest addInputArgumentsItem(OperationVariable inputArgumentsItem) { - if (this.inputArguments == null) { - this.inputArguments = new ArrayList(); - } - this.inputArguments.add(inputArgumentsItem); - return this; - } - - /** - * Get inputArguments - * @return inputArguments - **/ - @Schema(description = "") - @Valid - public List getInputArguments() { - return inputArguments; - } - - public void setInputArguments(List inputArguments) { - this.inputArguments = inputArguments; - } - - public OperationRequest clientTimeoutDuration(String clientTimeoutDuration) { - this.clientTimeoutDuration = clientTimeoutDuration; - return this; - } - - /** - * Get clientTimeoutDuration - * @return clientTimeoutDuration - **/ - @Schema(description = "") - - @Pattern(regexp="^(-?)P(?=.)((\\d+)Y)?((\\d+)M)?((\\d+)D)?(T(?=.)((\\d+)H)?((\\d+)M)?(\\d*(\\.\\d+)?S)?)?$") public String getClientTimeoutDuration() { - return clientTimeoutDuration; - } - - public void setClientTimeoutDuration(String clientTimeoutDuration) { - this.clientTimeoutDuration = clientTimeoutDuration; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - OperationRequest operationRequest = (OperationRequest) o; - return Objects.equals(this.inoutputArguments, operationRequest.inoutputArguments) && - Objects.equals(this.inputArguments, operationRequest.inputArguments) && - Objects.equals(this.clientTimeoutDuration, operationRequest.clientTimeoutDuration); - } - - @Override - public int hashCode() { - return Objects.hash(inoutputArguments, inputArguments, clientTimeoutDuration); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class OperationRequest {\n"); - - sb.append(" inoutputArguments: ").append(toIndentedString(inoutputArguments)).append("\n"); - sb.append(" inputArguments: ").append(toIndentedString(inputArguments)).append("\n"); - sb.append(" clientTimeoutDuration: ").append(toIndentedString(clientTimeoutDuration)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-08-10T13:45:22.063686165Z[GMT]") + +public class OperationRequest { + + @JsonProperty("inoutputArguments") + @Valid + private List inoutputArguments = null; + + @JsonProperty("inputArguments") + @Valid + private List inputArguments = null; + + @JsonProperty("clientTimeoutDuration") + private String clientTimeoutDuration = null; + + public OperationRequest inoutputArguments(List inoutputArguments) { + this.inoutputArguments = inoutputArguments; + return this; + } + + public OperationRequest addInoutputArgumentsItem(OperationVariable inoutputArgumentsItem) { + if (this.inoutputArguments == null) { + this.inoutputArguments = new ArrayList(); + } + this.inoutputArguments.add(inoutputArgumentsItem); + return this; + } + + /** + * Get inoutputArguments + * + * @return inoutputArguments + **/ + @Schema(description = "") + @Valid + public List getInoutputArguments() { + return inoutputArguments; + } + + public void setInoutputArguments(List inoutputArguments) { + this.inoutputArguments = inoutputArguments; + } + + public OperationRequest inputArguments(List inputArguments) { + this.inputArguments = inputArguments; + return this; + } + + public OperationRequest addInputArgumentsItem(OperationVariable inputArgumentsItem) { + if (this.inputArguments == null) { + this.inputArguments = new ArrayList(); + } + this.inputArguments.add(inputArgumentsItem); + return this; + } + + /** + * Get inputArguments + * + * @return inputArguments + **/ + @Schema(description = "") + @Valid + public List getInputArguments() { + return inputArguments; + } + + public void setInputArguments(List inputArguments) { + this.inputArguments = inputArguments; + } + + public OperationRequest clientTimeoutDuration(String clientTimeoutDuration) { + this.clientTimeoutDuration = clientTimeoutDuration; + return this; + } + + /** + * Get clientTimeoutDuration + * + * @return clientTimeoutDuration + **/ + @Schema(description = "") + + @Pattern(regexp = "^(-?)P(?=.)((\\d+)Y)?((\\d+)M)?((\\d+)D)?(T(?=.)((\\d+)H)?((\\d+)M)?(\\d*(\\.\\d+)?S)?)?$") + public String getClientTimeoutDuration() { + return clientTimeoutDuration; + } + + public void setClientTimeoutDuration(String clientTimeoutDuration) { + this.clientTimeoutDuration = clientTimeoutDuration; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OperationRequest operationRequest = (OperationRequest) o; + return Objects.equals(this.inoutputArguments, operationRequest.inoutputArguments) && Objects.equals(this.inputArguments, operationRequest.inputArguments) + && Objects.equals(this.clientTimeoutDuration, operationRequest.clientTimeoutDuration); + } + + @Override + public int hashCode() { + return Objects.hash(inoutputArguments, inputArguments, clientTimeoutDuration); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OperationRequest {\n"); + + sb.append(" inoutputArguments: ").append(toIndentedString(inoutputArguments)).append("\n"); + sb.append(" inputArguments: ").append(toIndentedString(inputArguments)).append("\n"); + sb.append(" clientTimeoutDuration: ").append(toIndentedString(clientTimeoutDuration)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/model/OperationResult.java b/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/model/OperationResult.java index 761415299..48890f866 100644 --- a/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/model/OperationResult.java +++ b/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/model/OperationResult.java @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -24,128 +24,123 @@ ******************************************************************************/ package org.eclipse.digitaltwin.basyx.http.model; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; import java.util.ArrayList; import java.util.List; import java.util.Objects; - -import javax.validation.Valid; - import org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable; import org.springframework.validation.annotation.Validated; -import com.fasterxml.jackson.annotation.JsonProperty; - -import io.swagger.v3.oas.annotations.media.Schema; - /** * OperationResult */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-08-10T13:45:22.063686165Z[GMT]") - - -public class OperationResult extends BaseOperationResult { - @JsonProperty("inoutputArguments") - @Valid - private List inoutputArguments = null; - - @JsonProperty("outputArguments") - @Valid - private List outputArguments = null; - - public OperationResult inoutputArguments(List inoutputArguments) { - this.inoutputArguments = inoutputArguments; - return this; - } - - public OperationResult addInoutputArgumentsItem(OperationVariable inoutputArgumentsItem) { - if (this.inoutputArguments == null) { - this.inoutputArguments = new ArrayList(); - } - this.inoutputArguments.add(inoutputArgumentsItem); - return this; - } - - /** - * Get inoutputArguments - * @return inoutputArguments - **/ - @Schema(description = "") - @Valid - public List getInoutputArguments() { - return inoutputArguments; - } - - public void setInoutputArguments(List inoutputArguments) { - this.inoutputArguments = inoutputArguments; - } - - public OperationResult outputArguments(List outputArguments) { - this.outputArguments = outputArguments; - return this; - } - - public OperationResult addOutputArgumentsItem(OperationVariable outputArgumentsItem) { - if (this.outputArguments == null) { - this.outputArguments = new ArrayList(); - } - this.outputArguments.add(outputArgumentsItem); - return this; - } - - /** - * Get outputArguments - * @return outputArguments - **/ - @Schema(description = "") - @Valid - public List getOutputArguments() { - return outputArguments; - } - - public void setOutputArguments(List outputArguments) { - this.outputArguments = outputArguments; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - OperationResult operationResult = (OperationResult) o; - return Objects.equals(this.inoutputArguments, operationResult.inoutputArguments) && - Objects.equals(this.outputArguments, operationResult.outputArguments) && - super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(inoutputArguments, outputArguments, super.hashCode()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class OperationResult {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" inoutputArguments: ").append(toIndentedString(inoutputArguments)).append("\n"); - sb.append(" outputArguments: ").append(toIndentedString(outputArguments)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-08-10T13:45:22.063686165Z[GMT]") + +public class OperationResult extends BaseOperationResult { + + @JsonProperty("inoutputArguments") + @Valid + private List inoutputArguments = null; + + @JsonProperty("outputArguments") + @Valid + private List outputArguments = null; + + public OperationResult inoutputArguments(List inoutputArguments) { + this.inoutputArguments = inoutputArguments; + return this; + } + + public OperationResult addInoutputArgumentsItem(OperationVariable inoutputArgumentsItem) { + if (this.inoutputArguments == null) { + this.inoutputArguments = new ArrayList(); + } + this.inoutputArguments.add(inoutputArgumentsItem); + return this; + } + + /** + * Get inoutputArguments + * + * @return inoutputArguments + **/ + @Schema(description = "") + @Valid + public List getInoutputArguments() { + return inoutputArguments; + } + + public void setInoutputArguments(List inoutputArguments) { + this.inoutputArguments = inoutputArguments; + } + + public OperationResult outputArguments(List outputArguments) { + this.outputArguments = outputArguments; + return this; + } + + public OperationResult addOutputArgumentsItem(OperationVariable outputArgumentsItem) { + if (this.outputArguments == null) { + this.outputArguments = new ArrayList(); + } + this.outputArguments.add(outputArgumentsItem); + return this; + } + + /** + * Get outputArguments + * + * @return outputArguments + **/ + @Schema(description = "") + @Valid + public List getOutputArguments() { + return outputArguments; + } + + public void setOutputArguments(List outputArguments) { + this.outputArguments = outputArguments; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OperationResult operationResult = (OperationResult) o; + return Objects.equals(this.inoutputArguments, operationResult.inoutputArguments) && Objects.equals(this.outputArguments, operationResult.outputArguments) && super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(inoutputArguments, outputArguments, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OperationResult {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" inoutputArguments: ").append(toIndentedString(inoutputArguments)).append("\n"); + sb.append(" outputArguments: ").append(toIndentedString(outputArguments)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/model/Result.java b/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/model/Result.java index f80dcb0e8..724ba2f95 100644 --- a/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/model/Result.java +++ b/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/model/Result.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 the Eclipse BaSyx Authors - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,96 +19,90 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ - package org.eclipse.digitaltwin.basyx.http.model; - +import com.fasterxml.jackson.annotation.JsonProperty; import java.util.ArrayList; import java.util.List; import java.util.Objects; - import org.springframework.validation.annotation.Validated; -import com.fasterxml.jackson.annotation.JsonProperty; - - /** * Result */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-04-24T09:29:02.769762272Z[GMT]") - - -public class Result { - @JsonProperty("messages") - private List messages = null; - - public Result messages(List messages) { - this.messages = messages; - return this; - } - - public Result addMessagesItem(Message messagesItem) { - if (this.messages == null) { - this.messages = new ArrayList(); - } - this.messages.add(messagesItem); - return this; - } - - /** - * Get messages - * @return messages - **/ - public List getMessages() { - return messages; - } - - public void setMessages(List messages) { - this.messages = messages; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Result result = (Result) o; - return Objects.equals(this.messages, result.messages); - } - - @Override - public int hashCode() { - return Objects.hash(messages); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Result {\n"); - - sb.append(" messages: ").append(toIndentedString(messages)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-04-24T09:29:02.769762272Z[GMT]") + +public class Result { + + @JsonProperty("messages") + private List messages = null; + + public Result messages(List messages) { + this.messages = messages; + return this; + } + + public Result addMessagesItem(Message messagesItem) { + if (this.messages == null) { + this.messages = new ArrayList(); + } + this.messages.add(messagesItem); + return this; + } + + /** + * Get messages + * + * @return messages + **/ + public List getMessages() { + return messages; + } + + public void setMessages(List messages) { + this.messages = messages; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Result result = (Result) o; + return Objects.equals(this.messages, result.messages); + } + + @Override + public int hashCode() { + return Objects.hash(messages); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Result {\n"); + + sb.append(" messages: ").append(toIndentedString(messages)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } - diff --git a/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/pagination/PagedResult.java b/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/pagination/PagedResult.java index 916126d86..9f95b2e82 100644 --- a/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/pagination/PagedResult.java +++ b/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/pagination/PagedResult.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 the Eclipse BaSyx Authors - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,26 +19,26 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.http.pagination; -import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import java.util.Objects; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; /** * Base class for Paginated results - * */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-05-22T07:02:56.105163402Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-05-22T07:02:56.105163402Z[GMT]") public class PagedResult { + @JsonProperty("paging_metadata") private PagedResultPagingMetadata pagingMetadata = null; @@ -49,7 +49,7 @@ public PagedResult pagingMetadata(PagedResultPagingMetadata pagingMetadata) { /** * Get pagingMetadata - * + * * @return pagingMetadata **/ @Schema(description = "") diff --git a/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/pagination/PagedResultPagingMetadata.java b/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/pagination/PagedResultPagingMetadata.java index b8b8a8e83..c520620d4 100644 --- a/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/pagination/PagedResultPagingMetadata.java +++ b/basyx.common/basyx.http/src/main/java/org/eclipse/digitaltwin/basyx/http/pagination/PagedResultPagingMetadata.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 the Eclipse BaSyx Authors - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,24 +19,25 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.http.pagination; -import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Objects; import org.springframework.validation.annotation.Validated; /** * Paged result metadata */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-05-22T07:02:56.105163402Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-05-22T07:02:56.105163402Z[GMT]") public class PagedResultPagingMetadata { + @JsonProperty("cursor") private String cursor = null; @@ -47,7 +48,7 @@ public PagedResultPagingMetadata cursor(String cursor) { /** * Get cursor - * + * * @return cursor **/ @Schema(example = "wJlCDLIl6KTWypN7T6vc6nWEmEYe99Hjf1XY1xmqV-M=#", description = "") diff --git a/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository-http/pom.xml b/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository-http/pom.xml index 0d5afcb5a..1e1159d3c 100644 --- a/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository-http/pom.xml +++ b/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository-http/pom.xml @@ -1,5 +1,6 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 @@ -19,8 +20,12 @@ org.eclipse.digitaltwin.basyx basyx.http - test + + + org.eclipse.digitaltwin.basyx + basyx.http tests + test org.eclipse.digitaltwin.basyx @@ -48,11 +53,11 @@ org.springdoc - springdoc-openapi-ui + springdoc-openapi-starter-webmvc-ui - javax.validation - validation-api + jakarta.validation + jakarta.validation-api org.eclipse.digitaltwin.aas4j @@ -69,4 +74,4 @@ test - \ No newline at end of file + diff --git a/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/conceptdescriptionrepository/http/ConceptDescriptionRepositoryApiHTTPController.java b/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/conceptdescriptionrepository/http/ConceptDescriptionRepositoryApiHTTPController.java index 3bb61f211..aef9f3427 100644 --- a/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/conceptdescriptionrepository/http/ConceptDescriptionRepositoryApiHTTPController.java +++ b/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/conceptdescriptionrepository/http/ConceptDescriptionRepositoryApiHTTPController.java @@ -1,10 +1,13 @@ package org.eclipse.digitaltwin.basyx.conceptdescriptionrepository.http; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Min; import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.Min; - import org.eclipse.digitaltwin.aas4j.v3.model.ConceptDescription; import org.eclipse.digitaltwin.aas4j.v3.model.Reference; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultReference; @@ -24,14 +27,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.enums.ParameterIn; -import io.swagger.v3.oas.annotations.media.Schema; - -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-03-21T12:35:49.719724407Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-03-21T12:35:49.719724407Z[GMT]") @RestController public class ConceptDescriptionRepositoryApiHTTPController implements ConceptDescriptionRepositoryHTTPApi { @@ -56,12 +52,14 @@ public ResponseEntity deleteConceptDescriptionById( @Override public ResponseEntity getAllConceptDescriptions(@Valid String idShort, @Valid Base64UrlEncodedIdentifier isCaseOf, @Valid Base64UrlEncodedIdentifier dataSpecificationRef, @Min(1) @Valid Integer limit, @Valid Base64UrlEncodedCursor cursor) { - if (limit == null) + if (limit == null) { limit = 100; + } String decodedCursor = ""; - if (cursor != null) + if (cursor != null) { decodedCursor = cursor.getDecodedCursor(); + } Reference isCaseOfReference = getReference(getDecodedValue(isCaseOf)); Reference dataSpecificationReference = getReference(getDecodedValue(dataSpecificationRef)); @@ -100,8 +98,9 @@ public ResponseEntity putConceptDescriptionById( } private Reference getReference(String serializedReference) { - if (serializedReference == null) + if (serializedReference == null) { return null; + } try { return objectMapper.readValue(serializedReference, DefaultReference.class); @@ -115,8 +114,9 @@ private String getDecodedValue(Base64UrlEncodedIdentifier identifier) { } private String getEncodedCursorFromCursorResult(CursorResult cursorResult) { - if (cursorResult == null || cursorResult.getCursor() == null) + if (cursorResult == null || cursorResult.getCursor() == null) { return null; + } return Base64UrlEncodedCursor.encodeCursor(cursorResult.getCursor()); } diff --git a/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/conceptdescriptionrepository/http/ConceptDescriptionRepositoryHTTPApi.java b/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/conceptdescriptionrepository/http/ConceptDescriptionRepositoryHTTPApi.java index 1a910fd8c..532a3ef46 100644 --- a/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/conceptdescriptionrepository/http/ConceptDescriptionRepositoryHTTPApi.java +++ b/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/conceptdescriptionrepository/http/ConceptDescriptionRepositoryHTTPApi.java @@ -1,13 +1,18 @@ /** * NOTE: This class is auto generated by the swagger code generator program (3.0.41). - * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. + * https://github.com/swagger-api/swagger-codegen Do not edit the class manually. */ package org.eclipse.digitaltwin.basyx.conceptdescriptionrepository.http; -import javax.validation.Valid; -import javax.validation.constraints.Min; - +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Min; import org.eclipse.digitaltwin.aas4j.v3.model.ConceptDescription; import org.eclipse.digitaltwin.basyx.conceptdescriptionrepository.http.pagination.GetConceptDescriptionsResult; import org.eclipse.digitaltwin.basyx.http.Base64UrlEncodedIdentifier; @@ -22,17 +27,10 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.enums.ParameterIn; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; - -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-03-21T12:35:49.719724407Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-03-21T12:35:49.719724407Z[GMT]") @Validated public interface ConceptDescriptionRepositoryHTTPApi { + @Operation(summary = "Deletes a Concept Description", description = "", tags = { "Concept Description Repository API" }) @ApiResponses(value = { @ApiResponse(responseCode = "204", description = "Concept Description deleted successfully"), @@ -49,7 +47,6 @@ public interface ConceptDescriptionRepositoryHTTPApi { ResponseEntity deleteConceptDescriptionById( @Parameter(in = ParameterIn.PATH, description = "The Concept Description’s unique id (UTF8-BASE64-URL-encoded)", required = true, schema = @Schema()) @PathVariable("cdIdentifier") Base64UrlEncodedIdentifier cdIdentifier); - @Operation(summary = "Returns all Concept Descriptions", description = "", tags = { "Concept Description Repository API" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Requested Concept Descriptions", content = @Content(mediaType = "application/json", schema = @Schema(implementation = GetConceptDescriptionsResult.class))), @@ -61,15 +58,13 @@ ResponseEntity deleteConceptDescriptionById( @ApiResponse(responseCode = "200", description = "Default error handling for unmentioned status codes", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))) }) @RequestMapping(value = "/concept-descriptions", produces = { "application/json" }, method = RequestMethod.GET) - ResponseEntity getAllConceptDescriptions( - @Parameter(in = ParameterIn.QUERY, description = "The Concept Description’s IdShort", schema = @Schema()) @Valid @RequestParam(value = "idShort", required = false) String idShort, + ResponseEntity getAllConceptDescriptions(@Parameter(in = ParameterIn.QUERY, description = "The Concept Description’s IdShort", schema = @Schema()) @Valid @RequestParam(value = "idShort", required = false) String idShort, @Parameter(in = ParameterIn.QUERY, description = "IsCaseOf reference (UTF8-BASE64-URL-encoded)", schema = @Schema()) @Valid @RequestParam(value = "isCaseOf", required = false) Base64UrlEncodedIdentifier isCaseOf, @Parameter(in = ParameterIn.QUERY, description = "DataSpecification reference (UTF8-BASE64-URL-encoded)", schema = @Schema()) @Valid @RequestParam(value = "dataSpecificationRef", required = false) Base64UrlEncodedIdentifier dataSpecificationRef, @Min(1) @Parameter(in = ParameterIn.QUERY, description = "The maximum number of elements in the response array", schema = @Schema(allowableValues = { "1" }, minimum = "1")) @Valid @RequestParam(value = "limit", required = false) Integer limit, @Parameter(in = ParameterIn.QUERY, description = "A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue", schema = @Schema()) @Valid @RequestParam(value = "cursor", required = false) Base64UrlEncodedCursor cursor); - @Operation(summary = "Returns a specific Concept Description", description = "", tags = { "Concept Description Repository API" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Requested Concept Description", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ConceptDescription.class))), @@ -86,7 +81,6 @@ ResponseEntity getAllConceptDescriptions( ResponseEntity getConceptDescriptionById( @Parameter(in = ParameterIn.PATH, description = "The Concept Description’s unique id (UTF8-BASE64-URL-encoded)", required = true, schema = @Schema()) @PathVariable("cdIdentifier") Base64UrlEncodedIdentifier cdIdentifier); - @Operation(summary = "Creates a new Concept Description", description = "", tags = { "Concept Description Repository API" }) @ApiResponses(value = { @ApiResponse(responseCode = "201", description = "Concept Description created successfully", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ConceptDescription.class))), @@ -102,7 +96,6 @@ ResponseEntity getConceptDescriptionById( @RequestMapping(value = "/concept-descriptions", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.POST) ResponseEntity postConceptDescription(@Parameter(in = ParameterIn.DEFAULT, description = "Concept Description object", required = true, schema = @Schema()) @Valid @RequestBody ConceptDescription body); - @Operation(summary = "Updates an existing Concept Description", description = "", tags = { "Concept Description Repository API" }) @ApiResponses(value = { @ApiResponse(responseCode = "204", description = "Concept Description updated successfully"), @@ -120,4 +113,3 @@ ResponseEntity putConceptDescriptionById( @Parameter(in = ParameterIn.PATH, description = "The Concept Description’s unique id (UTF8-BASE64-URL-encoded)", required = true, schema = @Schema()) @PathVariable("cdIdentifier") Base64UrlEncodedIdentifier cdIdentifier, @Parameter(in = ParameterIn.DEFAULT, description = "Concept Description object", required = true, schema = @Schema()) @Valid @RequestBody ConceptDescription body); } - diff --git a/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/conceptdescriptionrepository/http/pagination/GetConceptDescriptionsResult.java b/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/conceptdescriptionrepository/http/pagination/GetConceptDescriptionsResult.java index 0c3d0835f..b9679f987 100644 --- a/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/conceptdescriptionrepository/http/pagination/GetConceptDescriptionsResult.java +++ b/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/conceptdescriptionrepository/http/pagination/GetConceptDescriptionsResult.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 the Eclipse BaSyx Authors - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,32 +19,32 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.conceptdescriptionrepository.http.pagination; -import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; import java.util.ArrayList; import java.util.List; - +import java.util.Objects; import org.eclipse.digitaltwin.aas4j.v3.model.ConceptDescription; import org.eclipse.digitaltwin.basyx.conceptdescriptionrepository.ConceptDescriptionRepository; import org.eclipse.digitaltwin.basyx.http.pagination.PagedResult; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; /** * Paginated wrapper for * {@link ConceptDescriptionRepository#getAllConceptDescriptions()} */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-05-22T07:02:56.105163402Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-05-22T07:02:56.105163402Z[GMT]") public class GetConceptDescriptionsResult extends PagedResult { + @JsonProperty("result") @Valid private List result = null; @@ -64,7 +64,7 @@ public GetConceptDescriptionsResult addResultItem(ConceptDescription resultItem) /** * Get result - * + * * @return result **/ @Schema(description = "") diff --git a/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository.component/Dockerfile b/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository.component/Dockerfile index f25acaa01..685afc783 100644 --- a/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository.component/Dockerfile +++ b/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository.component/Dockerfile @@ -1,11 +1,11 @@ -FROM amazoncorretto:11 +FROM amazoncorretto:17 USER nobody WORKDIR /application ARG JAR_FILE=target/*-exec.jar COPY ${JAR_FILE} basyxExecutable.jar COPY src/main/resources/application.properties application.properties ARG PORT=8081 -ENV PORT=${PORT} +ENV SERVER_PORT=${PORT} EXPOSE ${PORT} -HEALTHCHECK --interval=30s --timeout=3s --retries=3 --start-period=30s CMD curl --fail http://localhost:${PORT}/actuator/health || exit 1 +HEALTHCHECK --interval=30s --timeout=3s --retries=3 --start-period=30s CMD curl --fail http://localhost:${SERVER_PORT}/actuator/health || exit 1 ENTRYPOINT ["java","-jar","basyxExecutable.jar"] diff --git a/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository.component/pom.xml b/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository.component/pom.xml index 7acac2a78..0ab8621a6 100644 --- a/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository.component/pom.xml +++ b/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository.component/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 @@ -12,7 +13,8 @@ conceptdescription-repository - http://localhost:${docker.host.port}/concept-descriptions + http://localhost:${docker.host.port}/concept-descriptions + @@ -111,18 +113,18 @@ - + io.fabric8 docker-maven-plugin - 0.43.0 + 0.43.4 - ${docker.username}/${docker.image.name} + ${docker.namespace}/${docker.image.name} ${docker.image.tag} @@ -187,4 +189,4 @@ - \ No newline at end of file + diff --git a/basyx.submodelregistry/basyx.submodelregistry-client-native/pom.xml b/basyx.submodelregistry/basyx.submodelregistry-client-native/pom.xml index f736320f3..512d87875 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-client-native/pom.xml +++ b/basyx.submodelregistry/basyx.submodelregistry-client-native/pom.xml @@ -7,7 +7,7 @@ org.eclipse.digitaltwin.basyx basyx.submodelregistry ${revision} - .. + basyx.submodelregistry-client-native @@ -58,7 +58,7 @@ - + org.openapitools openapi-generator-maven-plugin @@ -81,18 +81,21 @@ false true ${project.basedir}/templates - AbstractOpenApiSchema.java,ServerConfiguration.java,ServerVariable.java,Configuration.java,JSON.java,ApiException.java,ApiResponse.java,ApiClient.java,Pair.java,RFC3339DateFormat.java + + AbstractOpenApiSchema.java,ServerConfiguration.java,ServerVariable.java,Configuration.java,JSON.java,ApiException.java,ApiResponse.java,ApiClient.java,Pair.java,RFC3339DateFormat.java + true java8 java + true - + @@ -109,10 +112,6 @@ org.openapitools jackson-databind-nullable - - javax.annotation - javax.annotation-api - com.fasterxml.jackson.core jackson-databind @@ -125,6 +124,10 @@ com.google.code.findbugs jsr305 + + jakarta.annotation + jakarta.annotation-api + diff --git a/basyx.submodelregistry/basyx.submodelregistry-service-basemodel/pom.xml b/basyx.submodelregistry/basyx.submodelregistry-service-basemodel/pom.xml index c16008344..5d334a6de 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-service-basemodel/pom.xml +++ b/basyx.submodelregistry/basyx.submodelregistry-service-basemodel/pom.xml @@ -7,7 +7,6 @@ org.eclipse.digitaltwin.basyx basyx.submodelregistry ${revision} - .. basyx.submodelregistry-service-basemodel @@ -60,7 +59,7 @@ - + org.openapitools openapi-generator-maven-plugin @@ -87,6 +86,7 @@ true org.eclipse.digitaltwin.basyx.submodelregistry.model array=ArrayList,map=HashMap + true @@ -106,13 +106,13 @@ org.openapitools jackson-databind-nullable - - org.springdoc - springdoc-openapi-ui - org.springframework.boot spring-boot-starter-validation + + org.springdoc + springdoc-openapi-starter-webmvc-ui + - \ No newline at end of file + diff --git a/basyx.submodelregistry/basyx.submodelregistry-service-basetests/pom.xml b/basyx.submodelregistry/basyx.submodelregistry-service-basetests/pom.xml index 0c3829749..77408a334 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-service-basetests/pom.xml +++ b/basyx.submodelregistry/basyx.submodelregistry-service-basetests/pom.xml @@ -7,7 +7,7 @@ org.eclipse.digitaltwin.basyx basyx.submodelregistry ${revision} - .. + basyx.submodelregistry-service-basetests @@ -70,4 +70,4 @@ - \ No newline at end of file + diff --git a/basyx.submodelregistry/basyx.submodelregistry-service-inmemory-storage/pom.xml b/basyx.submodelregistry/basyx.submodelregistry-service-inmemory-storage/pom.xml index 4cbdbd502..5fde5d71d 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-service-inmemory-storage/pom.xml +++ b/basyx.submodelregistry/basyx.submodelregistry-service-inmemory-storage/pom.xml @@ -7,7 +7,7 @@ org.eclipse.digitaltwin.basyx basyx.submodelregistry ${revision} - .. + basyx.submodelregistry-service-inmemory-storage @@ -34,4 +34,4 @@ true - \ No newline at end of file + diff --git a/basyx.submodelregistry/basyx.submodelregistry-service-kafka-events/pom.xml b/basyx.submodelregistry/basyx.submodelregistry-service-kafka-events/pom.xml index 9d56502c8..f90cd68f5 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-service-kafka-events/pom.xml +++ b/basyx.submodelregistry/basyx.submodelregistry-service-kafka-events/pom.xml @@ -7,7 +7,7 @@ org.eclipse.digitaltwin.basyx basyx.submodelregistry ${revision} - .. + basyx.submodelregistry-service-kafka-events @@ -52,4 +52,4 @@ - \ No newline at end of file + diff --git a/basyx.submodelregistry/basyx.submodelregistry-service-mongodb-storage/pom.xml b/basyx.submodelregistry/basyx.submodelregistry-service-mongodb-storage/pom.xml index 5a75dfdc0..eb91fd717 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-service-mongodb-storage/pom.xml +++ b/basyx.submodelregistry/basyx.submodelregistry-service-mongodb-storage/pom.xml @@ -7,7 +7,7 @@ org.eclipse.digitaltwin.basyx basyx.submodelregistry ${revision} - .. + basyx.submodelregistry-service-mongodb-storage @@ -17,7 +17,8 @@ 2020.0.4 ${project.basedir}/${openapi.folder.name} ${openapi.folder}/${openapi.mongodb.file.name} - ${openapi.folder}/temporary-extensions-result-file.yaml + ${openapi.folder}/temporary-extensions-result-file.yaml + ${openapi.folder}/${openapi.name} patch-mongodb-annotations.yaml @@ -126,6 +127,7 @@ org.eclipse.digitaltwin.basyx.submodelregistry.service org.eclipse.digitaltwin.basyx.submodelregistry.model true + true @@ -161,17 +163,13 @@ - javax.validation - validation-api + jakarta.validation + jakarta.validation-api org.springframework.boot spring-boot-starter-validation - - javax.xml.bind - jaxb-api - com.google.guava guava diff --git a/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mem/pom.xml b/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mem/pom.xml index 7241083cb..19daeb76f 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mem/pom.xml +++ b/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mem/pom.xml @@ -7,7 +7,7 @@ org.eclipse.digitaltwin.basyx basyx.submodelregistry ${revision} - .. + basyx.submodelregistry-service-release-kafka-mem @@ -57,4 +57,4 @@ test - \ No newline at end of file + diff --git a/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mem/src/main/docker/Dockerfile b/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mem/src/main/docker/Dockerfile index 3885885ec..d2f18bda8 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mem/src/main/docker/Dockerfile +++ b/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mem/src/main/docker/Dockerfile @@ -1,8 +1,8 @@ -FROM amazoncorretto:11.0.20-alpine3.18 as builder +FROM amazoncorretto:17.0.8-alpine3.18 as builder COPY maven/${project.build.finalName}.jar ./ RUN java -Djarmode=layertools -jar ${project.build.finalName}.jar extract -FROM amazoncorretto:11.0.20-alpine3.18 +FROM amazoncorretto:17.0.8-alpine3.18 RUN mkdir /workspace WORKDIR /workspace COPY --from=builder dependencies/ ./ diff --git a/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mongodb/pom.xml b/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mongodb/pom.xml index 11b61a41b..7ef765b62 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mongodb/pom.xml +++ b/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mongodb/pom.xml @@ -7,7 +7,7 @@ org.eclipse.digitaltwin.basyx basyx.submodelregistry ${revision} - .. + basyx.submodelregistry-service-release-kafka-mongodb @@ -51,4 +51,4 @@ test - \ No newline at end of file + diff --git a/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mongodb/src/main/docker/Dockerfile b/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mongodb/src/main/docker/Dockerfile index a1109eddc..2c473daf5 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mongodb/src/main/docker/Dockerfile +++ b/basyx.submodelregistry/basyx.submodelregistry-service-release-kafka-mongodb/src/main/docker/Dockerfile @@ -1,8 +1,8 @@ -FROM amazoncorretto:11.0.20-alpine3.18 as builder +FROM amazoncorretto:17.0.8-alpine3.18 as builder COPY maven/${project.build.finalName}.jar ./ RUN java -Djarmode=layertools -jar ${project.build.finalName}.jar extract -FROM amazoncorretto:11.0.20-alpine3.18 +FROM amazoncorretto:17.0.8-alpine3.18 RUN mkdir /workspace WORKDIR /workspace COPY --from=builder dependencies/ ./ diff --git a/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mem/pom.xml b/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mem/pom.xml index 720b0a830..7ea479974 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mem/pom.xml +++ b/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mem/pom.xml @@ -7,7 +7,7 @@ org.eclipse.digitaltwin.basyx basyx.submodelregistry ${revision} - .. + basyx.submodelregistry-service-release-log-mem @@ -53,4 +53,4 @@ test - \ No newline at end of file + diff --git a/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mem/src/main/docker/Dockerfile b/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mem/src/main/docker/Dockerfile index 1cca6627b..0f007a16d 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mem/src/main/docker/Dockerfile +++ b/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mem/src/main/docker/Dockerfile @@ -1,8 +1,8 @@ -FROM amazoncorretto:11.0.20-alpine3.18 as builder +FROM amazoncorretto:17.0.8-alpine3.18 as builder COPY maven/${project.build.finalName}.jar ./ RUN java -Djarmode=layertools -jar ${project.build.finalName}.jar extract -FROM amazoncorretto:11.0.20-alpine3.18 +FROM amazoncorretto:17.0.8-alpine3.18 RUN mkdir /workspace WORKDIR /workspace COPY --from=builder dependencies/ ./ diff --git a/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mongodb/pom.xml b/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mongodb/pom.xml index cce0d47f2..7230198f7 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mongodb/pom.xml +++ b/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mongodb/pom.xml @@ -7,7 +7,7 @@ org.eclipse.digitaltwin.basyx basyx.submodelregistry ${revision} - .. + basyx.submodelregistry-service-release-log-mongodb @@ -44,4 +44,4 @@ - \ No newline at end of file + diff --git a/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mongodb/src/main/docker/Dockerfile b/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mongodb/src/main/docker/Dockerfile index fc39fee0a..cfe5b3b39 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mongodb/src/main/docker/Dockerfile +++ b/basyx.submodelregistry/basyx.submodelregistry-service-release-log-mongodb/src/main/docker/Dockerfile @@ -1,8 +1,8 @@ -FROM amazoncorretto:11.0.20-alpine3.18 as builder +FROM amazoncorretto:17.0.8-alpine3.18 as builder COPY maven/${project.build.finalName}.jar ./ RUN java -Djarmode=layertools -jar ${project.build.finalName}.jar extract -FROM amazoncorretto:11.0.20-alpine3.18 +FROM amazoncorretto:17.0.8-alpine3.18 RUN mkdir /workspace WORKDIR /workspace COPY --from=builder dependencies/ ./ diff --git a/basyx.submodelregistry/basyx.submodelregistry-service/pom.xml b/basyx.submodelregistry/basyx.submodelregistry-service/pom.xml index f60792719..71d82063c 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-service/pom.xml +++ b/basyx.submodelregistry/basyx.submodelregistry-service/pom.xml @@ -7,7 +7,6 @@ org.eclipse.digitaltwin.basyx basyx.submodelregistry ${revision} - .. basyx.submodelregistry-service @@ -109,6 +108,7 @@ org.eclipse.digitaltwin.basyx.submodelregistry.model true springdoc + true @@ -125,32 +125,23 @@ org.springframework.boot spring-boot-starter-tomcat - - org.projectlombok - lombok - true - org.springdoc - springdoc-openapi-webmvc-core - 1.7.0 + springdoc-openapi-starter-webmvc-ui - org.springdoc - springdoc-openapi-ui + org.projectlombok + lombok + true - javax.validation - validation-api + jakarta.validation + jakarta.validation-api org.springframework.boot spring-boot-starter-validation - - javax.xml.bind - jaxb-api - org.springframework.boot spring-boot-starter-actuator diff --git a/basyx.submodelregistry/basyx.submodelregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/submodelregistry/service/errors/BasyxControllerAdvice.java b/basyx.submodelregistry/basyx.submodelregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/submodelregistry/service/errors/BasyxControllerAdvice.java index bc284d235..445b0416a 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/submodelregistry/service/errors/BasyxControllerAdvice.java +++ b/basyx.submodelregistry/basyx.submodelregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/submodelregistry/service/errors/BasyxControllerAdvice.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 DFKI GmbH (https://www.dfki.de/en/web) - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,7 +19,7 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.submodelregistry.service.errors; @@ -53,9 +53,9 @@ public ResponseEntity handleValidationException(MethodArgumentNotValidEx @ExceptionHandler(ResponseStatusException.class) public ResponseEntity handleExceptions(ResponseStatusException ex) { - return newResultEntity(ex, ex.getStatus()); + return newResultEntity(ex, HttpStatus.resolve(ex.getStatusCode().value())); } - + @ExceptionHandler(Exception.class) public ResponseEntity handleExceptions(Exception ex) { return newResultEntity(ex, HttpStatus.INTERNAL_SERVER_ERROR); @@ -76,4 +76,4 @@ private Message newExceptionMessage(String msg, HttpStatus status) { message.setText(msg); return message; } -} \ No newline at end of file +} diff --git a/basyx.submodelregistry/basyx.submodelregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/submodelregistry/service/events/RegistryEvent.java b/basyx.submodelregistry/basyx.submodelregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/submodelregistry/service/events/RegistryEvent.java index 491485444..fb2487824 100644 --- a/basyx.submodelregistry/basyx.submodelregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/submodelregistry/service/events/RegistryEvent.java +++ b/basyx.submodelregistry/basyx.submodelregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/submodelregistry/service/events/RegistryEvent.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 DFKI GmbH (https://www.dfki.de/en/web) - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,12 +19,12 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.submodelregistry.service.events; -import javax.annotation.Nullable; +import jakarta.annotation.Nullable; import org.eclipse.digitaltwin.basyx.submodelregistry.model.SubmodelDescriptor; diff --git a/basyx.submodelregistry/pom.xml b/basyx.submodelregistry/pom.xml index b98e20b26..048c9acac 100644 --- a/basyx.submodelregistry/pom.xml +++ b/basyx.submodelregistry/pom.xml @@ -15,7 +15,7 @@ 2.0.0-SNAPSHOT 1.18.20.0 - 11 + 17 ${java.version} ${java.version} UTF-8 @@ -29,8 +29,8 @@ 3.6.0 3.0-alpha-2 0.9.4 - 1.30 - 0.40.1 + 2.2 + 0.43.4 ${project.artifactId} docker.io linux/amd64,linux/arm64 @@ -43,18 +43,18 @@ - + basyx.submodelregistry-service-basemodel basyx.submodelregistry-service basyx.submodelregistry-service-inmemory-storage basyx.submodelregistry-service-release-log-mem basyx.submodelregistry-client-native basyx.submodelregistry-service-mongodb-storage - basyx.submodelregistry-service-kafka-events + basyx.submodelregistry-service-basetests - basyx.submodelregistry-service-release-kafka-mem + basyx.submodelregistry-service-release-log-mongodb - basyx.submodelregistry-service-release-kafka-mongodb + @@ -82,7 +82,8 @@ ${swagger.codegen.version} - + org.openapitools openapi-generator-maven-plugin ${openapitools.version} @@ -240,13 +241,13 @@ dockerbuild - + src/main/docker/Dockerfile - docker.username + docker.namespace @@ -281,7 +282,7 @@ - ${docker.username}/${docker.image.name} + ${docker.namespace}/${docker.image.name} artifact @@ -292,6 +293,7 @@ Dockerfile ${project.basedir}/src/main/docker + true @@ -307,7 +309,7 @@ - ${docker.username}/${docker.image.name} + ${docker.namespace}/${docker.image.name} https://index.docker.io/v1/ @@ -321,7 +323,11 @@ ${project.basedir}/src/main/docker ${docker.target.platforms} + + ${docker.provenance} + + true @@ -333,4 +339,4 @@ - \ No newline at end of file + diff --git a/basyx.submodelrepository/basyx.submodelrepository-http/pom.xml b/basyx.submodelrepository/basyx.submodelrepository-http/pom.xml index ed9864393..5dba01533 100644 --- a/basyx.submodelrepository/basyx.submodelrepository-http/pom.xml +++ b/basyx.submodelrepository/basyx.submodelrepository-http/pom.xml @@ -63,11 +63,11 @@ org.springdoc - springdoc-openapi-ui + springdoc-openapi-starter-webmvc-ui - javax.validation - validation-api + jakarta.validation + jakarta.validation-api org.eclipse.digitaltwin.aas4j @@ -90,4 +90,4 @@ test - \ No newline at end of file + diff --git a/basyx.submodelrepository/basyx.submodelrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/http/SubmodelRepositoryApiHTTPController.java b/basyx.submodelrepository/basyx.submodelrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/http/SubmodelRepositoryApiHTTPController.java index bf8b88abf..b70210979 100644 --- a/basyx.submodelrepository/basyx.submodelrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/http/SubmodelRepositoryApiHTTPController.java +++ b/basyx.submodelrepository/basyx.submodelrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/http/SubmodelRepositoryApiHTTPController.java @@ -33,9 +33,9 @@ import java.util.Arrays; import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.Min; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.Size; import org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable; import org.eclipse.digitaltwin.aas4j.v3.model.Submodel; @@ -46,6 +46,7 @@ import org.eclipse.digitaltwin.basyx.core.pagination.CursorResult; import org.eclipse.digitaltwin.basyx.core.pagination.PaginationInfo; import org.eclipse.digitaltwin.basyx.http.Base64UrlEncodedIdentifier; +import org.eclipse.digitaltwin.basyx.http.Base64UrlEncodedIdentifierSize; import org.eclipse.digitaltwin.basyx.http.model.OperationRequest; import org.eclipse.digitaltwin.basyx.http.model.OperationResult; import org.eclipse.digitaltwin.basyx.http.pagination.Base64UrlEncodedCursor; @@ -70,9 +71,10 @@ import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.media.Schema; -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2022-01-10T15:59:05.892Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2022-01-10T15:59:05.892Z[GMT]") @RestController public class SubmodelRepositoryApiHTTPController implements SubmodelRepositoryHTTPApi { + private SubmodelRepository repository; @Autowired @@ -102,14 +104,15 @@ public ResponseEntity deleteSubmodelElementByPathSubmodelRepo( } @Override - public ResponseEntity getAllSubmodels(@Size(min = 1, max = 3072) @Valid Base64UrlEncodedIdentifier semanticId, @Valid String idShort, @Min(1) @Valid Integer limit, @Valid Base64UrlEncodedCursor cursor, @Valid String level, - @Valid String extent) { - if (limit == null) + public ResponseEntity getAllSubmodels(@Base64UrlEncodedIdentifierSize(min = 1, max = 3072) @Valid Base64UrlEncodedIdentifier semanticId, @Valid String idShort, @Min(1) @Valid Integer limit, @Valid Base64UrlEncodedCursor cursor, @Valid String level, @Valid String extent) { + if (limit == null) { limit = 100; + } String decodedCursor = ""; - if (cursor != null) + if (cursor != null) { decodedCursor = cursor.getDecodedCursor(); + } PaginationInfo pInfo = new PaginationInfo(limit, decodedCursor); @@ -138,16 +141,17 @@ public ResponseEntity putSubmodelById(Base64UrlEncodedIdentifier submodelI @Override public ResponseEntity getAllSubmodelElements(Base64UrlEncodedIdentifier submodelIdentifier, @Min(1) @Valid Integer limit, @Valid Base64UrlEncodedCursor cursor, @Valid String level, @Valid String extent) { - if (limit == null) + if (limit == null) { limit = 100; + } String decodedCursor = ""; - if (cursor != null) + if (cursor != null) { decodedCursor = cursor.getDecodedCursor(); + } PaginationInfo pInfo = new PaginationInfo(limit, decodedCursor); - CursorResult> cursorResult = repository - .getSubmodelElements(submodelIdentifier.getIdentifier(), pInfo); + CursorResult> cursorResult = repository.getSubmodelElements(submodelIdentifier.getIdentifier(), pInfo); GetSubmodelElementsResult paginatedSubmodelElement = new GetSubmodelElementsResult(); String encodedCursor = getEncodedCursorFromCursorResult(cursorResult); @@ -205,7 +209,7 @@ public ResponseEntity getFileByPath(Base64UrlEncodedIdentifier submode return new ResponseEntity(HttpStatus.NOT_FOUND); } catch (ElementNotAFileException e) { return new ResponseEntity(HttpStatus.PRECONDITION_FAILED); - } catch(FileNotFoundException e) { + } catch (FileNotFoundException e) { return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); } } @@ -272,16 +276,18 @@ private OperationResult createOperationResult(OperationVariable[] result) { } private String getEncodedCursorFromCursorResult(CursorResult cursorResult) { - if (cursorResult == null || cursorResult.getCursor() == null) + if (cursorResult == null || cursorResult.getCursor() == null) { return null; + } return Base64UrlEncodedCursor.encodeCursor(cursorResult.getCursor()); } - + private void closeInputStream(InputStream fileInputstream) { - if (fileInputstream == null) + if (fileInputstream == null) { return; - + } + try { fileInputstream.close(); } catch (IOException e) { diff --git a/basyx.submodelrepository/basyx.submodelrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/http/SubmodelRepositoryHTTPApi.java b/basyx.submodelrepository/basyx.submodelrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/http/SubmodelRepositoryHTTPApi.java index 8d5567f45..a25f7336b 100644 --- a/basyx.submodelrepository/basyx.submodelrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/http/SubmodelRepositoryHTTPApi.java +++ b/basyx.submodelrepository/basyx.submodelrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/http/SubmodelRepositoryHTTPApi.java @@ -1,27 +1,24 @@ -/******************************************************************************* +/** * Copyright (C) 2023 the Eclipse BaSyx Authors - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + *

+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to the following conditions: + *

+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + * Software. + *

+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *

* SPDX-License-Identifier: MIT - ******************************************************************************/ + *

+ * NOTE: This class is auto generated by the swagger code generator program (3.0.29). + * https://github.com/swagger-api/swagger-codegen Do not edit the class manually. + */ /** * NOTE: This class is auto generated by the swagger code generator program (3.0.29). @@ -32,13 +29,14 @@ import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.Min; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.Size; import org.eclipse.digitaltwin.aas4j.v3.model.Submodel; import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement; import org.eclipse.digitaltwin.basyx.http.Base64UrlEncodedIdentifier; +import org.eclipse.digitaltwin.basyx.http.Base64UrlEncodedIdentifierSize; import org.eclipse.digitaltwin.basyx.http.model.OperationRequest; import org.eclipse.digitaltwin.basyx.http.model.OperationResult; import org.eclipse.digitaltwin.basyx.http.model.Result; @@ -66,9 +64,10 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2022-01-10T15:59:05.892Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2022-01-10T15:59:05.892Z[GMT]") @Validated public interface SubmodelRepositoryHTTPApi { + @Operation(summary = "Returns all Submodels", description = "", tags = { "Submodel Repository API" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Requested Submodels", content = @Content(mediaType = "application/json", schema = @Schema(implementation = GetSubmodelsResult.class))), @@ -83,7 +82,7 @@ public interface SubmodelRepositoryHTTPApi { @ApiResponse(responseCode = "200", description = "Default error handling for unmentioned status codes", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))) }) @RequestMapping(value = "/submodels", produces = { "application/json" }, method = RequestMethod.GET) ResponseEntity getAllSubmodels( - @Size(min = 1, max = 3072) @Parameter(in = ParameterIn.QUERY, description = "The value of the semantic id reference (UTF8-BASE64-URL-encoded)", schema = @Schema()) @Valid @RequestParam(value = "semanticId", required = false) Base64UrlEncodedIdentifier semanticId, + @Base64UrlEncodedIdentifierSize(min = 1, max = 3072) @Parameter(in = ParameterIn.QUERY, description = "The value of the semantic id reference (UTF8-BASE64-URL-encoded)", schema = @Schema()) @Valid @RequestParam(value = "semanticId", required = false) Base64UrlEncodedIdentifier semanticId, @Parameter(in = ParameterIn.QUERY, description = "The Asset Administration Shell’s IdShort", schema = @Schema()) @Valid @RequestParam(value = "idShort", required = false) String idShort, @Min(1) @Parameter(in = ParameterIn.QUERY, description = "The maximum number of elements in the response array", schema = @Schema(allowableValues = { "1" }, minimum = "1")) @Valid @RequestParam(value = "limit", required = false) Integer limit, @@ -93,7 +92,6 @@ ResponseEntity getAllSubmodels( @Parameter(in = ParameterIn.QUERY, description = "Determines to which extent the resource is being serialized", schema = @Schema(allowableValues = { "withBlobValue", "withoutBlobValue" }, defaultValue = "withoutBlobValue")) @Valid @RequestParam(value = "extent", required = false, defaultValue = "withoutBlobValue") String extent); - @Operation(summary = "Returns a specific Submodel", description = "", tags = { "Submodel Repository API" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Requested Submodel", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Submodel.class))), @@ -139,8 +137,7 @@ ResponseEntity getSubmodelByIdValueOnly( "withoutBlobValue" }, defaultValue = "withoutBlobValue")) @Valid @RequestParam(value = "extent", required = false, defaultValue = "withoutBlobValue") String extent); @Operation(summary = "Returns the metadata attributes of a specific Submodel", description = "", tags = { "Submodel Repository API" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Requested Submodel in the metadata representation", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Submodel.class))), + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Requested Submodel in the metadata representation", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Submodel.class))), @ApiResponse(responseCode = "400", description = "Bad Request, e.g. the request parameters of the format of the request body is wrong.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), @@ -176,7 +173,6 @@ ResponseEntity getSubmodelByIdMetadata( @RequestMapping(value = "/submodels", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.POST) ResponseEntity postSubmodel(@Parameter(in = ParameterIn.DEFAULT, description = "Submodel object", required = true, schema = @Schema()) @Valid @RequestBody Submodel body); - @Operation(summary = "Updates an existing Submodel", description = "", tags = { "Submodel Repository API" }) @ApiResponses(value = { @ApiResponse(responseCode = "204", description = "Submodel updated successfully"), @@ -335,7 +331,6 @@ ResponseEntity postSubmodelElementByPathSubmodelRepo( @Parameter(in = ParameterIn.QUERY, description = "Determines to which extent the resource is being serialized", schema = @Schema(allowableValues = { "withBlobValue", "withoutBlobValue" }, defaultValue = "withoutBlobValue")) @Valid @RequestParam(value = "extent", required = false, defaultValue = "withoutBlobValue") String extent); - @Operation(summary = "Creates a new submodel element", description = "", tags = { "Submodel Repository API" }) @ApiResponses(value = { @ApiResponse(responseCode = "201", description = "Submodel element created successfully", content = @Content(mediaType = "application/json", schema = @Schema(implementation = SubmodelElement.class))), @@ -357,7 +352,6 @@ ResponseEntity postSubmodelElementSubmodelRepo( @Parameter(in = ParameterIn.PATH, description = "The Submodel’s unique id (UTF8-BASE64-URL-encoded)", required = true, schema = @Schema()) @PathVariable("submodelIdentifier") Base64UrlEncodedIdentifier submodelIdentifier, @Parameter(in = ParameterIn.DEFAULT, description = "Requested submodel element", required = true, schema = @Schema()) @Valid @RequestBody SubmodelElement body); - @Operation(summary = "Deletes a submodel element at a specified path within the submodel elements hierarchy", description = "", tags = { "Submodel Repository API" }) @ApiResponses(value = { @ApiResponse(responseCode = "204", description = "Submodel element deleted successfully"), @@ -376,68 +370,65 @@ ResponseEntity postSubmodelElementSubmodelRepo( ResponseEntity deleteSubmodelElementByPathSubmodelRepo( @Parameter(in = ParameterIn.PATH, description = "The Submodel’s unique id (UTF8-BASE64-URL-encoded)", required = true, schema = @Schema()) @PathVariable("submodelIdentifier") Base64UrlEncodedIdentifier submodelIdentifier, @Parameter(in = ParameterIn.PATH, description = "IdShort path to the submodel element (dot-separated)", required = true, schema = @Schema()) @PathVariable("idShortPath") String idShortPath); - - @Operation(summary = "Downloads file content from a specific submodel element from the Submodel at a specified path", description = "", tags={ "Asset Administration Shell API" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Requested file", content = @Content(mediaType = "application/octet-stream", schema = @Schema(implementation = Resource.class))), - - @ApiResponse(responseCode = "400", description = "Bad Request, e.g. the request parameters of the format of the request body is wrong.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "401", description = "Unauthorized, e.g. the server refused the authorization attempt.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "200", description = "Default error handling for unmentioned status codes", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))) }) - @RequestMapping(value = "/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/attachment", - produces = { "application/octet-stream", "application/json" }, - method = RequestMethod.GET) - ResponseEntity getFileByPath(@Parameter(in = ParameterIn.PATH, description = "The Submodel’s unique id (UTF8-BASE64-URL-encoded)", required=true, schema=@Schema()) @PathVariable("submodelIdentifier") Base64UrlEncodedIdentifier submodelIdentifier, @Parameter(in = ParameterIn.PATH, description = "IdShort path to the submodel element (dot-separated)", required=true, schema=@Schema()) @PathVariable("idShortPath") String idShortPath); - - @Operation(summary = "Uploads file content to an existing submodel element at a specified path within submodel elements hierarchy", description = "", tags={ "Asset Administration Shell API" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "204", description = "Submodel element updated successfully"), - - @ApiResponse(responseCode = "400", description = "Bad Request, e.g. the request parameters of the format of the request body is wrong.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "401", description = "Unauthorized, e.g. the server refused the authorization attempt.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "200", description = "Default error handling for unmentioned status codes", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))) }) - @RequestMapping(value = "/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/attachment", - produces = { "application/json" }, - consumes = { "multipart/form-data" }, - method = RequestMethod.PUT) - ResponseEntity putFileByPath(@Parameter(in = ParameterIn.PATH, description = "The Submodel’s unique id (UTF8-BASE64-URL-encoded)", required=true, schema=@Schema()) @PathVariable("submodelIdentifier") Base64UrlEncodedIdentifier submodelIdentifier, @Parameter(in = ParameterIn.PATH, description = "IdShort path to the submodel element (dot-separated)", required=true, schema=@Schema()) @PathVariable("idShortPath") String idShortPath, @Parameter(in = ParameterIn.DEFAULT, description = "", required=true,schema=@Schema()) @RequestParam(value="fileName", required=true) String fileName, @Parameter(description = "file detail") @Valid @RequestPart("file") MultipartFile file); - - @Operation(summary = "Deletes file content of an existing submodel element at a specified path within submodel elements hierarchy", description = "", tags={ "Asset Administration Shell API" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Submodel element updated successfully"), - - @ApiResponse(responseCode = "400", description = "Bad Request, e.g. the request parameters of the format of the request body is wrong.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "401", description = "Unauthorized, e.g. the server refused the authorization attempt.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), - - @ApiResponse(responseCode = "200", description = "Default error handling for unmentioned status codes", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))) }) - @RequestMapping(value = "/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/attachment", - produces = { "application/json" }, - method = RequestMethod.DELETE) - ResponseEntity deleteFileByPath(@Parameter(in = ParameterIn.PATH, description = "The Submodel’s unique id (UTF8-BASE64-URL-encoded)", required=true, schema=@Schema()) @PathVariable("submodelIdentifier") Base64UrlEncodedIdentifier submodelIdentifier, @Parameter(in = ParameterIn.PATH, description = "IdShort path to the submodel element (dot-separated)", required=true, schema=@Schema()) @PathVariable("idShortPath") String idShortPath); + @Operation(summary = "Downloads file content from a specific submodel element from the Submodel at a specified path", description = "", tags = { "Asset Administration Shell API" }) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Requested file", content = @Content(mediaType = "application/octet-stream", schema = @Schema(implementation = Resource.class))), + + @ApiResponse(responseCode = "400", description = "Bad Request, e.g. the request parameters of the format of the request body is wrong.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "401", description = "Unauthorized, e.g. the server refused the authorization attempt.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "200", description = "Default error handling for unmentioned status codes", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))) }) + @RequestMapping(value = "/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/attachment", produces = { "application/octet-stream", "application/json" }, method = RequestMethod.GET) + ResponseEntity getFileByPath( + @Parameter(in = ParameterIn.PATH, description = "The Submodel’s unique id (UTF8-BASE64-URL-encoded)", required = true, schema = @Schema()) @PathVariable("submodelIdentifier") Base64UrlEncodedIdentifier submodelIdentifier, + @Parameter(in = ParameterIn.PATH, description = "IdShort path to the submodel element (dot-separated)", required = true, schema = @Schema()) @PathVariable("idShortPath") String idShortPath); + + @Operation(summary = "Uploads file content to an existing submodel element at a specified path within submodel elements hierarchy", description = "", tags = { "Asset Administration Shell API" }) + @ApiResponses(value = { @ApiResponse(responseCode = "204", description = "Submodel element updated successfully"), + + @ApiResponse(responseCode = "400", description = "Bad Request, e.g. the request parameters of the format of the request body is wrong.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "401", description = "Unauthorized, e.g. the server refused the authorization attempt.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "200", description = "Default error handling for unmentioned status codes", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))) }) + @RequestMapping(value = "/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/attachment", produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.PUT) + ResponseEntity putFileByPath( + @Parameter(in = ParameterIn.PATH, description = "The Submodel’s unique id (UTF8-BASE64-URL-encoded)", required = true, schema = @Schema()) @PathVariable("submodelIdentifier") Base64UrlEncodedIdentifier submodelIdentifier, + @Parameter(in = ParameterIn.PATH, description = "IdShort path to the submodel element (dot-separated)", required = true, schema = @Schema()) @PathVariable("idShortPath") String idShortPath, + @Parameter(in = ParameterIn.DEFAULT, description = "", required = true, schema = @Schema()) @RequestParam(value = "fileName", required = true) String fileName, + @Parameter(description = "file detail") @Valid @RequestPart("file") MultipartFile file); + + @Operation(summary = "Deletes file content of an existing submodel element at a specified path within submodel elements hierarchy", description = "", tags = { "Asset Administration Shell API" }) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Submodel element updated successfully"), + + @ApiResponse(responseCode = "400", description = "Bad Request, e.g. the request parameters of the format of the request body is wrong.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "401", description = "Unauthorized, e.g. the server refused the authorization attempt.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), + + @ApiResponse(responseCode = "200", description = "Default error handling for unmentioned status codes", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))) }) + @RequestMapping(value = "/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/attachment", produces = { "application/json" }, method = RequestMethod.DELETE) + ResponseEntity deleteFileByPath( + @Parameter(in = ParameterIn.PATH, description = "The Submodel’s unique id (UTF8-BASE64-URL-encoded)", required = true, schema = @Schema()) @PathVariable("submodelIdentifier") Base64UrlEncodedIdentifier submodelIdentifier, + @Parameter(in = ParameterIn.PATH, description = "IdShort path to the submodel element (dot-separated)", required = true, schema = @Schema()) @PathVariable("idShortPath") String idShortPath); @Operation(summary = "Synchronously or asynchronously invokes an Operation at a specified path", description = "", tags = { "Submodel Repository API" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Operation result object", content = @Content(mediaType = "application/json", schema = @Schema(implementation = OperationResult.class))), diff --git a/basyx.submodelrepository/basyx.submodelrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/http/pagination/GetSubmodelsResult.java b/basyx.submodelrepository/basyx.submodelrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/http/pagination/GetSubmodelsResult.java index 39a0ce661..c8d5fa808 100644 --- a/basyx.submodelrepository/basyx.submodelrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/http/pagination/GetSubmodelsResult.java +++ b/basyx.submodelrepository/basyx.submodelrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/http/pagination/GetSubmodelsResult.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 the Eclipse BaSyx Authors - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,7 +19,7 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ @@ -29,7 +29,7 @@ import java.util.List; import java.util.Objects; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.eclipse.digitaltwin.aas4j.v3.model.Submodel; import org.eclipse.digitaltwin.basyx.http.pagination.PagedResult; @@ -44,9 +44,10 @@ * Paginated wrapper for {@link SubmodelRepository#getAllSubmodels()} */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-05-22T07:02:56.105163402Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-05-22T07:02:56.105163402Z[GMT]") public class GetSubmodelsResult extends PagedResult { + @JsonProperty("result") @Valid private List result = null; @@ -66,7 +67,7 @@ public GetSubmodelsResult addResultItem(Submodel resultItem) { /** * Get result - * + * * @return result **/ @Schema(description = "") diff --git a/basyx.submodelrepository/basyx.submodelrepository.component/Dockerfile b/basyx.submodelrepository/basyx.submodelrepository.component/Dockerfile index aae318acd..c6f045a36 100644 --- a/basyx.submodelrepository/basyx.submodelrepository.component/Dockerfile +++ b/basyx.submodelrepository/basyx.submodelrepository.component/Dockerfile @@ -1,11 +1,11 @@ -FROM amazoncorretto:11 +FROM amazoncorretto:17 USER nobody WORKDIR /application ARG JAR_FILE=target/*-exec.jar COPY ${JAR_FILE} basyxExecutable.jar COPY src/main/resources/application.properties application.properties ARG PORT=8081 -ENV PORT=${PORT} -EXPOSE ${PORT} +ENV SERVER_PORT=${PORT} +EXPOSE ${SERVER_PORT} HEALTHCHECK --interval=30s --timeout=3s --retries=3 --start-period=15s CMD curl --fail http://localhost:${PORT}/actuator/health || exit 1 ENTRYPOINT ["java","-jar","basyxExecutable.jar"] diff --git a/basyx.submodelrepository/basyx.submodelrepository.component/pom.xml b/basyx.submodelrepository/basyx.submodelrepository.component/pom.xml index da656eaa7..7e95bfdfc 100644 --- a/basyx.submodelrepository/basyx.submodelrepository.component/pom.xml +++ b/basyx.submodelrepository/basyx.submodelrepository.component/pom.xml @@ -133,11 +133,11 @@ io.fabric8 docker-maven-plugin - 0.43.0 + 0.43.4 - ${docker.username}/${docker.image.name} + ${docker.namespace}/${docker.image.name} ${docker.image.tag} @@ -207,4 +207,4 @@ - \ No newline at end of file + diff --git a/basyx.submodelservice/basyx.submodelservice-core/src/main/java/org/eclipse/digitaltwin/basyx/pagination/GetSubmodelElementsResult.java b/basyx.submodelservice/basyx.submodelservice-core/src/main/java/org/eclipse/digitaltwin/basyx/pagination/GetSubmodelElementsResult.java index 3d9f05a1b..320316a1d 100644 --- a/basyx.submodelservice/basyx.submodelservice-core/src/main/java/org/eclipse/digitaltwin/basyx/pagination/GetSubmodelElementsResult.java +++ b/basyx.submodelservice/basyx.submodelservice-core/src/main/java/org/eclipse/digitaltwin/basyx/pagination/GetSubmodelElementsResult.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 the Eclipse BaSyx Authors - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,7 +19,7 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ @@ -29,7 +29,7 @@ import java.util.List; import java.util.Objects; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement; import org.eclipse.digitaltwin.basyx.http.pagination.PagedResult; @@ -43,9 +43,10 @@ * Paginated wrapper for getSubmodelElements */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-05-22T07:02:56.105163402Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-05-22T07:02:56.105163402Z[GMT]") public class GetSubmodelElementsResult extends PagedResult { + @JsonProperty("result") @Valid private List result = null; @@ -65,7 +66,7 @@ public GetSubmodelElementsResult addResultItem(SubmodelElement resultItem) { /** * Get result - * + * * @return result **/ @Schema(description = "") diff --git a/basyx.submodelservice/basyx.submodelservice-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/http/SubmodelServiceHTTPApi.java b/basyx.submodelservice/basyx.submodelservice-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/http/SubmodelServiceHTTPApi.java index 950923906..f3a9527bb 100644 --- a/basyx.submodelservice/basyx.submodelservice-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/http/SubmodelServiceHTTPApi.java +++ b/basyx.submodelservice/basyx.submodelservice-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/http/SubmodelServiceHTTPApi.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (C) 2023 the Eclipse BaSyx Authors - * + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -8,10 +8,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -19,14 +19,14 @@ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * SPDX-License-Identifier: MIT ******************************************************************************/ package org.eclipse.digitaltwin.basyx.submodelservice.http; -import javax.validation.Valid; -import javax.validation.constraints.Min; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Min; import org.eclipse.digitaltwin.aas4j.v3.model.Submodel; import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement; @@ -55,7 +55,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-07-16T14:12:09.075410867Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-07-16T14:12:09.075410867Z[GMT]") @Validated public interface SubmodelServiceHTTPApi { diff --git a/basyx.submodelservice/basyx.submodelservice-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/http/SubmodelServiceHTTPApiController.java b/basyx.submodelservice/basyx.submodelservice-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/http/SubmodelServiceHTTPApiController.java index c2b8992cc..a0b37e4a4 100644 --- a/basyx.submodelservice/basyx.submodelservice-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/http/SubmodelServiceHTTPApiController.java +++ b/basyx.submodelservice/basyx.submodelservice-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/http/SubmodelServiceHTTPApiController.java @@ -28,8 +28,8 @@ import java.util.Arrays; import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.Min; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Min; import org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable; import org.eclipse.digitaltwin.aas4j.v3.model.Submodel; @@ -57,7 +57,7 @@ import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.media.Schema; -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-07-20T09:38:58.667119080Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2023-07-20T09:38:58.667119080Z[GMT]") @RestController public class SubmodelServiceHTTPApiController implements SubmodelServiceHTTPApi { @@ -79,18 +79,20 @@ public ResponseEntity deleteSubmodelElementByPath( @Override public ResponseEntity getAllSubmodelElements( @Min(1) @Parameter(in = ParameterIn.QUERY, description = "The maximum number of elements in the response array", schema = @Schema(allowableValues = { - "1" }, minimum = "1")) @Valid @RequestParam(value = "limit", required = false) Integer limit, + "1" }, minimum = "1")) @Valid @RequestParam(value = "limit", required = false) Integer limit, @Parameter(in = ParameterIn.QUERY, description = "A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue", schema = @Schema()) @Valid @RequestParam(value = "cursor", required = false) Base64UrlEncodedCursor cursor, @Parameter(in = ParameterIn.QUERY, description = "Determines the structural depth of the respective resource content", schema = @Schema(allowableValues = { "deep", - "core" }, defaultValue = "deep")) @Valid @RequestParam(value = "level", required = false, defaultValue = "deep") String level, + "core" }, defaultValue = "deep")) @Valid @RequestParam(value = "level", required = false, defaultValue = "deep") String level, @Parameter(in = ParameterIn.QUERY, description = "Determines to which extent the resource is being serialized", schema = @Schema(allowableValues = { "withBlobValue", - "withoutBlobValue" }, defaultValue = "withoutBlobValue")) @Valid @RequestParam(value = "extent", required = false, defaultValue = "withoutBlobValue") String extent) { - if (limit == null) + "withoutBlobValue" }, defaultValue = "withoutBlobValue")) @Valid @RequestParam(value = "extent", required = false, defaultValue = "withoutBlobValue") String extent) { + if (limit == null) { limit = 100; + } String decodedCursor = ""; - if (cursor != null) + if (cursor != null) { decodedCursor = cursor.getDecodedCursor(); + } PaginationInfo pInfo = new PaginationInfo(limit, decodedCursor); CursorResult> submodelElements = service.getSubmodelElements(pInfo); @@ -108,9 +110,9 @@ public ResponseEntity getAllSubmodelElements( @Override public ResponseEntity getSubmodel( @Parameter(in = ParameterIn.QUERY, description = "Determines the structural depth of the respective resource content", schema = @Schema(allowableValues = { "deep", - "core" }, defaultValue = "deep")) @Valid @RequestParam(value = "level", required = false, defaultValue = "deep") String level, + "core" }, defaultValue = "deep")) @Valid @RequestParam(value = "level", required = false, defaultValue = "deep") String level, @Parameter(in = ParameterIn.QUERY, description = "Determines to which extent the resource is being serialized", schema = @Schema(allowableValues = { "withBlobValue", - "withoutBlobValue" }, defaultValue = "withoutBlobValue")) @Valid @RequestParam(value = "extent", required = false, defaultValue = "withoutBlobValue") String extent) { + "withoutBlobValue" }, defaultValue = "withoutBlobValue")) @Valid @RequestParam(value = "extent", required = false, defaultValue = "withoutBlobValue") String extent) { Submodel submodel = service.getSubmodel(); @@ -121,12 +123,12 @@ public ResponseEntity getSubmodel( public ResponseEntity getSubmodelElementByPath( @Parameter(in = ParameterIn.PATH, description = "IdShort path to the submodel element (dot-separated)", required = true, schema = @Schema()) @PathVariable("idShortPath") String idShortPath, @Min(1) @Parameter(in = ParameterIn.QUERY, description = "The maximum number of elements in the response array", schema = @Schema(allowableValues = { - "1" }, minimum = "1")) @Valid @RequestParam(value = "limit", required = false) Integer limit, + "1" }, minimum = "1")) @Valid @RequestParam(value = "limit", required = false) Integer limit, @Parameter(in = ParameterIn.QUERY, description = "A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue", schema = @Schema()) @Valid @RequestParam(value = "cursor", required = false) Base64UrlEncodedCursor cursor, @Parameter(in = ParameterIn.QUERY, description = "Determines the structural depth of the respective resource content", schema = @Schema(allowableValues = { "deep", - "core" }, defaultValue = "deep")) @Valid @RequestParam(value = "level", required = false, defaultValue = "deep") String level, + "core" }, defaultValue = "deep")) @Valid @RequestParam(value = "level", required = false, defaultValue = "deep") String level, @Parameter(in = ParameterIn.QUERY, description = "Determines to which extent the resource is being serialized", schema = @Schema(allowableValues = { "withBlobValue", - "withoutBlobValue" }, defaultValue = "withoutBlobValue")) @Valid @RequestParam(value = "extent", required = false, defaultValue = "withoutBlobValue") String extent) { + "withoutBlobValue" }, defaultValue = "withoutBlobValue")) @Valid @RequestParam(value = "extent", required = false, defaultValue = "withoutBlobValue") String extent) { SubmodelElement submodelElement = service.getSubmodelElement(idShortPath); @@ -137,12 +139,12 @@ public ResponseEntity getSubmodelElementByPath( public ResponseEntity getSubmodelElementByPathValueOnly( @Parameter(in = ParameterIn.PATH, description = "IdShort path to the submodel element (dot-separated)", required = true, schema = @Schema()) @PathVariable("idShortPath") String idShortPath, @Min(1) @Parameter(in = ParameterIn.QUERY, description = "The maximum number of elements in the response array", schema = @Schema(allowableValues = { - "1" }, minimum = "1")) @Valid @RequestParam(value = "limit", required = false) Integer limit, + "1" }, minimum = "1")) @Valid @RequestParam(value = "limit", required = false) Integer limit, @Parameter(in = ParameterIn.QUERY, description = "A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue", schema = @Schema()) @Valid @RequestParam(value = "cursor", required = false) Base64UrlEncodedCursor cursor, @Parameter(in = ParameterIn.QUERY, description = "Determines the structural depth of the respective resource content", schema = @Schema(allowableValues = { "deep", - "core" }, defaultValue = "deep")) @Valid @RequestParam(value = "level", required = false, defaultValue = "deep") String level, + "core" }, defaultValue = "deep")) @Valid @RequestParam(value = "level", required = false, defaultValue = "deep") String level, @Parameter(in = ParameterIn.QUERY, description = "Determines to which extent the resource is being serialized", schema = @Schema(allowableValues = { "withBlobValue", - "withoutBlobValue" }, defaultValue = "withoutBlobValue")) @Valid @RequestParam(value = "extent", required = false, defaultValue = "withoutBlobValue") String extent) { + "withoutBlobValue" }, defaultValue = "withoutBlobValue")) @Valid @RequestParam(value = "extent", required = false, defaultValue = "withoutBlobValue") String extent) { SubmodelElementValue submodelElementValue = service.getSubmodelElementValue(idShortPath); @@ -151,7 +153,7 @@ public ResponseEntity getSubmodelElementByPathValueOnly( @Override public ResponseEntity getSubmodelMetadata(@Parameter(in = ParameterIn.QUERY, description = "Determines the structural depth of the respective resource content", schema = @Schema(allowableValues = { "deep", - "core" }, defaultValue = "deep")) @Valid @RequestParam(value = "level", required = false, defaultValue = "deep") String level) { + "core" }, defaultValue = "deep")) @Valid @RequestParam(value = "level", required = false, defaultValue = "deep") String level) { Submodel submodel = service.getSubmodel(); submodel.setSubmodelElements(null); @@ -162,12 +164,11 @@ public ResponseEntity getSubmodelMetadata(@Parameter(in = ParameterIn. @Override public ResponseEntity getSubmodelValueOnly( @Parameter(in = ParameterIn.QUERY, description = "Determines the structural depth of the respective resource content", schema = @Schema(allowableValues = { "deep", - "core" }, defaultValue = "deep")) @Valid @RequestParam(value = "level", required = false, defaultValue = "deep") String level, + "core" }, defaultValue = "deep")) @Valid @RequestParam(value = "level", required = false, defaultValue = "deep") String level, @Parameter(in = ParameterIn.QUERY, description = "Determines to which extent the resource is being serialized", schema = @Schema(allowableValues = { "withBlobValue", - "withoutBlobValue" }, defaultValue = "withoutBlobValue")) @Valid @RequestParam(value = "extent", required = false, defaultValue = "withoutBlobValue") String extent) { + "withoutBlobValue" }, defaultValue = "withoutBlobValue")) @Valid @RequestParam(value = "extent", required = false, defaultValue = "withoutBlobValue") String extent) { - SubmodelValueOnly result = new SubmodelValueOnly( - service.getSubmodelElements(NO_LIMIT_PAGINATION_INFO).getResult()); + SubmodelValueOnly result = new SubmodelValueOnly(service.getSubmodelElements(NO_LIMIT_PAGINATION_INFO).getResult()); return new ResponseEntity(result, HttpStatus.OK); } @@ -177,10 +178,10 @@ public ResponseEntity patchSubmodelElementByPathValueOnly( @Parameter(in = ParameterIn.PATH, description = "IdShort path to the submodel element (dot-separated)", required = true, schema = @Schema()) @PathVariable("idShortPath") String idShortPath, @Parameter(in = ParameterIn.DEFAULT, description = "The SubmodelElement in its ValueOnly representation", required = true, schema = @Schema()) @Valid @RequestBody SubmodelElementValue body, @Min(1) @Parameter(in = ParameterIn.QUERY, description = "The maximum number of elements in the response array", schema = @Schema(allowableValues = { - "1" }, minimum = "1")) @Valid @RequestParam(value = "limit", required = false) Integer limit, + "1" }, minimum = "1")) @Valid @RequestParam(value = "limit", required = false) Integer limit, @Parameter(in = ParameterIn.QUERY, description = "A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue", schema = @Schema()) @Valid @RequestParam(value = "cursor", required = false) Base64UrlEncodedCursor cursor, @Parameter(in = ParameterIn.QUERY, description = "Determines the structural depth of the respective resource content", schema = @Schema(allowableValues = { - "core" }, defaultValue = "core")) @Valid @RequestParam(value = "level", required = false, defaultValue = "core") String level) { + "core" }, defaultValue = "core")) @Valid @RequestParam(value = "level", required = false, defaultValue = "core") String level) { service.setSubmodelElementValue(idShortPath, body); return new ResponseEntity(HttpStatus.NO_CONTENT); } @@ -188,7 +189,7 @@ public ResponseEntity patchSubmodelElementByPathValueOnly( @Override public ResponseEntity postSubmodelElement(@Parameter(in = ParameterIn.DEFAULT, description = "Requested submodel element", required = true, schema = @Schema()) @Valid @RequestBody SubmodelElement body, @Parameter(in = ParameterIn.QUERY, description = "Determines the structural depth of the respective resource content", schema = @Schema(allowableValues = { "deep", - "core" }, defaultValue = "deep")) @Valid @RequestParam(value = "level", required = false, defaultValue = "deep") String level) { + "core" }, defaultValue = "deep")) @Valid @RequestParam(value = "level", required = false, defaultValue = "deep") String level) { service.createSubmodelElement(body); return new ResponseEntity(HttpStatus.CREATED); } @@ -218,8 +219,9 @@ private OperationResult createOperationResult(OperationVariable[] result) { } private String getEncodedCursorFromCursorResult(CursorResult cursorResult) { - if (cursorResult == null || cursorResult.getCursor() == null) + if (cursorResult == null || cursorResult.getCursor() == null) { return null; + } return Base64UrlEncodedCursor.encodeCursor(cursorResult.getCursor()); } diff --git a/basyx.submodelservice/basyx.submodelservice.component/Dockerfile b/basyx.submodelservice/basyx.submodelservice.component/Dockerfile index 6f239ba9b..556832735 100644 --- a/basyx.submodelservice/basyx.submodelservice.component/Dockerfile +++ b/basyx.submodelservice/basyx.submodelservice.component/Dockerfile @@ -1,4 +1,4 @@ -FROM amazoncorretto:11 +FROM amazoncorretto:17 USER nobody WORKDIR /application ARG JAR_FILE=target/*-exec.jar diff --git a/pom.xml b/pom.xml index 184eceb72..fda865685 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 2.7.10 + 3.1.4 org.eclipse.digitaltwin.basyx @@ -36,18 +36,20 @@ - Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. + Fraunhofer-Gesellschaft zur Foerderung der angewandten + Forschung e.V. fschnicke Frank Schnicke frank.schnicke@iese.fraunhofer.de - 11 + 17 UTF-8 UTF-8 2.0.0-SNAPSHOT - eclipsebasyx + + eclipsebasyx ${revision} 8081 8081 @@ -141,13 +143,6 @@ org.apache.maven.plugins maven-failsafe-plugin 3.1.2 - - - org.apache.maven.surefire - surefire-junit47 - 3.1.2 - - integration-test @@ -225,8 +220,8 @@ org.springdoc - springdoc-openapi-ui - 1.7.0 + springdoc-openapi-starter-webmvc-ui + 2.2.0 org.eclipse.paho @@ -794,4 +789,4 @@ test - \ No newline at end of file +