From dae58b2b3f4738c87c4e6c08dd5e01a5d764fda6 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Thu, 14 Sep 2023 19:12:37 +0200 Subject: [PATCH 01/12] feature: TRACEFOSS-873 add possible filter values endpoints --- CHANGELOG.md | 2 + .../asbuilt/rest/AssetAsBuiltController.java | 54 ++++++++++++- .../rest/AssetAsPlannedController.java | 52 +++++++++++++ .../base/service/AssetBaseService.java | 1 + .../assets/domain/base/AssetRepository.java | 2 + .../service/AbstractAssetBaseService.java | 28 ++++++- .../AssetAsBuiltRepositoryImpl.java | 15 ++++ .../AssetAsPlannedRepositoryImpl.java | 15 ++++ .../common/repository/EntityNameMapper.java | 30 +++++++ .../service/AbstractAssetBaseServiceTest.java | 73 +++++++++++++++++ .../AssetAsBuiltControllerFilterValuesIT.java | 78 +++++++++++++++++++ ...ssetAsPlannedControllerFilterValuesIT.java | 78 +++++++++++++++++++ .../repository/AssetAsBuiltRepositoryIT.java | 70 +++++++++++++++++ .../AssetAsPlannedRepositoryIT.java | 72 +++++++++++++++++ 14 files changed, 566 insertions(+), 4 deletions(-) create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/repository/EntityNameMapper.java create mode 100644 tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseServiceTest.java create mode 100644 tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerFilterValuesIT.java create mode 100644 tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerFilterValuesIT.java create mode 100644 tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/asbuilt/infrastructure/repository/AssetAsBuiltRepositoryIT.java create mode 100644 tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/asplanned/infrastructure/repository/AssetAsPlannedRepositoryIT.java diff --git a/CHANGELOG.md b/CHANGELOG.md index cfd4ba0e5f..53132a9e99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - NEW API DELETE /api/registry - NEW API GET /api/shelldescriptors - cascading sorting functionality by allowing multiple sort query parameters on APIs +- NEW API GET /api/assets/as-planned/distinctFilterValues +- NEW API GET /api/assets/as-built/distinctFilterValues ### Changed - API BREAKING CHANGE: /api/assets changed to /api/assets/as-built diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asbuilt/rest/AssetAsBuiltController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asbuilt/rest/AssetAsBuiltController.java index 09c7222e86..5e334c8541 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asbuilt/rest/AssetAsBuiltController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asbuilt/rest/AssetAsBuiltController.java @@ -39,7 +39,6 @@ import org.eclipse.tractusx.traceability.assets.application.base.service.AssetBaseService; import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; import org.eclipse.tractusx.traceability.common.model.PageResult; -import org.eclipse.tractusx.traceability.common.model.SearchCriteria; import org.eclipse.tractusx.traceability.common.request.OwnPageable; import org.eclipse.tractusx.traceability.common.request.SearchCriteriaRequestParam; import org.eclipse.tractusx.traceability.common.response.ErrorResponse; @@ -169,6 +168,59 @@ public PageResult assets(OwnPageable pageable, @QueryParam return AssetAsBuiltResponseMapper.from(assetBaseService.getAssets(OwnPageable.toPageable(pageable), filter.toSearchCriteria())); } + + @Operation(operationId = "distinctFilterValues", + summary = "getDistinctFilterValues", + tags = {"Assets"}, + description = "The endpoint returns a distinct filter values for given fieldName.", + security = @SecurityRequirement(name = "oAuth2", scopes = "profile email")) + @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Returns a distinct filter values for given fieldName.", content = @Content( + mediaType = "application/json", + array = @ArraySchema( + arraySchema = @Schema( + description = "FilterValues", + implementation = String.class, + additionalProperties = Schema.AdditionalPropertiesValue.FALSE + ), + maxItems = Integer.MAX_VALUE, + minItems = 0) + )), + @ApiResponse( + responseCode = "400", + description = "Bad request.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse( + responseCode = "401", + description = "Authorization failed.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class))), + + @ApiResponse( + responseCode = "403", + description = "Forbidden.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse( + responseCode = "429", + description = "Too many requests.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class)))}) + @GetMapping("distinctFilterValues") + public List distinctFilterValues(@QueryParam("fieldName") String fieldName, @QueryParam("size") Long size) { + return assetBaseService.getDistinctFilterValues(fieldName, size); + } + @Operation(operationId = "assetsCountryMap", summary = "Get map of assets", tags = {"Assets"}, diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asplanned/rest/AssetAsPlannedController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asplanned/rest/AssetAsPlannedController.java index fbeb6e1788..809c468c0d 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asplanned/rest/AssetAsPlannedController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asplanned/rest/AssetAsPlannedController.java @@ -163,6 +163,58 @@ public PageResult assets(OwnPageable pageable, @QueryPar return AssetAsPlannedResponseMapper.from(assetService.getAssets(OwnPageable.toPageable(pageable), filter.toSearchCriteria())); } + @Operation(operationId = "distinctFilterValues", + summary = "getDistinctFilterValues", + tags = {"Assets"}, + description = "The endpoint returns a distinct filter values for given fieldName.", + security = @SecurityRequirement(name = "oAuth2", scopes = "profile email")) + @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Returns a distinct filter values for given fieldName.", content = @Content( + mediaType = "application/json", + array = @ArraySchema( + arraySchema = @Schema( + description = "FilterValues", + implementation = String.class, + additionalProperties = Schema.AdditionalPropertiesValue.FALSE + ), + maxItems = Integer.MAX_VALUE, + minItems = 0) + )), + @ApiResponse( + responseCode = "400", + description = "Bad request.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse( + responseCode = "401", + description = "Authorization failed.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class))), + + @ApiResponse( + responseCode = "403", + description = "Forbidden.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse( + responseCode = "429", + description = "Too many requests.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ErrorResponse.class)))}) + @GetMapping("distinctFilterValues") + public List distinctFilterValues(@QueryParam("fieldName") String fieldName, @QueryParam("size") Long size) { + return assetService.getDistinctFilterValues(fieldName, size); + } + @Operation(operationId = "assetById", summary = "Get asset by id", tags = {"Assets"}, diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/base/service/AssetBaseService.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/base/service/AssetBaseService.java index 5deee82fc7..8d858c1c04 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/base/service/AssetBaseService.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/base/service/AssetBaseService.java @@ -50,4 +50,5 @@ public interface AssetBaseService { AssetBase updateQualityType(String assetId, QualityType qualityType); + List getDistinctFilterValues(String fieldName, Long size); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/AssetRepository.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/AssetRepository.java index 470569a7c2..53eac888b5 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/AssetRepository.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/AssetRepository.java @@ -49,4 +49,6 @@ public interface AssetRepository { void updateParentDescriptionsAndOwner(final AssetBase asset); long countAssetsByOwner(Owner owner); + + List getFieldValues(String fieldName, Long resultLimit); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseService.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseService.java index ea1d3ee889..7edda3eef0 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseService.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseService.java @@ -25,18 +25,20 @@ import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; import org.eclipse.tractusx.traceability.assets.domain.base.model.QualityType; +import org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel; import org.eclipse.tractusx.traceability.assets.infrastructure.asbuilt.model.ManufacturingInfo; -import org.eclipse.tractusx.traceability.common.model.SearchCriteria; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.request.BomLifecycle; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.Direction; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect; import org.eclipse.tractusx.traceability.common.config.AssetsAsyncConfig; import org.eclipse.tractusx.traceability.common.model.PageResult; +import org.eclipse.tractusx.traceability.common.model.SearchCriteria; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotification; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationStatus; import org.springframework.data.domain.Pageable; import org.springframework.scheduling.annotation.Async; +import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -44,6 +46,8 @@ @Slf4j public abstract class AbstractAssetBaseService implements AssetBaseService { + private static List SUPPORTED_ENUM_FIELDS = List.of("owner", "qualityType", "semanticDataModel"); + protected abstract AssetRepository getAssetRepository(); protected abstract IrsRepository getIrsRepository(); @@ -54,7 +58,6 @@ public abstract class AbstractAssetBaseService implements AssetBaseService { protected abstract BomLifecycle getBomLifecycle(); - @Async(value = AssetsAsyncConfig.SYNCHRONIZE_ASSETS_EXECUTOR) public void synchronizeAssetsAsync(String globalAssetId) { log.info("Synchronizing assets for globalAssetId: {}", globalAssetId); @@ -112,7 +115,6 @@ public void setAssetsAlertStatus(QualityNotification alert) { } - public AssetBase updateQualityType(String assetId, QualityType qualityType) { AssetBase foundAsset = getAssetRepository().getAssetById(assetId); foundAsset.setQualityType(qualityType); @@ -142,4 +144,24 @@ public Map getAssetsCountryMap() { .collect(Collectors.groupingBy( asset -> ManufacturingInfo.from(asset.getDetailAspectModels()).getManufacturingCountry(), Collectors.counting())); } + + public List getDistinctFilterValues(String fieldName, Long size) { + if (isSupportedEnumType(fieldName)) { + return getAssetEnumFieldValues(fieldName); + } + return getAssetRepository().getFieldValues(fieldName, size); + } + + private boolean isSupportedEnumType(String fieldName) { + return SUPPORTED_ENUM_FIELDS.contains(fieldName); + } + + private List getAssetEnumFieldValues(String fieldName) { + return switch (fieldName) { + case "owner" -> Arrays.stream(Owner.values()).map(Enum::name).toList(); + case "qualityType" -> Arrays.stream(QualityType.values()).map(Enum::name).toList(); + case "semanticDataModel" -> Arrays.stream(SemanticDataModel.values()).map(Enum::name).toList(); + default -> null; + }; + } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java index c9ff1a4088..5796f9c171 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java @@ -21,6 +21,8 @@ package org.eclipse.tractusx.traceability.assets.infrastructure.asbuilt.repository; +import jakarta.persistence.EntityManager; +import jakarta.persistence.PersistenceContext; import jakarta.transaction.Transactional; import lombok.RequiredArgsConstructor; import org.eclipse.tractusx.traceability.assets.domain.asbuilt.exception.AssetNotFoundException; @@ -36,12 +38,17 @@ import java.util.List; import java.util.Objects; +import static org.eclipse.tractusx.traceability.common.repository.EntityNameMapper.toDatabaseName; + @RequiredArgsConstructor @Component public class AssetAsBuiltRepositoryImpl implements AssetAsBuiltRepository { private final JpaAssetAsBuiltRepository jpaAssetAsBuiltRepository; + @PersistenceContext + private EntityManager entityManager; + @Override @Transactional public AssetBase getAssetById(String assetId) { @@ -79,6 +86,14 @@ public PageResult getAssets(Pageable pageable, List f AssetAsBuiltEntity::toDomain); } + @Override + public List getFieldValues(String fieldName, Long resultLimit) { + String getFieldValuesQuery = "SELECT DISTINCT fieldName FROM assets_as_built order by fieldName ASC LIMIT resultLimit" + .replace("fieldName", toDatabaseName(fieldName)) + .replace("resultLimit", resultLimit.toString()); + return entityManager.createNativeQuery(getFieldValuesQuery, String.class).getResultList(); + } + @Override @Transactional public List getAssets() { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java index 9e32fefd34..7c1c02f933 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java @@ -19,6 +19,8 @@ package org.eclipse.tractusx.traceability.assets.infrastructure.asplanned.repository; +import jakarta.persistence.EntityManager; +import jakarta.persistence.PersistenceContext; import lombok.RequiredArgsConstructor; import org.eclipse.tractusx.traceability.assets.domain.asbuilt.exception.AssetNotFoundException; import org.eclipse.tractusx.traceability.assets.domain.asplanned.repository.AssetAsPlannedRepository; @@ -34,12 +36,17 @@ import java.util.List; import java.util.Objects; +import static org.eclipse.tractusx.traceability.common.repository.EntityNameMapper.toDatabaseName; + @RequiredArgsConstructor @Component public class AssetAsPlannedRepositoryImpl implements AssetAsPlannedRepository { private final JpaAssetAsPlannedRepository jpaAssetAsPlannedRepository; + @PersistenceContext + private EntityManager entityManager; + @Override @Transactional public AssetBase getAssetById(String assetId) { @@ -112,4 +119,12 @@ public long countAssets() { public long countAssetsByOwner(Owner owner) { return jpaAssetAsPlannedRepository.countAssetsByOwner(owner); } + + @Override + public List getFieldValues(String fieldName, Long resultLimit) { + String getFieldValuesQuery = "SELECT DISTINCT fieldName FROM assets_as_planned order by fieldName ASC LIMIT resultLimit" + .replace("fieldName", toDatabaseName(fieldName)) + .replace("resultLimit", resultLimit.toString()); + return entityManager.createNativeQuery(getFieldValuesQuery, String.class).getResultList(); + } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/repository/EntityNameMapper.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/repository/EntityNameMapper.java new file mode 100644 index 0000000000..66d68e9b59 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/repository/EntityNameMapper.java @@ -0,0 +1,30 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.common.repository; + +import lombok.experimental.UtilityClass; + +@UtilityClass +public class EntityNameMapper { + + public static String toDatabaseName(String fieldName) { + return fieldName.replaceAll("(.)([A-Z])", "$1_$2").toLowerCase(); + } +} diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseServiceTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseServiceTest.java new file mode 100644 index 0000000000..977ba72bf2 --- /dev/null +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseServiceTest.java @@ -0,0 +1,73 @@ +package org.eclipse.tractusx.traceability.assets.domain.base.service; + +import org.eclipse.tractusx.traceability.assets.domain.base.AssetRepository; +import org.eclipse.tractusx.traceability.assets.domain.base.IrsRepository; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.request.BomLifecycle; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.List; +import java.util.stream.Stream; + +import static org.assertj.core.api.Assertions.assertThat; + +class AbstractAssetBaseServiceTest { + + TestService service; + + @BeforeEach + void setUp() { + service = new TestService(); + } + + @ParameterizedTest + @MethodSource("enumFieldNamesProvider") + void givenOwnerFieldName(String fieldName, List expectedValues) { + // given params + + // when + List result = service.getDistinctFilterValues(fieldName, 10L); + + // then + assertThat(result).containsAll(expectedValues); + } + + private static Stream enumFieldNamesProvider() { + return Stream.of( + Arguments.of("owner", List.of("SUPPLIER", "CUSTOMER", "OWN", "UNKNOWN")), + Arguments.of("qualityType", List.of("OK", "MINOR", "MAJOR", "CRITICAL", "LIFE_THREATENING")), + Arguments.of("semanticDataModel", List.of("BATCH", "SERIALPART", "UNKNOWN", "PARTASPLANNED", "JUSTINSEQUENCE")) + ); + } + + static class TestService extends AbstractAssetBaseService { + + @Override + protected AssetRepository getAssetRepository() { + return null; + } + + @Override + protected IrsRepository getIrsRepository() { + return null; + } + + @Override + protected List getDownwardAspects() { + return null; + } + + @Override + protected List getUpwardAspects() { + return null; + } + + @Override + protected BomLifecycle getBomLifecycle() { + return null; + } + } + +} diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerFilterValuesIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerFilterValuesIT.java new file mode 100644 index 0000000000..5bda912189 --- /dev/null +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerFilterValuesIT.java @@ -0,0 +1,78 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.integration.assets; + +import io.restassured.http.ContentType; +import org.eclipse.tractusx.traceability.integration.IntegrationTestSpecification; +import org.eclipse.tractusx.traceability.integration.common.support.AssetsSupport; +import org.jose4j.lang.JoseException; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.stream.Stream; + +import static io.restassured.RestAssured.given; +import static org.eclipse.tractusx.traceability.common.security.JwtRole.ADMIN; +import static org.hamcrest.Matchers.is; + +class AssetAsBuiltControllerFilterValuesIT extends IntegrationTestSpecification { + + @Autowired + AssetsSupport assetsSupport; + + @ParameterizedTest + @MethodSource("fieldNameTestProvider") + void givenNotEnumTypeFieldNameAndSize_whenCallDistinctFilterValues_thenProperResponse( + String fieldName, + Long resultLimit, + Integer expectedSize + ) throws JoseException { + // given + assetsSupport.defaultAssetsStored(); + final String fieldNameParam = "fieldName=" + fieldName; + final String sizeParam = "size=" + resultLimit.toString(); + + // then + given() + .header(oAuth2Support.jwtAuthorization(ADMIN)) + .contentType(ContentType.JSON) + .log().all() + .when() + .get("/api/assets/as-built/distinctFilterValues?" + fieldNameParam + "&" + sizeParam) + .then() + .log().all() + .statusCode(200) + .assertThat() + .body("size()", is(expectedSize)); + } + + private static Stream fieldNameTestProvider() { + return Stream.of( + Arguments.of("id", 10L, 10), + Arguments.of("id", 200L, 13), + Arguments.of("inInvestigation", 10L, 1), + Arguments.of("owner", 10L, 4), + Arguments.of("semanticDataModel", 10L, 5), + Arguments.of("qualityType", 10L, 5) + ); + } +} diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerFilterValuesIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerFilterValuesIT.java new file mode 100644 index 0000000000..34a922c8a6 --- /dev/null +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerFilterValuesIT.java @@ -0,0 +1,78 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.integration.assets; + +import io.restassured.http.ContentType; +import org.eclipse.tractusx.traceability.integration.IntegrationTestSpecification; +import org.eclipse.tractusx.traceability.integration.common.support.AssetsSupport; +import org.jose4j.lang.JoseException; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.stream.Stream; + +import static io.restassured.RestAssured.given; +import static org.eclipse.tractusx.traceability.common.security.JwtRole.ADMIN; +import static org.hamcrest.Matchers.is; + +public class AssetAsPlannedControllerFilterValuesIT extends IntegrationTestSpecification { + + @Autowired + AssetsSupport assetsSupport; + + @ParameterizedTest + @MethodSource("fieldNameTestProvider") + void givenNotEnumTypeFieldNameAndSize_whenCallDistinctFilterValues_thenProperResponse( + String fieldName, + Long resultLimit, + Integer expectedSize + ) throws JoseException { + // given + assetsSupport.defaultAssetsAsPlannedStored(); + final String fieldNameParam = "fieldName=" + fieldName; + final String sizeParam = "size=" + resultLimit.toString(); + + // then + given() + .header(oAuth2Support.jwtAuthorization(ADMIN)) + .contentType(ContentType.JSON) + .log().all() + .when() + .get("/api/assets/as-planned/distinctFilterValues?" + fieldNameParam + "&" + sizeParam) + .then() + .log().all() + .statusCode(200) + .assertThat() + .body("size()", is(expectedSize)); + } + + private static Stream fieldNameTestProvider() { + return Stream.of( + Arguments.of("id", 10L, 2), + Arguments.of("id", 1L, 1), + Arguments.of("inInvestigation", 10L, 1), + Arguments.of("owner", 10L, 4), + Arguments.of("semanticDataModel", 10L, 5), + Arguments.of("qualityType", 10L, 5) + ); + } +} diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/asbuilt/infrastructure/repository/AssetAsBuiltRepositoryIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/asbuilt/infrastructure/repository/AssetAsBuiltRepositoryIT.java new file mode 100644 index 0000000000..aa051d81b4 --- /dev/null +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/asbuilt/infrastructure/repository/AssetAsBuiltRepositoryIT.java @@ -0,0 +1,70 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.integration.assets.asbuilt.infrastructure.repository; + +import org.eclipse.tractusx.traceability.assets.domain.asbuilt.repository.AssetAsBuiltRepository; +import org.eclipse.tractusx.traceability.integration.IntegrationTestSpecification; +import org.eclipse.tractusx.traceability.integration.common.support.AssetsSupport; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; +import java.util.stream.Stream; + +import static org.assertj.core.api.Assertions.assertThat; + +class AssetAsBuiltRepositoryIT extends IntegrationTestSpecification { + + @Autowired + AssetAsBuiltRepository assetAsBuiltRepository; + + @Autowired + AssetsSupport assetsSupport; + + @ParameterizedTest + @MethodSource("fieldNameTestProvider") + void givenIdField_whenGetFieldValues_thenSorted( + String fieldName, + Long resultLimit, + Integer expectedSize + ) { + // given + assetsSupport.defaultAssetsStored(); + + // when + List result = assetAsBuiltRepository.getFieldValues(fieldName, resultLimit); + + // then + assertThat(result) + .isSortedAccordingTo(String::compareTo) + .hasSize(expectedSize); + } + + private static Stream fieldNameTestProvider() { + return Stream.of( + Arguments.of("id", 10L, 10), + Arguments.of("id", 200L, 13), + Arguments.of("inInvestigation", 10L, 1), + Arguments.of("owner", 10L, 2) + ); + } +} diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/asplanned/infrastructure/repository/AssetAsPlannedRepositoryIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/asplanned/infrastructure/repository/AssetAsPlannedRepositoryIT.java new file mode 100644 index 0000000000..79367506c9 --- /dev/null +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/asplanned/infrastructure/repository/AssetAsPlannedRepositoryIT.java @@ -0,0 +1,72 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.integration.assets.asplanned.infrastructure.repository; + +import org.eclipse.tractusx.traceability.assets.domain.asplanned.repository.AssetAsPlannedRepository; +import org.eclipse.tractusx.traceability.integration.IntegrationTestSpecification; +import org.eclipse.tractusx.traceability.integration.common.support.AssetsSupport; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; +import java.util.stream.Stream; + +import static org.assertj.core.api.Assertions.assertThat; + +class AssetAsPlannedRepositoryIT extends IntegrationTestSpecification { + + @Autowired + AssetAsPlannedRepository assetAsPlannedRepository; + + @Autowired + AssetsSupport assetsSupport; + + @ParameterizedTest + @MethodSource("fieldNameTestProvider") + void givenIdField_whenGetFieldValues_thenSorted( + String fieldName, + Long resultLimit, + Integer expectedSize + ) { + // given + assetsSupport.defaultAssetsAsPlannedStored(); + + // when + List result = assetAsPlannedRepository.getFieldValues(fieldName, resultLimit); + + // then + assertThat(result) + .isSortedAccordingTo(String::compareTo) + .hasSize(expectedSize); + } + + private static Stream fieldNameTestProvider() { + return Stream.of( + Arguments.of("id", 10L, 2), + Arguments.of("id", 1L, 1), + Arguments.of("inInvestigation", 10L, 1), + Arguments.of("owner", 10L, 4), + Arguments.of("semanticDataModel", 10L, 5), + Arguments.of("qualityType", 10L, 5) + ); + } +} From 4ededaf5c4da1f38ff7da16c69169cb57fdd9b14 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Thu, 14 Sep 2023 19:35:19 +0200 Subject: [PATCH 02/12] feature: TRACEFOSS-873 fix test --- .../repository/AssetAsPlannedRepositoryIT.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/asplanned/infrastructure/repository/AssetAsPlannedRepositoryIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/asplanned/infrastructure/repository/AssetAsPlannedRepositoryIT.java index 79367506c9..58995c23cd 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/asplanned/infrastructure/repository/AssetAsPlannedRepositoryIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/asplanned/infrastructure/repository/AssetAsPlannedRepositoryIT.java @@ -42,7 +42,7 @@ class AssetAsPlannedRepositoryIT extends IntegrationTestSpecification { @ParameterizedTest @MethodSource("fieldNameTestProvider") - void givenIdField_whenGetFieldValues_thenSorted( + void givenFieldNameAndResultLimit_whenGetFieldValues_thenSorted( String fieldName, Long resultLimit, Integer expectedSize @@ -64,9 +64,9 @@ private static Stream fieldNameTestProvider() { Arguments.of("id", 10L, 2), Arguments.of("id", 1L, 1), Arguments.of("inInvestigation", 10L, 1), - Arguments.of("owner", 10L, 4), - Arguments.of("semanticDataModel", 10L, 5), - Arguments.of("qualityType", 10L, 5) + Arguments.of("owner", 10L, 2), + Arguments.of("semanticDataModel", 10L, 1), + Arguments.of("qualityType", 10L, 1) ); } } From c5bb40d4c42d222f2e645fad3508d8c7dd5ab3be Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Thu, 14 Sep 2023 19:37:21 +0200 Subject: [PATCH 03/12] feature: TRACEFOSS-873 add override --- .../assets/domain/base/service/AbstractAssetBaseService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseService.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseService.java index 7edda3eef0..92633c360a 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseService.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseService.java @@ -145,6 +145,7 @@ public Map getAssetsCountryMap() { asset -> ManufacturingInfo.from(asset.getDetailAspectModels()).getManufacturingCountry(), Collectors.counting())); } + @Override public List getDistinctFilterValues(String fieldName, Long size) { if (isSupportedEnumType(fieldName)) { return getAssetEnumFieldValues(fieldName); From 6e689a841b609a648c40c9099cfaadd779a4bdd0 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Thu, 14 Sep 2023 19:44:27 +0200 Subject: [PATCH 04/12] feature: TRACEFOSS-873 increase eventually timeout to 20 s as Git runner is sometimes not able to give output in 15 seconds --- .../traceability/integration/IntegrationTestSpecification.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/IntegrationTestSpecification.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/IntegrationTestSpecification.java index 6532a51d2a..16cc7b8374 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/IntegrationTestSpecification.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/IntegrationTestSpecification.java @@ -78,7 +78,7 @@ protected String asJson(Map map) { protected void eventually(Callable conditions) throws InterruptedException { Awaitility.setDefaultPollInterval(500, TimeUnit.MILLISECONDS); - Awaitility.setDefaultTimeout(15, TimeUnit.SECONDS); + Awaitility.setDefaultTimeout(20, TimeUnit.SECONDS); Awaitility.pollInSameThread(); await().until(conditions, Matchers.equalTo(true)); } From 92f148abb9ecf967f0558dfc64b89023c7ce572d Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Thu, 14 Sep 2023 20:04:49 +0200 Subject: [PATCH 05/12] feature: TRACEFOSS-873 increase eventually timeout to 30 s as Git runner is sometimes not able to give output in 20 seconds --- .../traceability/integration/IntegrationTestSpecification.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/IntegrationTestSpecification.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/IntegrationTestSpecification.java index 16cc7b8374..49a6e8e824 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/IntegrationTestSpecification.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/IntegrationTestSpecification.java @@ -78,7 +78,7 @@ protected String asJson(Map map) { protected void eventually(Callable conditions) throws InterruptedException { Awaitility.setDefaultPollInterval(500, TimeUnit.MILLISECONDS); - Awaitility.setDefaultTimeout(20, TimeUnit.SECONDS); + Awaitility.setDefaultTimeout(30, TimeUnit.SECONDS); Awaitility.pollInSameThread(); await().until(conditions, Matchers.equalTo(true)); } From d9d329946bc513fff76af4d59188d751db6a1afc Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Thu, 14 Sep 2023 20:05:22 +0200 Subject: [PATCH 06/12] feature: TRACEFOSS-873 increase eventually timeout to 30 s as Git runner is sometimes not able to give output in 20 seconds --- .../openapi/traceability-foss-backend.json | 1512 ++++++++++------- 1 file changed, 864 insertions(+), 648 deletions(-) diff --git a/tx-backend/openapi/traceability-foss-backend.json b/tx-backend/openapi/traceability-foss-backend.json index 12b37f768f..29f323b399 100644 --- a/tx-backend/openapi/traceability-foss-backend.json +++ b/tx-backend/openapi/traceability-foss-backend.json @@ -41,18 +41,20 @@ "description" : "The endpoint returns a result of BPN EDC URL mappings.", "operationId" : "getBpnEdcs", "responses" : { - "401" : { - "description" : "Authorization failed.", + "200" : { + "description" : "Returns the paged result found", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -61,8 +63,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -71,14 +73,12 @@ } } }, - "200" : { - "description" : "Returns the paged result found", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } @@ -115,8 +115,8 @@ "required" : true }, "responses" : { - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -125,8 +125,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -135,8 +135,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -145,8 +145,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -155,30 +155,30 @@ } } }, - "200" : { - "description" : "Returns the paged result found for BpnEdcMapping", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "400" : { - "description" : "Bad request.", + "200" : { + "description" : "Returns the paged result found for BpnEdcMapping", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -219,8 +219,8 @@ "required" : true }, "responses" : { - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -229,8 +229,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -239,8 +239,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -249,8 +249,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -259,30 +259,30 @@ } } }, - "200" : { - "description" : "Returns the paged result found for BpnEdcMapping", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "400" : { - "description" : "Bad request.", + "200" : { + "description" : "Returns the paged result found for BpnEdcMapping", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -320,8 +320,8 @@ "required" : true }, "responses" : { - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -330,8 +330,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -340,8 +340,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -350,8 +350,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -360,18 +360,18 @@ } } }, - "201" : { - "description" : "Created.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/QualityNotificationIdResponse" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -380,12 +380,12 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "201" : { + "description" : "Created.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "$ref" : "#/components/schemas/QualityNotificationIdResponse" } } } @@ -430,8 +430,8 @@ "required" : true }, "responses" : { - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -440,8 +440,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -450,8 +450,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -460,8 +460,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -470,11 +470,8 @@ } } }, - "204" : { - "description" : "No content." - }, - "400" : { - "description" : "Bad request.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -483,8 +480,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -492,6 +489,9 @@ } } } + }, + "204" : { + "description" : "No content." } }, "security" : [ @@ -533,8 +533,8 @@ "required" : true }, "responses" : { - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -543,8 +543,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -553,8 +553,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -563,8 +563,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -573,11 +573,8 @@ } } }, - "204" : { - "description" : "No content." - }, - "400" : { - "description" : "Bad request.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -586,8 +583,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -595,6 +592,9 @@ } } } + }, + "204" : { + "description" : "No content." } }, "security" : [ @@ -626,8 +626,8 @@ } ], "responses" : { - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -636,8 +636,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -646,8 +646,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -656,8 +656,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -666,11 +666,8 @@ } } }, - "204" : { - "description" : "No content." - }, - "400" : { - "description" : "Bad request.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -679,8 +676,11 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "204" : { + "description" : "No content." + }, + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -719,8 +719,8 @@ } ], "responses" : { - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -729,8 +729,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -739,8 +739,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -749,8 +749,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -759,11 +759,8 @@ } } }, - "204" : { - "description" : "No content." - }, - "400" : { - "description" : "Bad request.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -772,8 +769,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -781,6 +778,9 @@ } } } + }, + "204" : { + "description" : "No content." } }, "security" : [ @@ -811,8 +811,8 @@ "required" : true }, "responses" : { - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -821,8 +821,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -831,8 +831,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -841,8 +841,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -851,18 +851,18 @@ } } }, - "201" : { - "description" : "Created.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/CreateNotificationContractResponse" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -871,12 +871,12 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "201" : { + "description" : "Created.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "$ref" : "#/components/schemas/CreateNotificationContractResponse" } } } @@ -910,8 +910,8 @@ "required" : true }, "responses" : { - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -920,8 +920,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -930,8 +930,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -940,8 +940,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -950,11 +950,8 @@ } } }, - "201" : { - "description" : "Created." - }, - "400" : { - "description" : "Bad request.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -963,8 +960,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -972,6 +969,9 @@ } } } + }, + "201" : { + "description" : "Created." } }, "security" : [ @@ -1002,18 +1002,8 @@ "required" : true }, "responses" : { - "401" : { - "description" : "Authorization failed.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1032,8 +1022,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1042,8 +1032,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1064,8 +1054,18 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1103,8 +1103,8 @@ "required" : true }, "responses" : { - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1113,8 +1113,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1123,8 +1123,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1133,8 +1133,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1143,11 +1143,8 @@ } } }, - "201" : { - "description" : "Created." - }, - "400" : { - "description" : "Bad request.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1156,8 +1153,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1165,6 +1162,9 @@ } } } + }, + "201" : { + "description" : "Created." } }, "security" : [ @@ -1195,8 +1195,8 @@ "required" : true }, "responses" : { - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1205,8 +1205,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1215,8 +1215,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1225,8 +1225,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1235,30 +1235,30 @@ } } }, - "200" : { - "description" : "Returns the paged result found for Asset", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "400" : { - "description" : "Bad request.", + "200" : { + "description" : "Returns the paged result found for Asset", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1296,8 +1296,8 @@ "required" : true }, "responses" : { - "401" : { - "description" : "Authorization failed.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1306,8 +1306,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1316,8 +1316,8 @@ } } }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1326,8 +1326,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1336,8 +1336,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1346,18 +1346,18 @@ } } }, - "201" : { - "description" : "Created.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/QualityNotificationIdResponse" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1366,12 +1366,12 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "201" : { + "description" : "Created.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "$ref" : "#/components/schemas/QualityNotificationIdResponse" } } } @@ -1416,8 +1416,8 @@ "required" : true }, "responses" : { - "401" : { - "description" : "Authorization failed.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1426,8 +1426,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1436,8 +1436,8 @@ } } }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1446,8 +1446,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1456,8 +1456,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1466,11 +1466,8 @@ } } }, - "204" : { - "description" : "No content." - }, - "400" : { - "description" : "Bad request.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1479,8 +1476,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1488,6 +1485,9 @@ } } } + }, + "204" : { + "description" : "No content." } }, "security" : [ @@ -1529,8 +1529,8 @@ "required" : true }, "responses" : { - "401" : { - "description" : "Authorization failed.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1539,8 +1539,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1549,8 +1549,8 @@ } } }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1559,8 +1559,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1569,8 +1569,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1579,11 +1579,8 @@ } } }, - "204" : { - "description" : "No content." - }, - "400" : { - "description" : "Bad request.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1592,15 +1589,18 @@ } } }, - "415" : { - "description" : "Unsupported media type", - "content" : { + "500" : { + "description" : "Internal server error.", + "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/ErrorResponse" } } } + }, + "204" : { + "description" : "No content." } }, "security" : [ @@ -1632,8 +1632,8 @@ } ], "responses" : { - "401" : { - "description" : "Authorization failed.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1642,8 +1642,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1652,8 +1652,8 @@ } } }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1662,8 +1662,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1672,8 +1672,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1682,11 +1682,8 @@ } } }, - "204" : { - "description" : "No content." - }, - "400" : { - "description" : "Bad request.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1695,8 +1692,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1704,6 +1701,9 @@ } } } + }, + "204" : { + "description" : "No content." } }, "security" : [ @@ -1735,8 +1735,8 @@ } ], "responses" : { - "401" : { - "description" : "Authorization failed.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1745,8 +1745,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1755,8 +1755,8 @@ } } }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1765,8 +1765,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1775,8 +1775,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1785,11 +1785,8 @@ } } }, - "204" : { - "description" : "No content." - }, - "400" : { - "description" : "Bad request.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1798,8 +1795,11 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "204" : { + "description" : "No content." + }, + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1837,46 +1837,6 @@ } ], "responses" : { - "401" : { - "description" : "Authorization failed.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "403" : { - "description" : "Forbidden.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "429" : { - "description" : "Too many requests.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "500" : { - "description" : "Internal server error.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, "200" : { "description" : "Returns the assets found", "content" : { @@ -2005,6 +1965,46 @@ } } } + }, + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } } }, "security" : [ @@ -2043,6 +2043,46 @@ "required" : true }, "responses" : { + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "415" : { + "description" : "Unsupported media type", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "200" : { "description" : "Returns the updated asset", "content" : { @@ -2162,16 +2202,6 @@ } } }, - "401" : { - "description" : "Authorization failed.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, "403" : { "description" : "Forbidden.", "content" : { @@ -2182,16 +2212,6 @@ } } }, - "429" : { - "description" : "Too many requests.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, "500" : { "description" : "Internal server error.", "content" : { @@ -2201,26 +2221,6 @@ } } } - }, - "400" : { - "description" : "Bad request.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "415" : { - "description" : "Unsupported media type", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -2251,18 +2251,8 @@ } ], "responses" : { - "401" : { - "description" : "Authorization failed.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -2281,8 +2271,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -2291,8 +2281,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -2419,6 +2409,16 @@ } } } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } } }, "security" : [ @@ -2457,8 +2457,8 @@ "required" : true }, "responses" : { - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -2467,8 +2467,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -2596,8 +2596,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -2606,8 +2606,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -2616,8 +2616,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -2626,8 +2626,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -2694,18 +2694,8 @@ "description" : "The endpoint returns all shell descriptors.", "operationId" : "findAll", "responses" : { - "401" : { - "description" : "Authorization failed.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -2724,8 +2714,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -2747,8 +2737,18 @@ } } }, - "400" : { - "description" : "Bad request.", + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -2775,8 +2775,8 @@ "description" : "The endpoint deletes all shell descriptors.", "operationId" : "deleteAll", "responses" : { - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -2785,8 +2785,11 @@ } } }, - "403" : { - "description" : "Forbidden.", + "204" : { + "description" : "Deleted." + }, + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -2795,11 +2798,8 @@ } } }, - "204" : { - "description" : "Deleted." - }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -2808,8 +2808,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -2818,8 +2818,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -2847,8 +2847,8 @@ "description" : "The endpoint Triggers reload of shell descriptors.", "operationId" : "reload", "responses" : { - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -2857,8 +2857,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -2867,8 +2867,11 @@ } } }, - "429" : { - "description" : "Too many requests.", + "202" : { + "description" : "Created registry reload job." + }, + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -2877,8 +2880,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -2887,11 +2890,8 @@ } } }, - "202" : { - "description" : "Created registry reload job." - }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -2969,18 +2969,8 @@ } ], "responses" : { - "401" : { - "description" : "Authorization failed.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -3015,8 +3005,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -3025,8 +3015,18 @@ } } }, - "400" : { - "description" : "Bad request.", + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -3064,8 +3064,8 @@ } ], "responses" : { - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -3074,8 +3074,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3084,8 +3084,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -3094,8 +3094,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3104,8 +3104,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -3155,8 +3155,8 @@ } ], "responses" : { - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -3165,8 +3165,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3175,8 +3175,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -3185,14 +3185,12 @@ } } }, - "200" : { - "description" : "Returns the paged result found for Asset", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } @@ -3207,12 +3205,14 @@ } } }, - "400" : { - "description" : "Bad request.", + "200" : { + "description" : "Returns the paged result found for Asset", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } @@ -3327,8 +3327,8 @@ "description" : "The endpoint can return limited data based on the user role", "operationId" : "dashboard", "responses" : { - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -3337,8 +3337,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3347,18 +3347,18 @@ } } }, - "200" : { - "description" : "Returns dashboard data", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/DashboardResponse" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "429" : { - "description" : "Too many requests.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3377,12 +3377,12 @@ } } }, - "400" : { - "description" : "Bad request.", + "200" : { + "description" : "Returns dashboard data", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "$ref" : "#/components/schemas/DashboardResponse" } } } @@ -3490,8 +3490,8 @@ } ], "responses" : { - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -3500,8 +3500,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3510,8 +3510,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -3520,18 +3520,20 @@ } } }, - "500" : { - "description" : "Internal server error.", + "200" : { + "description" : "Returns the paged result found for Asset", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "400" : { - "description" : "Bad request.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3540,14 +3542,12 @@ } } }, - "200" : { - "description" : "Returns the paged result found for Asset", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } @@ -3589,46 +3589,6 @@ } ], "responses" : { - "401" : { - "description" : "Authorization failed.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "403" : { - "description" : "Forbidden.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "429" : { - "description" : "Too many requests.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "500" : { - "description" : "Internal server error.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, "400" : { "description" : "Bad request.", "content" : { @@ -3757,6 +3717,146 @@ } } } + }, + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/assets/as-planned/distinctFilterValues" : { + "get" : { + "tags" : [ + "Assets" + ], + "summary" : "getDistinctFilterValues", + "description" : "The endpoint returns a distinct filter values for given fieldName.", + "operationId" : "distinctFilterValues", + "parameters" : [ + { + "name" : "fieldName", + "in" : "query", + "required" : true, + "schema" : { + "type" : "string" + } + }, + { + "name" : "size", + "in" : "query", + "required" : true, + "schema" : { + "type" : "integer", + "format" : "int64" + } + } + ], + "responses" : { + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "200" : { + "description" : "Returns a distinct filter values for given fieldName.", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" + } + } + } } }, "security" : [ @@ -3809,8 +3909,8 @@ } ], "responses" : { - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -3819,8 +3919,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3829,8 +3929,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -3839,8 +3939,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3861,8 +3961,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -3908,18 +4008,8 @@ } ], "responses" : { - "401" : { - "description" : "Authorization failed.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4047,8 +4137,18 @@ } } }, - "429" : { - "description" : "Too many requests.", + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4057,8 +4157,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -4067,8 +4167,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4087,15 +4187,54 @@ ] } }, - "/assets/as-built/countries" : { + "/assets/as-built/distinctFilterValues" : { "get" : { "tags" : [ "Assets" ], - "summary" : "Get map of assets", - "description" : "The endpoint returns a map for assets consumed by the map.", - "operationId" : "assetsCountryMap", + "summary" : "getDistinctFilterValues", + "description" : "The endpoint returns a distinct filter values for given fieldName.", + "operationId" : "distinctFilterValues_1", + "parameters" : [ + { + "name" : "fieldName", + "in" : "query", + "required" : true, + "schema" : { + "type" : "string" + } + }, + { + "name" : "size", + "in" : "query", + "required" : true, + "schema" : { + "type" : "integer", + "format" : "int64" + } + } + ], "responses" : { + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "401" : { "description" : "Authorization failed.", "content" : { @@ -4116,6 +4255,57 @@ } } }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "200" : { + "description" : "Returns a distinct filter values for given fieldName.", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/assets/as-built/countries" : { + "get" : { + "tags" : [ + "Assets" + ], + "summary" : "Get map of assets", + "description" : "The endpoint returns a map for assets consumed by the map.", + "operationId" : "assetsCountryMap", + "responses" : { + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "200" : { "description" : "Returns the assets found", "content" : { @@ -4140,8 +4330,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4150,8 +4340,18 @@ } } }, - "400" : { - "description" : "Bad request.", + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4203,8 +4403,8 @@ } ], "responses" : { - "401" : { - "description" : "Authorization failed.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -4213,8 +4413,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4238,8 +4438,8 @@ } } }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -4248,8 +4448,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4258,8 +4458,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -4268,8 +4468,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4307,29 +4507,29 @@ } ], "responses" : { - "200" : { - "description" : "Returns the paged result found for Asset", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "401" : { - "description" : "Authorization failed.", + "200" : { + "description" : "Returns the paged result found for Asset", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "type" : "array" } } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4338,8 +4538,8 @@ } } }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -4348,8 +4548,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4358,8 +4558,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -4368,8 +4568,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4407,29 +4607,29 @@ } ], "responses" : { - "200" : { - "description" : "Returns the paged result found for Asset", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "401" : { - "description" : "Authorization failed.", + "200" : { + "description" : "Returns the paged result found for Asset", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "type" : "array" } } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4438,8 +4638,8 @@ } } }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -4448,8 +4648,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4458,8 +4658,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -4468,8 +4668,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4520,8 +4720,8 @@ } ], "responses" : { - "401" : { - "description" : "Authorization failed.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4530,8 +4730,8 @@ } } }, - "403" : { - "description" : "Forbidden.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -4540,8 +4740,11 @@ } } }, - "429" : { - "description" : "Too many requests.", + "204" : { + "description" : "Deleted." + }, + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4550,8 +4753,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -4560,11 +4763,8 @@ } } }, - "204" : { - "description" : "Deleted." - }, - "400" : { - "description" : "Bad request.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -5085,7 +5285,7 @@ "DashboardResponse" : { "type" : "object", "properties" : { - "myItems" : { + "myParts" : { "type" : "integer", "format" : "int64" }, @@ -5093,7 +5293,23 @@ "type" : "integer", "format" : "int64" }, - "investigations" : { + "investigationsReceived" : { + "type" : "integer", + "format" : "int64" + }, + "alertsReceived" : { + "type" : "integer", + "format" : "int64" + }, + "alertsSent" : { + "type" : "integer", + "format" : "int64" + }, + "myPartsWithOpenAlerts" : { + "type" : "integer", + "format" : "int64" + }, + "supplierPartsWithOpenAlerts" : { "type" : "integer", "format" : "int64" } From 85f2ee18554223a9bf791263b78c831a827dd4ab Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Thu, 14 Sep 2023 20:40:03 +0200 Subject: [PATCH 07/12] feature: TRACEFOSS-873 some security issues fix --- .../base/mapper/AssetBaseResponseMapper.java | 1 - .../domain/base/service/AbstractAssetBaseService.java | 10 ++++++++-- .../contract/service/EdcContractDefinitionService.java | 4 ++-- .../base/request/CloseQualityNotificationRequest.java | 2 ++ .../integration/openapi/OpenApiDocumentationIT.java | 3 ++- .../jpa/ShellDescriptorRepositoryImplTest.java | 2 +- .../traceability/testdata/AssetTestDataFactory.java | 2 -- 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/base/mapper/AssetBaseResponseMapper.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/base/mapper/AssetBaseResponseMapper.java index 67abff5597..7a24b4750f 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/base/mapper/AssetBaseResponseMapper.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/base/mapper/AssetBaseResponseMapper.java @@ -55,7 +55,6 @@ @SuperBuilder public class AssetBaseResponseMapper { - public static List fromList(List detailAspectModels) { List list = emptyIfNull(detailAspectModels).stream() .map(AssetAsPlannedResponseMapper::from) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseService.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseService.java index 92633c360a..4e467a0547 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseService.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/service/AbstractAssetBaseService.java @@ -58,6 +58,7 @@ public abstract class AbstractAssetBaseService implements AssetBaseService { protected abstract BomLifecycle getBomLifecycle(); + @Override @Async(value = AssetsAsyncConfig.SYNCHRONIZE_ASSETS_EXECUTOR) public void synchronizeAssetsAsync(String globalAssetId) { log.info("Synchronizing assets for globalAssetId: {}", globalAssetId); @@ -86,6 +87,7 @@ public void synchronizeAssetsAsync(String globalAssetId) { } } + @Override @Async(value = AssetsAsyncConfig.SYNCHRONIZE_ASSETS_EXECUTOR) public void synchronizeAssetsAsync(List globalAssetIds) { for (String globalAssetId : globalAssetIds) { @@ -97,7 +99,7 @@ public void synchronizeAssetsAsync(List globalAssetIds) { } } - + @Override public void setAssetsInvestigationStatus(QualityNotification investigation) { getAssetRepository().getAssetsById(investigation.getAssetIds()).forEach(asset -> { // Assets in status closed will be false, others true @@ -106,6 +108,7 @@ public void setAssetsInvestigationStatus(QualityNotification investigation) { }); } + @Override public void setAssetsAlertStatus(QualityNotification alert) { getAssetRepository().getAssetsById(alert.getAssetIds()).forEach(asset -> { // Assets in status closed will be false, others true @@ -114,7 +117,7 @@ public void setAssetsAlertStatus(QualityNotification alert) { }); } - + @Override public AssetBase updateQualityType(String assetId, QualityType qualityType) { AssetBase foundAsset = getAssetRepository().getAssetById(assetId); foundAsset.setQualityType(qualityType); @@ -126,14 +129,17 @@ public PageResult getAssets(Pageable pageable, List f return getAssetRepository().getAssets(pageable, filter); } + @Override public AssetBase getAssetById(String assetId) { return getAssetRepository().getAssetById(assetId); } + @Override public List getAssetsById(List assetIds) { return getAssetRepository().getAssetsById(assetIds); } + @Override public AssetBase getAssetByChildId(String assetId, String childId) { return getAssetRepository().getAssetByChildId(assetId, childId); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/infrastructure/edc/notificationcontract/service/contract/service/EdcContractDefinitionService.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/infrastructure/edc/notificationcontract/service/contract/service/EdcContractDefinitionService.java index 4666ef4b4a..b905f5ad2e 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/infrastructure/edc/notificationcontract/service/contract/service/EdcContractDefinitionService.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/infrastructure/edc/notificationcontract/service/contract/service/EdcContractDefinitionService.java @@ -55,10 +55,10 @@ public class EdcContractDefinitionService { private final ObjectMapper objectMapper; @Autowired - public EdcContractDefinitionService(@Qualifier(EDC_REST_TEMPLATE) RestTemplate edcRestTemplate, EdcProperties edcProperties, ObjectMapper objectMapper, ObjectMapper objectMapper1) { + public EdcContractDefinitionService(@Qualifier(EDC_REST_TEMPLATE) RestTemplate edcRestTemplate, EdcProperties edcProperties, ObjectMapper objectMapper) { this.restTemplate = edcRestTemplate; this.edcProperties = edcProperties; - this.objectMapper = objectMapper1; + this.objectMapper = objectMapper; } public String createContractDefinition(String notificationAssetId, String accessPolicyId) throws JsonProcessingException { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/base/request/CloseQualityNotificationRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/base/request/CloseQualityNotificationRequest.java index 098ef4a8e0..6fbcd20074 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/base/request/CloseQualityNotificationRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/base/request/CloseQualityNotificationRequest.java @@ -25,9 +25,11 @@ import jakarta.validation.constraints.Size; import lombok.Getter; import lombok.Setter; +import lombok.ToString; @Setter @Getter +@ToString public class CloseQualityNotificationRequest { @Size(min = 15, max = 1000, message = "Close reason should have at least 15 characters and at most 1000 characters") @ApiModelProperty(example = "The reason.") diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/openapi/OpenApiDocumentationIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/openapi/OpenApiDocumentationIT.java index a6245bacd8..a969284652 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/openapi/OpenApiDocumentationIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/openapi/OpenApiDocumentationIT.java @@ -25,6 +25,7 @@ import java.io.File; import java.io.IOException; +import java.nio.charset.StandardCharsets; import static io.restassured.RestAssured.given; @@ -43,6 +44,6 @@ void shouldGenerateOpenapiDocumentation() throws IOException { response.then() .statusCode(200); - FileUtils.writeStringToFile(new File(DOCUMENTATION_FILENAME), response.body().print()); + FileUtils.writeStringToFile(new File(DOCUMENTATION_FILENAME), response.body().print(), StandardCharsets.UTF_8); } } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/shelldescriptor/infrastructure/repository/jpa/ShellDescriptorRepositoryImplTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/shelldescriptor/infrastructure/repository/jpa/ShellDescriptorRepositoryImplTest.java index c509aa087c..0f53a18efe 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/shelldescriptor/infrastructure/repository/jpa/ShellDescriptorRepositoryImplTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/shelldescriptor/infrastructure/repository/jpa/ShellDescriptorRepositoryImplTest.java @@ -58,7 +58,7 @@ void testFindAll() { shellDescriptorRepository = new ShellDescriptorRepositoryImpl(repository); // Act - List descriptors = shellDescriptorRepository.findAll(); + shellDescriptorRepository.findAll(); // Then verify(repository, times(1)).findAll(); diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/testdata/AssetTestDataFactory.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/testdata/AssetTestDataFactory.java index e897361579..845cc9d0f9 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/testdata/AssetTestDataFactory.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/testdata/AssetTestDataFactory.java @@ -36,7 +36,6 @@ public static AssetBase createAssetTestDataWithRelations(List pare } public static AssetBase createAssetTestData() { - Instant manufacturingDate = Instant.now(); // TODO add detailAspectModels @@ -58,7 +57,6 @@ public static AssetBase createAssetTestData() { } public static AssetBase createAssetParentTestData() { - Instant manufacturingDate = Instant.now(); // TODO add detailAspectModels From 97c8ce3c44841b4230b7dd153908ee794f2ab17b Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Thu, 14 Sep 2023 20:46:32 +0200 Subject: [PATCH 08/12] feature: TRACEFOSS-873 some security issues fix --- .../domain/service/DecentralRegistryServiceImpl.java | 1 + .../domain/service/ShellDescriptorsServiceImpl.java | 3 +++ 2 files changed, 4 insertions(+) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/shelldescriptor/domain/service/DecentralRegistryServiceImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/shelldescriptor/domain/service/DecentralRegistryServiceImpl.java index 75cb3a77bc..898f8286f7 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/shelldescriptor/domain/service/DecentralRegistryServiceImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/shelldescriptor/domain/service/DecentralRegistryServiceImpl.java @@ -47,6 +47,7 @@ public class DecentralRegistryServiceImpl implements DecentralRegistryService { private final TraceabilityProperties traceabilityProperties; private final DecentralRegistryRepository decentralRegistryRepository; + @Override @Async(value = AssetsAsyncConfig.LOAD_SHELL_DESCRIPTORS_EXECUTOR) public void updateShellDescriptorAndSynchronizeAssets() { List shellDescriptorList = decentralRegistryRepository.retrieveShellDescriptorsByBpn(traceabilityProperties.getBpn().toString()); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/shelldescriptor/domain/service/ShellDescriptorsServiceImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/shelldescriptor/domain/service/ShellDescriptorsServiceImpl.java index 73e26f5e9a..d160a6b946 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/shelldescriptor/domain/service/ShellDescriptorsServiceImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/shelldescriptor/domain/service/ShellDescriptorsServiceImpl.java @@ -43,6 +43,7 @@ public class ShellDescriptorsServiceImpl implements ShellDescriptorService { private final ShellDescriptorRepository shellDescriptorRepository; + @Override @Transactional public List determineExistingShellDescriptorsAndUpdate(List ownShellDescriptors) { log.info("Starting update of {} shell ownShellDescriptors.", ownShellDescriptors.size()); @@ -68,11 +69,13 @@ public List determineExistingShellDescriptorsAndUpdate(List findAll(){ return shellDescriptorRepository.findAll(); From 8b0b607d2752aa9fbb45c97f1d662f6c1dd06117 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Thu, 14 Sep 2023 21:13:35 +0200 Subject: [PATCH 09/12] feature: TRACEFOSS-873 some security issues fix --- .../integration/assets/AssetAsBuiltControllerSyncIT.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerSyncIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerSyncIT.java index 001549e83d..89becc78ee 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerSyncIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerSyncIT.java @@ -25,6 +25,8 @@ import org.jose4j.lang.JoseException; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @@ -32,6 +34,7 @@ import static io.restassured.RestAssured.given; import static org.eclipse.tractusx.traceability.common.security.JwtRole.ADMIN; +@DirtiesContext class AssetAsBuiltControllerSyncIT extends IntegrationTestSpecification { @Autowired From 13c49a51b844b5ee15263d88244b86a874cbfa34 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Thu, 14 Sep 2023 21:17:21 +0200 Subject: [PATCH 10/12] feature: TRACEFOSS-873 some security issues fix --- .../traceability/integration/IntegrationTestSpecification.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/IntegrationTestSpecification.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/IntegrationTestSpecification.java index 49a6e8e824..6d0ed93eab 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/IntegrationTestSpecification.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/IntegrationTestSpecification.java @@ -80,7 +80,7 @@ protected void eventually(Callable conditions) throws InterruptedExcept Awaitility.setDefaultPollInterval(500, TimeUnit.MILLISECONDS); Awaitility.setDefaultTimeout(30, TimeUnit.SECONDS); Awaitility.pollInSameThread(); - await().until(conditions, Matchers.equalTo(true)); + await().pollDelay(2, TimeUnit.SECONDS).until(conditions, Matchers.equalTo(true)); } } From 10f1e986f9165178685269075c9062a20c9bc5de Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Fri, 15 Sep 2023 08:18:28 +0200 Subject: [PATCH 11/12] chore: TRACEFOSS-873 adapt string concat for native query. --- .../asbuilt/repository/AssetAsBuiltRepositoryImpl.java | 9 +++++---- .../repository/AssetAsPlannedRepositoryImpl.java | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java index 5796f9c171..95d43fb85d 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java @@ -88,10 +88,11 @@ public PageResult getAssets(Pageable pageable, List f @Override public List getFieldValues(String fieldName, Long resultLimit) { - String getFieldValuesQuery = "SELECT DISTINCT fieldName FROM assets_as_built order by fieldName ASC LIMIT resultLimit" - .replace("fieldName", toDatabaseName(fieldName)) - .replace("resultLimit", resultLimit.toString()); - return entityManager.createNativeQuery(getFieldValuesQuery, String.class).getResultList(); + String databaseFieldName = toDatabaseName(fieldName); + String getFieldValuesQuery = "SELECT DISTINCT " + databaseFieldName + " FROM assets_as_built ORDER BY " + databaseFieldName + " ASC LIMIT :resultLimit"; + return entityManager.createNativeQuery(getFieldValuesQuery, String.class) + .setParameter("resultLimit", resultLimit) + .getResultList(); } @Override diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java index 7c1c02f933..5c905ace15 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java @@ -122,9 +122,10 @@ public long countAssetsByOwner(Owner owner) { @Override public List getFieldValues(String fieldName, Long resultLimit) { - String getFieldValuesQuery = "SELECT DISTINCT fieldName FROM assets_as_planned order by fieldName ASC LIMIT resultLimit" - .replace("fieldName", toDatabaseName(fieldName)) - .replace("resultLimit", resultLimit.toString()); - return entityManager.createNativeQuery(getFieldValuesQuery, String.class).getResultList(); + String databaseFieldName = toDatabaseName(fieldName); + String getFieldValuesQuery = "SELECT DISTINCT " + databaseFieldName + " FROM assets_as_built ORDER BY " + databaseFieldName + " ASC LIMIT :resultLimit"; + return entityManager.createNativeQuery(getFieldValuesQuery, String.class) + .setParameter("resultLimit", resultLimit) + .getResultList(); } } From fe1bba9e469f51bd3eb5cdffadd268fc46e029e1 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Fri, 15 Sep 2023 08:47:29 +0200 Subject: [PATCH 12/12] chore: TRACEFOSS-873 adapt string concat for native query. --- .../asplanned/repository/AssetAsPlannedRepositoryImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java index 5c905ace15..755474c43e 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java @@ -123,7 +123,7 @@ public long countAssetsByOwner(Owner owner) { @Override public List getFieldValues(String fieldName, Long resultLimit) { String databaseFieldName = toDatabaseName(fieldName); - String getFieldValuesQuery = "SELECT DISTINCT " + databaseFieldName + " FROM assets_as_built ORDER BY " + databaseFieldName + " ASC LIMIT :resultLimit"; + String getFieldValuesQuery = "SELECT DISTINCT " + databaseFieldName + " FROM assets_as_planned ORDER BY " + databaseFieldName + " ASC LIMIT :resultLimit"; return entityManager.createNativeQuery(getFieldValuesQuery, String.class) .setParameter("resultLimit", resultLimit) .getResultList();