From 8d817170a091f52558367d63301c02a1aab84333 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Fri, 20 Oct 2023 14:25:25 +0200 Subject: [PATCH 01/27] chore: TRACEFOSS-2725 add filtering endpoint for investigations and alerts --- .../assets/domain/base/AssetRepository.java | 3 +- .../AssetAsPlannedRepositoryImpl.java | 3 - .../alert/rest/AlertController.java | 6 + .../service/QualityNotificationService.java | 3 + .../rest/InvestigationsController.java | 6 + .../AbstractQualityNotificationService.java | 8 ++ .../service/InvestigationServiceImpl.java | 1 - .../QualityNotificationRepository.java | 3 +- .../alert/repository/AlertSpecification.java | 41 +++++++ .../repository/AlertsRepositoryImpl.java | 13 +++ .../alert/repository/JpaAlertRepository.java | 3 +- .../InvestigationSpecification.java | 41 +++++++ .../InvestigationsRepositoryImpl.java | 13 +++ .../JpaInvestigationRepository.java | 3 +- .../support/AlertNotificationsSupport.java | 88 ++++++++++++++ .../InvestigationNotificationsSupport.java | 109 +++++++++++++++++- .../alert/AlertControllerFilterIT.java | 106 +++++++++++++++++ .../InvestigationControllerFilterIT.java | 106 +++++++++++++++++ 18 files changed, 546 insertions(+), 10 deletions(-) create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/alert/repository/AlertSpecification.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/investigation/repository/InvestigationSpecification.java create mode 100644 tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/AlertControllerFilterIT.java create mode 100644 tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/InvestigationControllerFilterIT.java 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 0685b70759..eb32be3903 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 @@ -21,9 +21,8 @@ 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.common.model.SearchCriteria; -import org.eclipse.tractusx.traceability.common.model.SearchCriteriaFilter; import org.eclipse.tractusx.traceability.common.model.PageResult; +import org.eclipse.tractusx.traceability.common.model.SearchCriteria; import org.springframework.data.domain.Pageable; import java.util.List; 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 b16045f94a..8e20e65654 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 @@ -26,8 +26,6 @@ import org.eclipse.tractusx.traceability.assets.domain.asplanned.repository.AssetAsPlannedRepository; 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.infrastructure.asbuilt.model.AssetAsBuiltEntity; -import org.eclipse.tractusx.traceability.assets.infrastructure.asbuilt.repository.AssetAsBuildSpecification; import org.eclipse.tractusx.traceability.assets.infrastructure.asplanned.model.AssetAsPlannedEntity; import org.eclipse.tractusx.traceability.common.model.PageResult; import org.eclipse.tractusx.traceability.common.model.SearchCriteria; @@ -37,7 +35,6 @@ import org.springframework.transaction.annotation.Transactional; import java.util.List; -import java.util.Objects; import static org.apache.commons.collections4.ListUtils.emptyIfNull; import static org.eclipse.tractusx.traceability.common.repository.EntityNameMapper.toDatabaseName; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/rest/AlertController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/rest/AlertController.java index b3d89060cd..95c463fdd1 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/rest/AlertController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/rest/AlertController.java @@ -32,6 +32,7 @@ import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.traceability.common.model.PageResult; import org.eclipse.tractusx.traceability.common.request.OwnPageable; +import org.eclipse.tractusx.traceability.common.request.SearchCriteriaRequestParam; import org.eclipse.tractusx.traceability.common.response.ErrorResponse; import org.eclipse.tractusx.traceability.qualitynotification.application.alert.mapper.AlertResponseMapper; import org.eclipse.tractusx.traceability.qualitynotification.application.base.service.QualityNotificationService; @@ -243,6 +244,11 @@ public PageResult getReceivedAlerts(OwnPageable pageable) { return AlertResponseMapper.fromAsPageResult(alertService.getReceived(OwnPageable.toPageable(pageable))); } + @GetMapping("") + public PageResult getAlerts(OwnPageable pageable, SearchCriteriaRequestParam filter) { + return AlertResponseMapper.fromAsPageResult(alertService.getNotifications(OwnPageable.toPageable(pageable), filter.toSearchCriteria())); + } + @Operation(operationId = "getAlert", summary = "Gets Alert by id", tags = {"Alerts"}, diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/base/service/QualityNotificationService.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/base/service/QualityNotificationService.java index 95a742faed..13bea022cf 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/base/service/QualityNotificationService.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/base/service/QualityNotificationService.java @@ -19,6 +19,7 @@ package org.eclipse.tractusx.traceability.qualitynotification.application.base.service; import org.eclipse.tractusx.traceability.common.model.PageResult; +import org.eclipse.tractusx.traceability.common.model.SearchCriteria; import org.eclipse.tractusx.traceability.qualitynotification.domain.alert.model.exception.StartQualityNotificationDomain; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotification; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationId; @@ -44,4 +45,6 @@ public interface QualityNotificationService { void cancel(Long notificationId); void update(Long notificationId, QualityNotificationStatus notificationStatus, String reason); + + PageResult getNotifications(Pageable pageable, SearchCriteria searchCriteria); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/investigation/rest/InvestigationsController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/investigation/rest/InvestigationsController.java index 4cd92faa72..20493385b6 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/investigation/rest/InvestigationsController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/investigation/rest/InvestigationsController.java @@ -34,6 +34,7 @@ import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.traceability.common.model.PageResult; import org.eclipse.tractusx.traceability.common.request.OwnPageable; +import org.eclipse.tractusx.traceability.common.request.SearchCriteriaRequestParam; import org.eclipse.tractusx.traceability.common.response.ErrorResponse; import org.eclipse.tractusx.traceability.qualitynotification.application.base.service.QualityNotificationService; import org.eclipse.tractusx.traceability.qualitynotification.application.investigation.mapper.InvestigationResponseMapper; @@ -244,6 +245,11 @@ public PageResult getReceivedInvestigations(OwnPageable p return InvestigationResponseMapper.fromAsPageResult(investigationService.getReceived(OwnPageable.toPageable(pageable))); } + @GetMapping("") + public PageResult getInvestigations(OwnPageable pageable, SearchCriteriaRequestParam filter) { + return InvestigationResponseMapper.fromAsPageResult(investigationService.getNotifications(OwnPageable.toPageable(pageable), filter.toSearchCriteria())); + } + @Operation(operationId = "getInvestigation", summary = "Gets investigations by id", tags = {"Investigations"}, diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/base/service/AbstractQualityNotificationService.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/base/service/AbstractQualityNotificationService.java index 8357227578..b59d5f61cc 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/base/service/AbstractQualityNotificationService.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/base/service/AbstractQualityNotificationService.java @@ -21,6 +21,7 @@ import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.traceability.assets.domain.asbuilt.service.AssetAsBuiltServiceImpl; import org.eclipse.tractusx.traceability.common.model.PageResult; +import org.eclipse.tractusx.traceability.common.model.SearchCriteria; import org.eclipse.tractusx.traceability.qualitynotification.application.base.service.QualityNotificationService; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotification; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationId; @@ -42,16 +43,23 @@ public abstract class AbstractQualityNotificationService implements QualityNotif protected abstract void setAssetStatus(QualityNotification qualityNotification); + @Deprecated @Override public PageResult getCreated(Pageable pageable) { return getQualityNotificationsPageResult(pageable, QualityNotificationSide.SENDER); } + @Deprecated @Override public PageResult getReceived(Pageable pageable) { return getQualityNotificationsPageResult(pageable, QualityNotificationSide.RECEIVER); } + @Override + public PageResult getNotifications(Pageable pageable, SearchCriteria searchCriteria){ + return getQualityNotificationRepository().getNotifications(pageable, searchCriteria); + } + @Override public void update(Long notificationId, QualityNotificationStatus notificationStatus, String reason) { QualityNotification alert = loadOrNotFoundException(new QualityNotificationId(notificationId)); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/investigation/service/InvestigationServiceImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/investigation/service/InvestigationServiceImpl.java index 5a82e06340..3e3049523b 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/investigation/service/InvestigationServiceImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/investigation/service/InvestigationServiceImpl.java @@ -82,5 +82,4 @@ public void setAssetStatus(QualityNotification qualityNotification) { assetService.setAssetsInvestigationStatus(qualityNotification); } - } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/repository/QualityNotificationRepository.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/repository/QualityNotificationRepository.java index e94a88b424..099a13e9dc 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/repository/QualityNotificationRepository.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/domain/repository/QualityNotificationRepository.java @@ -22,6 +22,7 @@ package org.eclipse.tractusx.traceability.qualitynotification.domain.repository; 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.QualityNotificationId; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationMessage; @@ -49,5 +50,5 @@ public interface QualityNotificationRepository { void updateQualityNotificationMessageEntity(QualityNotificationMessage notification); - + PageResult getNotifications(Pageable pageable, SearchCriteria searchCriteria); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/alert/repository/AlertSpecification.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/alert/repository/AlertSpecification.java new file mode 100644 index 0000000000..15a9c2e2db --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/alert/repository/AlertSpecification.java @@ -0,0 +1,41 @@ +/******************************************************************************** + * 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.qualitynotification.infrastructure.alert.repository; + +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.CriteriaQuery; +import jakarta.persistence.criteria.Predicate; +import jakarta.persistence.criteria.Root; +import org.eclipse.tractusx.traceability.common.model.SearchCriteriaFilter; +import org.eclipse.tractusx.traceability.common.repository.BaseSpecification; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.alert.model.AlertEntity; +import org.jetbrains.annotations.NotNull; +import org.springframework.data.jpa.domain.Specification; + +public class AlertSpecification extends BaseSpecification implements Specification { + + public AlertSpecification(SearchCriteriaFilter criteria) { + super(criteria); + } + @Override + public Predicate toPredicate(@NotNull Root root, @NotNull CriteriaQuery query, @NotNull CriteriaBuilder builder) { + return createPredicate(getSearchCriteriaFilter(), root, builder); + } +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/alert/repository/AlertsRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/alert/repository/AlertsRepositoryImpl.java index 6f5ee878bf..cba0d14f0c 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/alert/repository/AlertsRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/alert/repository/AlertsRepositoryImpl.java @@ -29,6 +29,7 @@ import org.eclipse.tractusx.traceability.assets.infrastructure.asplanned.repository.JpaAssetAsPlannedRepository; import org.eclipse.tractusx.traceability.assets.infrastructure.base.model.AssetBaseEntity; import org.eclipse.tractusx.traceability.common.model.PageResult; +import org.eclipse.tractusx.traceability.common.model.SearchCriteria; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.AlertRepository; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotification; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationAffectedPart; @@ -42,6 +43,7 @@ import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.NotificationStatusBaseEntity; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.domain.Specification; import org.springframework.stereotype.Component; import java.time.Clock; @@ -53,6 +55,8 @@ import java.util.Set; import java.util.stream.Collectors; +import static org.apache.commons.collections4.ListUtils.emptyIfNull; + @Slf4j @RequiredArgsConstructor @Component @@ -75,6 +79,15 @@ public void updateQualityNotificationMessageEntity(QualityNotificationMessage no handleNotificationUpdate(entity, notification); } + @Override + public PageResult getNotifications(Pageable pageable, SearchCriteria searchCriteria) { + List alertsSpecifications = emptyIfNull(searchCriteria.getSearchCriteriaFilterList()).stream() + .map(AlertSpecification::new) + .toList(); + Specification specification = AlertSpecification.toSpecification(alertsSpecifications, searchCriteria.getSearchCriteriaOperator()); + return new PageResult<>(jpaAlertRepository.findAll(specification, pageable), AlertEntity::toDomain); + } + @Override public QualityNotificationId updateQualityNotificationEntity(QualityNotification alert) { AlertEntity alertEntity = jpaAlertRepository.findById(alert.getNotificationId().value()) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/alert/repository/JpaAlertRepository.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/alert/repository/JpaAlertRepository.java index bac46e53a4..036ab86418 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/alert/repository/JpaAlertRepository.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/alert/repository/JpaAlertRepository.java @@ -25,6 +25,7 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; @@ -33,7 +34,7 @@ import java.util.Optional; @Repository -public interface JpaAlertRepository extends JpaRepository { +public interface JpaAlertRepository extends JpaRepository, JpaSpecificationExecutor { Page findAllBySideEquals(NotificationSideBaseEntity investigationSide, Pageable pageable); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/investigation/repository/InvestigationSpecification.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/investigation/repository/InvestigationSpecification.java new file mode 100644 index 0000000000..e69ddb2b16 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/investigation/repository/InvestigationSpecification.java @@ -0,0 +1,41 @@ +/******************************************************************************** + * 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.qualitynotification.infrastructure.investigation.repository; + +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.CriteriaQuery; +import jakarta.persistence.criteria.Predicate; +import jakarta.persistence.criteria.Root; +import org.eclipse.tractusx.traceability.common.model.SearchCriteriaFilter; +import org.eclipse.tractusx.traceability.common.repository.BaseSpecification; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.investigation.model.InvestigationEntity; +import org.jetbrains.annotations.NotNull; +import org.springframework.data.jpa.domain.Specification; + +public class InvestigationSpecification extends BaseSpecification implements Specification { + + public InvestigationSpecification(SearchCriteriaFilter criteria) { + super(criteria); + } + @Override + public Predicate toPredicate(@NotNull Root root, @NotNull CriteriaQuery query, @NotNull CriteriaBuilder builder) { + return createPredicate(getSearchCriteriaFilter(), root, builder); + } +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/investigation/repository/InvestigationsRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/investigation/repository/InvestigationsRepositoryImpl.java index f6f460789c..ef3bbdfe92 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/investigation/repository/InvestigationsRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/investigation/repository/InvestigationsRepositoryImpl.java @@ -26,6 +26,7 @@ import org.eclipse.tractusx.traceability.assets.infrastructure.asbuilt.model.AssetAsBuiltEntity; import org.eclipse.tractusx.traceability.assets.infrastructure.asbuilt.repository.JpaAssetAsBuiltRepository; import org.eclipse.tractusx.traceability.common.model.PageResult; +import org.eclipse.tractusx.traceability.common.model.SearchCriteria; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.InvestigationRepository; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotification; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotificationAffectedPart; @@ -39,6 +40,7 @@ import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.NotificationStatusBaseEntity; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.domain.Specification; import org.springframework.stereotype.Component; import java.time.Clock; @@ -49,6 +51,8 @@ import java.util.Set; import java.util.stream.Collectors; +import static org.apache.commons.collections4.ListUtils.emptyIfNull; + @Slf4j @RequiredArgsConstructor @Component @@ -69,6 +73,15 @@ public void updateQualityNotificationMessageEntity(QualityNotificationMessage no handleNotificationUpdate(entity, notification); } + @Override + public PageResult getNotifications(Pageable pageable, SearchCriteria searchCriteria) { + List investigationSpecifications = emptyIfNull(searchCriteria.getSearchCriteriaFilterList()).stream() + .map(InvestigationSpecification::new) + .toList(); + Specification specification = InvestigationSpecification.toSpecification(investigationSpecifications, searchCriteria.getSearchCriteriaOperator()); + return new PageResult<>(jpaInvestigationRepository.findAll(specification, pageable), InvestigationEntity::toDomain); + } + @Override public QualityNotificationId updateQualityNotificationEntity(QualityNotification investigation) { InvestigationEntity investigationEntity = jpaInvestigationRepository.findById(investigation.getNotificationId().value()) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/investigation/repository/JpaInvestigationRepository.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/investigation/repository/JpaInvestigationRepository.java index 6dafeed9b9..d4d4958c5f 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/investigation/repository/JpaInvestigationRepository.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/investigation/repository/JpaInvestigationRepository.java @@ -27,6 +27,7 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; @@ -34,7 +35,7 @@ import java.util.Optional; @Repository -public interface JpaInvestigationRepository extends JpaRepository { +public interface JpaInvestigationRepository extends JpaRepository, JpaSpecificationExecutor { Page findAllBySideEquals(NotificationSideBaseEntity investigationSide, Pageable pageable); diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/AlertNotificationsSupport.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/AlertNotificationsSupport.java index 661e3c0700..0dc0e01fea 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/AlertNotificationsSupport.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/AlertNotificationsSupport.java @@ -19,12 +19,18 @@ package org.eclipse.tractusx.traceability.integration.common.support; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.alert.model.AlertEntity; import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.alert.model.AlertNotificationEntity; import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.alert.repository.JpaAlertNotificationRepository; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.NotificationSideBaseEntity; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.NotificationStatusBaseEntity; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.time.Instant; +import java.time.temporal.ChronoUnit; import java.util.Arrays; +import java.util.Collections; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; @@ -35,6 +41,88 @@ public class AlertNotificationsSupport { @Autowired JpaAlertNotificationRepository jpaAlertNotificationRepository; + public void defaultAlertsStored() { + Instant now = Instant.now(); + AlertEntity firstAlert = AlertEntity.builder() + .assets(Collections.emptyList()) + .bpn("BPNL00000003AXS3") + .status(NotificationStatusBaseEntity.CREATED) + .side(NotificationSideBaseEntity.SENDER) + .description("1") + .createdDate(now.minusSeconds(10L)) + .build(); + AlertEntity secondAlert = AlertEntity.builder() + .assets(Collections.emptyList()) + .bpn("BPNL00000003AXS3") + .status(NotificationStatusBaseEntity.CREATED) + .description("2") + .side(NotificationSideBaseEntity.SENDER) + .createdDate(now.plusSeconds(21L)) + .build(); + AlertEntity thirdAlert = AlertEntity.builder() + .assets(Collections.emptyList()) + .bpn("BPNL00000003AXS3") + .status(NotificationStatusBaseEntity.CREATED) + .description("3") + .side(NotificationSideBaseEntity.SENDER) + .createdDate(now) + .build(); + AlertEntity fourthAlert = AlertEntity.builder() + .assets(Collections.emptyList()) + .bpn("BPNL00000003AXS3") + .status(NotificationStatusBaseEntity.CREATED) + .description("4") + .side(NotificationSideBaseEntity.SENDER) + .createdDate(now.minus(2L, ChronoUnit.DAYS)) + .build(); + AlertEntity fifthAlert = AlertEntity.builder() + .assets(Collections.emptyList()) + .bpn("BPNL00000003AXS2") + .status(NotificationStatusBaseEntity.CREATED) + .description("5") + .side(NotificationSideBaseEntity.RECEIVER) + .createdDate(now.plusSeconds(40L)) + .build(); + + storedAlertNotifications( + AlertNotificationEntity + .builder() + .id("1") + .alert(firstAlert) + .status(NotificationStatusBaseEntity.CREATED) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a11") + .build(), + AlertNotificationEntity + .builder() + .status(NotificationStatusBaseEntity.CREATED) + .id("2") + .alert(secondAlert) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a22") + .build(), + AlertNotificationEntity + .builder() + .status(NotificationStatusBaseEntity.CREATED) + .id("3") + .alert(thirdAlert) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a33") + .build(), + AlertNotificationEntity + .builder() + .status(NotificationStatusBaseEntity.CREATED) + .id("4") + .alert(fourthAlert) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a44") + .build(), + AlertNotificationEntity + .builder() + .status(NotificationStatusBaseEntity.CREATED) + .id("5") + .alert(fifthAlert) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a55") + .build() + ); + } + public AlertNotificationEntity storedAlertNotification(AlertNotificationEntity notification) { return jpaAlertNotificationRepository.save(notification); } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/InvestigationNotificationsSupport.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/InvestigationNotificationsSupport.java index 0b661bc0c8..caeee10166 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/InvestigationNotificationsSupport.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/InvestigationNotificationsSupport.java @@ -19,14 +19,20 @@ package org.eclipse.tractusx.traceability.integration.common.support; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.investigation.model.InvestigationEntity; import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.investigation.model.InvestigationNotificationEntity; import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.investigation.repository.JpaInvestigationNotificationRepository; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.NotificationSideBaseEntity; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.NotificationStatusBaseEntity; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.time.Instant; import java.util.Arrays; +import java.util.Collections; import java.util.List; +import static java.time.temporal.ChronoUnit.DAYS; import static org.assertj.core.api.Assertions.assertThat; @Component @@ -35,11 +41,112 @@ public class InvestigationNotificationsSupport { @Autowired JpaInvestigationNotificationRepository jpaInvestigationNotificationRepository; + public void defaultInvestigationsStored() { + Instant now = Instant.now(); + String testBpn = "BPNL00000003AXS3"; + String testBpn2 = "BPNL00000003AXS2"; + + InvestigationEntity investigation1 = InvestigationEntity.builder() + .assets(Collections.emptyList()) + .bpn(testBpn) + .status(NotificationStatusBaseEntity.SENT) + .side(NotificationSideBaseEntity.SENDER) + .description("1") + .createdDate(now.minusSeconds(10L)) + .build(); + InvestigationEntity investigation2 = InvestigationEntity.builder() + .assets(Collections.emptyList()) + .bpn(testBpn) + .status(NotificationStatusBaseEntity.CREATED) + .description("2") + .side(NotificationSideBaseEntity.SENDER) + .createdDate(now.plusSeconds(21L)) + .build(); + InvestigationEntity investigation3 = InvestigationEntity.builder() + .assets(Collections.emptyList()) + .bpn(testBpn) + .status(NotificationStatusBaseEntity.CLOSED) + .description("3") + .side(NotificationSideBaseEntity.SENDER) + .createdDate(now) + .build(); + InvestigationEntity investigation4 = InvestigationEntity.builder() + .assets(Collections.emptyList()) + .bpn(testBpn) + .status(NotificationStatusBaseEntity.CREATED) + .description("4") + .side(NotificationSideBaseEntity.SENDER) + .createdDate(now.plusSeconds(20L)) + .build(); + InvestigationEntity investigation5 = InvestigationEntity.builder() + .assets(Collections.emptyList()) + .bpn(testBpn) + .status(NotificationStatusBaseEntity.ACKNOWLEDGED) + .description("5") + .side(NotificationSideBaseEntity.SENDER) + .createdDate(now.minus(2L, DAYS)) + .build(); + InvestigationEntity investigation6 = InvestigationEntity.builder() + .assets(Collections.emptyList()) + .bpn(testBpn2) + .status(NotificationStatusBaseEntity.ACKNOWLEDGED) + .description("6") + .side(NotificationSideBaseEntity.RECEIVER) + .createdDate(now.minus(2L, DAYS)) + .build(); + + + storedNotifications( + InvestigationNotificationEntity + .builder() + .id("1") + .investigation(investigation1) + .status(NotificationStatusBaseEntity.CREATED) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a11") + .build(), + InvestigationNotificationEntity + .builder() + .status(NotificationStatusBaseEntity.CREATED) + .id("2") + .investigation(investigation2) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a22") + .build(), + InvestigationNotificationEntity + .builder() + .status(NotificationStatusBaseEntity.CREATED) + .id("3") + .investigation(investigation3) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a33") + .build(), + InvestigationNotificationEntity + .builder() + .status(NotificationStatusBaseEntity.CREATED) + .id("4") + .investigation(investigation4) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a44") + .build(), + InvestigationNotificationEntity + .builder() + .status(NotificationStatusBaseEntity.CREATED) + .id("5") + .investigation(investigation5) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a55") + .build(), + InvestigationNotificationEntity + .builder() + .status(NotificationStatusBaseEntity.ACKNOWLEDGED) + .id("6") + .investigation(investigation6) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a66") + .build() + ); + } + public InvestigationNotificationEntity storedNotification(InvestigationNotificationEntity notification) { return jpaInvestigationNotificationRepository.save(notification); } - public void storedNotifications(InvestigationNotificationEntity... notifications) { + public void storedNotifications(InvestigationNotificationEntity... notifications) { Arrays.stream(notifications) .forEach(this::storedNotification); } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/AlertControllerFilterIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/AlertControllerFilterIT.java new file mode 100644 index 0000000000..7ea4a2f0fd --- /dev/null +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/AlertControllerFilterIT.java @@ -0,0 +1,106 @@ +/******************************************************************************** + * 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.qualitynotification.alert; + +import io.restassured.http.ContentType; +import org.eclipse.tractusx.traceability.integration.IntegrationTestSpecification; +import org.eclipse.tractusx.traceability.integration.common.support.AlertNotificationsSupport; +import org.hamcrest.Matchers; +import org.jose4j.lang.JoseException; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.time.LocalDate; + +import static io.restassured.RestAssured.given; +import static org.eclipse.tractusx.traceability.common.security.JwtRole.ADMIN; + + +class AlertControllerFilterIT extends IntegrationTestSpecification { + @Autowired + AlertNotificationsSupport alertNotificationsSupport; + + @Test + void givenAlerts_whenProvideNoFilter_thenReturnAll() throws JoseException { + // given + alertNotificationsSupport.defaultAlertsStored(); + + // when/then + given() + .header(oAuth2Support.jwtAuthorization(ADMIN)) + .param("page", "0") + .param("size", "10") + .contentType(ContentType.JSON) + .when() + .get("/api/alerts") + .then() + .statusCode(200) + .body("page", Matchers.is(0)) + .body("pageSize", Matchers.is(10)) + .body("content", Matchers.hasSize(5)) + .body("totalItems", Matchers.is(5)); + } + + @Test + void givenAlerts_whenProvideBpnFilter_thenReturnExpectedResult() throws JoseException { + // given + alertNotificationsSupport.defaultAlertsStored(); + String filter = "?filter=bpn,STARTS_WITH,BPNL00000003AXS2"; + final String filterOperator = "&filterOperator=OR"; + + // when/then + given() + .header(oAuth2Support.jwtAuthorization(ADMIN)) + .param("page", "0") + .param("size", "10") + .contentType(ContentType.JSON) + .when() + .get("/api/alerts" + filter + filterOperator) + .then() + .statusCode(200) + .body("page", Matchers.is(0)) + .body("pageSize", Matchers.is(10)) + .body("content", Matchers.hasSize(1)) + .body("totalItems", Matchers.is(1)); + } + + @Test + void givenAlerts_whenProvideBpnFilterAnd_thenReturnExpectedResult() throws JoseException { + // given + alertNotificationsSupport.defaultAlertsStored(); + String filter = "?filter=bpn,STARTS_WITH,BPNL00000003AXS2&filter=createdDate,AT_LOCAL_DATE," + LocalDate.now(); + final String filterOperator = "&filterOperator=OR"; + + // when/then + given() + .header(oAuth2Support.jwtAuthorization(ADMIN)) + .param("page", "0") + .param("size", "10") + .contentType(ContentType.JSON) + .when() + .get("/api/alerts" + filter + filterOperator) + .then() + .statusCode(200) + .body("page", Matchers.is(0)) + .body("pageSize", Matchers.is(10)) + .body("content", Matchers.hasSize(4)) + .body("totalItems", Matchers.is(4)); + } +} diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/InvestigationControllerFilterIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/InvestigationControllerFilterIT.java new file mode 100644 index 0000000000..25ef84d931 --- /dev/null +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/InvestigationControllerFilterIT.java @@ -0,0 +1,106 @@ +/******************************************************************************** + * 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.qualitynotification.investigation; + +import io.restassured.http.ContentType; +import org.eclipse.tractusx.traceability.integration.IntegrationTestSpecification; +import org.eclipse.tractusx.traceability.integration.common.support.InvestigationNotificationsSupport; +import org.hamcrest.Matchers; +import org.jose4j.lang.JoseException; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.time.LocalDate; + +import static io.restassured.RestAssured.given; +import static org.eclipse.tractusx.traceability.common.security.JwtRole.ADMIN; + +class InvestigationControllerFilterIT extends IntegrationTestSpecification { + + @Autowired + InvestigationNotificationsSupport InvestigationNotificationSupport; + + @Test + void givenInvestigations_whenProvideNoFilter_thenReturnAll() throws JoseException { + // given + InvestigationNotificationSupport.defaultInvestigationsStored(); + + // when/then + given() + .header(oAuth2Support.jwtAuthorization(ADMIN)) + .param("page", "0") + .param("size", "10") + .contentType(ContentType.JSON) + .when() + .get("/api/investigations") + .then() + .statusCode(200) + .body("page", Matchers.is(0)) + .body("pageSize", Matchers.is(10)) + .body("content", Matchers.hasSize(6)) + .body("totalItems", Matchers.is(6)); + } + + @Test + void givenInvestigations_whenProvideBpnFilter_thenReturnExpectedResult() throws JoseException { + // given + InvestigationNotificationSupport.defaultInvestigationsStored(); + String filter = "?filter=bpn,STARTS_WITH,BPNL00000003AXS2"; + final String filterOperator = "&filterOperator=OR"; + + // when/then + given() + .header(oAuth2Support.jwtAuthorization(ADMIN)) + .param("page", "0") + .param("size", "10") + .contentType(ContentType.JSON) + .when() + .get("/api/investigations" + filter + filterOperator) + .then() + .statusCode(200) + .body("page", Matchers.is(0)) + .body("pageSize", Matchers.is(10)) + .body("content", Matchers.hasSize(1)) + .body("totalItems", Matchers.is(1)); + } + + @Test + void givenInvestigations_whenProvideBpnFilterAnd_thenReturnExpectedResult() throws JoseException { + // given + InvestigationNotificationSupport.defaultInvestigationsStored(); + String filter = "?filter=bpn,STARTS_WITH,BPNL00000003AXS3&filter=createdDate,AT_LOCAL_DATE," + LocalDate.now(); + final String filterOperator = "&filterOperator=AND"; + + // when/then + given() + .header(oAuth2Support.jwtAuthorization(ADMIN)) + .param("page", "0") + .param("size", "10") + .contentType(ContentType.JSON) + .when() + .get("/api/investigations" + filter + filterOperator) + .then() + .statusCode(200) + .body("page", Matchers.is(0)) + .body("pageSize", Matchers.is(10)) + .body("content", Matchers.hasSize(4)) + .body("totalItems", Matchers.is(4)); + } +} From 255470d50c5bbcd20a01013a3254f5c8ba005213 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Fri, 20 Oct 2023 16:44:30 +0200 Subject: [PATCH 02/27] chore: TRACEFOSS-2725 refactor specifications to support field operators --- .../AssetAsBuiltRepositoryImpl.java | 2 +- .../AssetAsPlannedRepositoryImpl.java | 2 +- .../common/model/SearchCriteria.java | 1 - .../common/model/SearchCriteriaFilter.java | 3 +- ...ategy.java => SearchCriteriaStrategy.java} | 2 +- .../common/repository/BaseSpecification.java | 58 +++++++++--------- .../common/repository/FieldOperatorMap.java | 29 +++++++++ .../request/SearchCriteriaRequestParam.java | 27 ++------- .../repository/AlertsRepositoryImpl.java | 2 +- .../InvestigationsRepositoryImpl.java | 2 +- .../assets/AssetAsBuiltControllerAllIT.java | 20 +++---- .../AssetAsBuiltControllerFilteringIT.java | 60 ++++++++----------- .../assets/AssetAsPlannedControllerAllIT.java | 5 +- .../AssetAsPlannedControllerFilteringIT.java | 20 +++---- .../alert/AlertControllerFilterIT.java | 14 ++--- .../InvestigationControllerFilterIT.java | 10 ++-- 16 files changed, 123 insertions(+), 134 deletions(-) rename tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/model/{SearchStrategy.java => SearchCriteriaStrategy.java} (96%) create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/repository/FieldOperatorMap.java 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 5b2d58eac8..1c6d48d27f 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 @@ -80,7 +80,7 @@ public AssetBase getAssetByChildId(String assetId, String childId) { @Override public PageResult getAssets(Pageable pageable, SearchCriteria searchCriteria) { List assetAsBuildSpecifications = emptyIfNull(searchCriteria.getSearchCriteriaFilterList()).stream().map(AssetAsBuildSpecification::new).toList(); - Specification specification = AssetAsBuildSpecification.toSpecification(assetAsBuildSpecifications, searchCriteria.getSearchCriteriaOperator()); + Specification specification = AssetAsBuildSpecification.toSpecification(assetAsBuildSpecifications); return new PageResult<>(jpaAssetAsBuiltRepository.findAll(specification, pageable), AssetAsBuiltEntity::toDomain); } 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 8e20e65654..239d810f64 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 @@ -76,7 +76,7 @@ public AssetBase getAssetByChildId(String assetId, String childId) { @Override public PageResult getAssets(Pageable pageable, SearchCriteria searchCriteria) { List assetAsPlannedSpecifications = emptyIfNull(searchCriteria.getSearchCriteriaFilterList()).stream().map(AssetAsPlannedSpecification::new).toList(); - Specification specification = AssetAsPlannedSpecification.toSpecification(assetAsPlannedSpecifications, searchCriteria.getSearchCriteriaOperator()); + Specification specification = AssetAsPlannedSpecification.toSpecification(assetAsPlannedSpecifications); return new PageResult<>(jpaAssetAsPlannedRepository.findAll(specification, pageable), AssetAsPlannedEntity::toDomain); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/model/SearchCriteria.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/model/SearchCriteria.java index 0812a94d29..a4d2c71c4c 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/model/SearchCriteria.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/model/SearchCriteria.java @@ -28,5 +28,4 @@ @Builder public class SearchCriteria { List searchCriteriaFilterList; - SearchCriteriaOperator searchCriteriaOperator; } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/model/SearchCriteriaFilter.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/model/SearchCriteriaFilter.java index 5170d0d697..48fbd97980 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/model/SearchCriteriaFilter.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/model/SearchCriteriaFilter.java @@ -26,6 +26,7 @@ @Builder public class SearchCriteriaFilter { private String key; - private SearchStrategy strategy; + private SearchCriteriaStrategy strategy; private String value; + private SearchCriteriaOperator operator; } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/model/SearchStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/model/SearchCriteriaStrategy.java similarity index 96% rename from tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/model/SearchStrategy.java rename to tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/model/SearchCriteriaStrategy.java index 00ce1126bb..2043d4b157 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/model/SearchStrategy.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/model/SearchCriteriaStrategy.java @@ -19,7 +19,7 @@ package org.eclipse.tractusx.traceability.common.model; -public enum SearchStrategy { +public enum SearchCriteriaStrategy { EQUAL, STARTS_WITH, AT_LOCAL_DATE diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/repository/BaseSpecification.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/repository/BaseSpecification.java index d34bebf0d6..6402b77157 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/repository/BaseSpecification.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/repository/BaseSpecification.java @@ -25,7 +25,7 @@ import lombok.Getter; import org.eclipse.tractusx.traceability.common.model.SearchCriteriaFilter; import org.eclipse.tractusx.traceability.common.model.SearchCriteriaOperator; -import org.eclipse.tractusx.traceability.common.model.SearchStrategy; +import org.eclipse.tractusx.traceability.common.model.SearchCriteriaStrategy; import org.springframework.data.jpa.domain.Specification; import java.time.LocalDate; @@ -49,17 +49,17 @@ protected BaseSpecification(SearchCriteriaFilter searchCriteriaFilter) { } protected Predicate createPredicate(SearchCriteriaFilter criteria, Root root, CriteriaBuilder builder) { - if (criteria.getStrategy().equals(SearchStrategy.EQUAL)) { + if (criteria.getStrategy().equals(SearchCriteriaStrategy.EQUAL)) { return builder.equal( root.get(criteria.getKey()).as(String.class), criteria.getValue()); } - if (criteria.getStrategy().equals(SearchStrategy.STARTS_WITH)) { + if (criteria.getStrategy().equals(SearchCriteriaStrategy.STARTS_WITH)) { return builder.like( root.get(criteria.getKey()), criteria.getValue() + "%"); } - if (criteria.getStrategy().equals(SearchStrategy.AT_LOCAL_DATE)) { + if (criteria.getStrategy().equals(SearchCriteriaStrategy.AT_LOCAL_DATE)) { final LocalDate localDate = LocalDate.parse(criteria.getValue()); Predicate startingFrom = builder.greaterThanOrEqualTo(root.get(criteria.getKey()), LocalDateTime.of(localDate, LocalTime.MIN)); @@ -70,7 +70,7 @@ protected Predicate createPredicate(SearchCriteriaFilter criteria, Root root, return null; } - public static Specification toSpecification(List> specifications, SearchCriteriaOperator searchCriteriaOperator) { + public static Specification toSpecification(List> specifications) { if (specifications.isEmpty()) { return null; } @@ -78,50 +78,50 @@ public static Specification toSpecification(List>> groupedSpecifications = specifications.stream() .collect(groupingBy(spec -> spec.getSearchCriteriaFilter().getKey())); - Map> fieldSpecsByFieldName = groupedSpecifications.values().stream() + Map> fieldSpecsByFieldName = groupedSpecifications.values().stream() .map(BaseSpecification::combineFieldSpecifications) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); - return combineSpecifications(fieldSpecsByFieldName, searchCriteriaOperator); + return combineSpecifications(fieldSpecsByFieldName); } // Combines all fields into one specification - private static Specification combineSpecifications(Map> fieldSpecsByFieldName, SearchCriteriaOperator searchCriteriaOperator) { - Specification result; - - // global filtering specific logic - if (fieldSpecsByFieldName.containsKey(OWNER_FIELD_NAME) && SearchCriteriaOperator.OR.equals(searchCriteriaOperator)) { - result = fieldSpecsByFieldName.get(OWNER_FIELD_NAME); - List> otherFieldsSpecifications = fieldSpecsByFieldName.entrySet().stream() - .filter(entry -> !OWNER_FIELD_NAME.equals(entry.getKey())) - .map(Map.Entry::getValue).toList(); - - if (otherFieldsSpecifications.isEmpty()) { - return result; - } - return Specification.where(result).and(combineWithSpecificationsWith(otherFieldsSpecifications, SearchCriteriaOperator.OR)); - } else { + private static Specification combineSpecifications(Map> fieldSpecsByFieldName) { + List> andSpecifications = extractSpecificationsWithOperator(fieldSpecsByFieldName, SearchCriteriaOperator.AND); + List> orSpecifications = extractSpecificationsWithOperator(fieldSpecsByFieldName, SearchCriteriaOperator.OR); - List> fieldSpecList = fieldSpecsByFieldName.values().stream().toList(); + return Specification.where(combineWithSpecificationsWith(andSpecifications, SearchCriteriaOperator.AND)) + .and(combineWithSpecificationsWith(orSpecifications, SearchCriteriaOperator.OR)); + } - result = combineWithSpecificationsWith(fieldSpecList, searchCriteriaOperator); - } - return result; + private static List> extractSpecificationsWithOperator(Map> fieldSpecsByFieldName, SearchCriteriaOperator searchCriteriaOperator) { + return fieldSpecsByFieldName.entrySet().stream() + .filter(entry -> searchCriteriaOperator.equals(entry.getKey().operator)) + .map(Map.Entry::getValue) + .toList(); } + // Combines specific field specifications - private static Map.Entry> combineFieldSpecifications(List> specifications) { + private static Map.Entry> combineFieldSpecifications(List> specifications) { // TODO: Add here date range handling if list has BEFORE_LOCAL_DATE and AFTER_LOCAL_DATE then combine those with AND - String fieldName = specifications.get(0).searchCriteriaFilter.getKey(); + FieldOperatorMap fieldOperatorMap = FieldOperatorMap.builder() + .fieldName(specifications.get(0).searchCriteriaFilter.getKey()) + .operator(specifications.get(0).searchCriteriaFilter.getOperator()) + .build(); + Specification result = combineWithSpecificationsWith( specifications.stream().map(baseSpec -> (Specification) baseSpec).toList(), SearchCriteriaOperator.OR); - return Map.entry(fieldName, result); + return Map.entry(fieldOperatorMap, result); } private static Specification combineWithSpecificationsWith(List> specifications, SearchCriteriaOperator searchCriteriaOperator) { + if (specifications.isEmpty()) { + return null; + } Specification result = specifications.get(0); for (int i = 1; i < specifications.size(); i++) { if (SearchCriteriaOperator.OR.equals(searchCriteriaOperator)) { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/repository/FieldOperatorMap.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/repository/FieldOperatorMap.java new file mode 100644 index 0000000000..723f71f938 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/repository/FieldOperatorMap.java @@ -0,0 +1,29 @@ +/******************************************************************************** + * 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.Builder; +import org.eclipse.tractusx.traceability.common.model.SearchCriteriaOperator; + +@Builder +public class FieldOperatorMap { + String fieldName; + SearchCriteriaOperator operator; +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/request/SearchCriteriaRequestParam.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/request/SearchCriteriaRequestParam.java index 5d243aa630..d38a385f89 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/request/SearchCriteriaRequestParam.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/request/SearchCriteriaRequestParam.java @@ -26,7 +26,7 @@ import org.eclipse.tractusx.traceability.common.model.SearchCriteria; import org.eclipse.tractusx.traceability.common.model.SearchCriteriaFilter; import org.eclipse.tractusx.traceability.common.model.SearchCriteriaOperator; -import org.eclipse.tractusx.traceability.common.model.SearchStrategy; +import org.eclipse.tractusx.traceability.common.model.SearchCriteriaStrategy; import java.util.ArrayList; import java.util.Collections; @@ -40,22 +40,12 @@ public class SearchCriteriaRequestParam { @ArraySchema(arraySchema = @Schema(description = "Filter Criteria", additionalProperties = Schema.AdditionalPropertiesValue.FALSE, example = "owner,EQUAL,OWN"), maxItems = Integer.MAX_VALUE) private List filter; - @Schema(description = "The filter logical operator", example = "AND", allowableValues = {"AND", "OR"}) - private String filterOperator; - public SearchCriteria toSearchCriteria() { ArrayList filters = new ArrayList<>(); List inputFilters = filter; if (isNull(this.filter)) { inputFilters = Collections.emptyList(); } - if (!isNull(this.filter) && isNull(this.filterOperator)) { - throw new InvalidFilterException( - "No filter operator found. Please add param filterOperator=AND or filterOperator=OR"); - } - if (isNull(this.filter) && isNull(this.filterOperator)) { - return SearchCriteria.builder().build(); - } for (String filter : inputFilters) { try { @@ -63,8 +53,9 @@ public SearchCriteria toSearchCriteria() { filters.add( SearchCriteriaFilter.builder() .key(filterParams[0]) - .strategy(SearchStrategy.valueOf(filterParams[1])) + .strategy(SearchCriteriaStrategy.valueOf(filterParams[1])) .value(filterParams[2]) + .operator(SearchCriteriaOperator.valueOf(filterParams[3])) .build()); } catch (Exception exception) { throw new InvalidFilterException( @@ -74,16 +65,6 @@ public SearchCriteria toSearchCriteria() { } } - - SearchCriteriaOperator operator; - try { - operator = SearchCriteriaOperator.valueOf(filterOperator); - } catch (Exception exception) { - throw new InvalidFilterException( - "Invalid filter operator provided filterOperator={provided} expected format is following filterOperator=value. Where value is one of AND, OR" - .replace("{provided}", filterOperator) - ); - } - return SearchCriteria.builder().searchCriteriaOperator(operator).searchCriteriaFilterList(filters).build(); + return SearchCriteria.builder().searchCriteriaFilterList(filters).build(); } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/alert/repository/AlertsRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/alert/repository/AlertsRepositoryImpl.java index cba0d14f0c..054f903b6c 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/alert/repository/AlertsRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/alert/repository/AlertsRepositoryImpl.java @@ -84,7 +84,7 @@ public PageResult getNotifications(Pageable pageable, Searc List alertsSpecifications = emptyIfNull(searchCriteria.getSearchCriteriaFilterList()).stream() .map(AlertSpecification::new) .toList(); - Specification specification = AlertSpecification.toSpecification(alertsSpecifications, searchCriteria.getSearchCriteriaOperator()); + Specification specification = AlertSpecification.toSpecification(alertsSpecifications); return new PageResult<>(jpaAlertRepository.findAll(specification, pageable), AlertEntity::toDomain); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/investigation/repository/InvestigationsRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/investigation/repository/InvestigationsRepositoryImpl.java index ef3bbdfe92..ed758e3e19 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/investigation/repository/InvestigationsRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/investigation/repository/InvestigationsRepositoryImpl.java @@ -78,7 +78,7 @@ public PageResult getNotifications(Pageable pageable, Searc List investigationSpecifications = emptyIfNull(searchCriteria.getSearchCriteriaFilterList()).stream() .map(InvestigationSpecification::new) .toList(); - Specification specification = InvestigationSpecification.toSpecification(investigationSpecifications, searchCriteria.getSearchCriteriaOperator()); + Specification specification = InvestigationSpecification.toSpecification(investigationSpecifications); return new PageResult<>(jpaInvestigationRepository.findAll(specification, pageable), InvestigationEntity::toDomain); } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerAllIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerAllIT.java index 5af5d943ed..dd8da4d773 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerAllIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerAllIT.java @@ -35,7 +35,10 @@ import static io.restassured.RestAssured.given; import static org.eclipse.tractusx.traceability.common.security.JwtRole.ADMIN; -import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.everyItem; +import static org.hamcrest.Matchers.hasEntry; +import static org.hamcrest.Matchers.not; import static org.junit.jupiter.params.provider.Arguments.arguments; class AssetAsBuiltControllerAllIT extends IntegrationTestSpecification { @@ -78,13 +81,12 @@ void shouldReturnAssetsWithManufacturerName() throws JoseException { void shoulReturnSupplierAssets() throws JoseException { //GIVEN assetsSupport.defaultAssetsStored(); - final String filterOperator = "AND"; + final String filter = "owner,EQUAL,SUPPLIER,AND"; //THEN given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) - .queryParam("filter", "owner,EQUAL,SUPPLIER") - .queryParam("filterOperator", filterOperator) + .queryParam("filter", filter) .when() .get("/api/assets/as-built") .then() @@ -97,13 +99,12 @@ void shoulReturnSupplierAssets() throws JoseException { void shouldReturnOwnAssets() throws JoseException { //GIVEN assetsSupport.defaultAssetsStored(); - final String filterOperator = "AND"; + final String filter = "owner,EQUAL,OWN,AND"; //THEN given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) - .queryParam("filter", "owner,EQUAL,OWN") - .queryParam("filterOperator", filterOperator) + .queryParam("filter", filter) .when() .get("/api/assets/as-built") .then() @@ -146,13 +147,12 @@ void shouldReturnAllAssets() throws JoseException { void shouldReturnAssetsByOwnerFiltering(String ownerValue, int totalItemsValue) throws JoseException { //GIVEN assetsSupport.defaultAssetsStored(); - final String filterOperator = "AND"; + final String filter = "owner,EQUAL," + ownerValue + ",AND"; //THEN given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) - .queryParam("filter", "owner,EQUAL," + ownerValue) - .queryParam("filterOperator", filterOperator) + .queryParam("filter", filter) .when() .get("/api/assets/as-built") .then() diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerFilteringIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerFilteringIT.java index 6b7d93be8e..6840173ae5 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerFilteringIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsBuiltControllerFilteringIT.java @@ -79,8 +79,7 @@ void givenNoFilter_whenCallFilteredEndpointWithoutOperator_thenReturnBadRequest( void givenInInvestigationFalseFilter_whenCallFilteredEndpoint_thenReturnExpectedResult() throws JoseException { // given assetsSupport.defaultAssetsStored(); - final String filter = "?filter=activeAlert,EQUAL,false"; - final String filterOperator = "&filterOperator=AND"; + final String filter = "?filter=activeAlert,EQUAL,false,AND"; // then given() @@ -88,7 +87,7 @@ void givenInInvestigationFalseFilter_whenCallFilteredEndpoint_thenReturnExpected .contentType(ContentType.JSON) .log().all() .when() - .get("/api/assets/as-built" + filter + filterOperator) + .get("/api/assets/as-built" + filter) .then() .log().all() .statusCode(200) @@ -99,8 +98,7 @@ void givenInInvestigationFalseFilter_whenCallFilteredEndpoint_thenReturnExpected void givenInInvestigationTrueFilter_whenCallFilteredEndpoint_thenReturnExpectedResult() throws JoseException { // given assetsSupport.defaultAssetsStored(); - final String filter = "?filter=activeAlert,EQUAL,true"; - final String filterOperator = "&filterOperator=AND"; + final String filter = "?filter=activeAlert,EQUAL,true,AND"; // then given() @@ -108,7 +106,7 @@ void givenInInvestigationTrueFilter_whenCallFilteredEndpoint_thenReturnExpectedR .contentType(ContentType.JSON) .log().all() .when() - .get("/api/assets/as-built" + filter + filterOperator) + .get("/api/assets/as-built" + filter) .then() .log().all() .statusCode(200) @@ -119,15 +117,14 @@ void givenInInvestigationTrueFilter_whenCallFilteredEndpoint_thenReturnExpectedR void givenIdAndIdShortFilter_whenCallFilteredEndpoint_thenReturnExpectedResult() throws JoseException { // given assetsSupport.defaultAssetsStored(); - final String filter = "?filter=id,STARTS_WITH,urn:uuid:1&filter=idShort,STARTS_WITH,engineering"; - final String filterOperator = "&filterOperator=AND"; + final String filter = "?filter=id,STARTS_WITH,urn:uuid:1,AND&filter=idShort,STARTS_WITH,engineering,AND"; // then given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) .log().all() .when() - .get("/api/assets/as-built" + filter + filterOperator) + .get("/api/assets/as-built" + filter) .then() .log().all() .statusCode(200) @@ -138,8 +135,7 @@ void givenIdAndIdShortFilter_whenCallFilteredEndpoint_thenReturnExpectedResult() void givenOwnFilter_whenCallFilteredEndpoint_thenReturnExpectedResult() throws JoseException { // given assetsSupport.defaultAssetsStored(); - final String filter = "?filter=owner,EQUAL,OWN"; - final String filterOperator = "&filterOperator=AND"; + final String filter = "?filter=owner,EQUAL,OWN,AND"; // then given() @@ -147,7 +143,7 @@ void givenOwnFilter_whenCallFilteredEndpoint_thenReturnExpectedResult() throws J .contentType(ContentType.JSON) .log().all() .when() - .get("/api/assets/as-built" + filter + filterOperator) + .get("/api/assets/as-built" + filter) .then() .log().all() .statusCode(200) @@ -158,8 +154,7 @@ void givenOwnFilter_whenCallFilteredEndpoint_thenReturnExpectedResult() throws J void givenManufacturerIdFilter_whenCallFilteredEndpoint_thenReturnExpectedResult() throws JoseException { // given assetsSupport.defaultAssetsStored(); - final String filter = "?filter=manufacturerId,EQUAL,BPNL00000003B0Q0"; - final String filterOperator = "&filterOperator=AND"; + final String filter = "?filter=manufacturerId,EQUAL,BPNL00000003B0Q0,AND"; // then given() @@ -167,7 +162,7 @@ void givenManufacturerIdFilter_whenCallFilteredEndpoint_thenReturnExpectedResult .contentType(ContentType.JSON) .log().all() .when() - .get("/api/assets/as-built" + filter + filterOperator) + .get("/api/assets/as-built" + filter) .then() .log().all() .statusCode(200) @@ -178,8 +173,7 @@ void givenManufacturerIdFilter_whenCallFilteredEndpoint_thenReturnExpectedResult void givenManufacturerIdAndSemanticModelIdFilter_whenCallFilteredEndpoint_thenReturnExpectedResult() throws JoseException { // given assetsSupport.defaultAssetsStored(); - final String filter = "?filter=manufacturerId,EQUAL,BPNL00000003B0Q0&filter=semanticModelId,STARTS_WITH,NO-3404609481920549"; - final String filterOperator = "&filterOperator=AND"; + final String filter = "?filter=manufacturerId,EQUAL,BPNL00000003B0Q0,AND&filter=semanticModelId,STARTS_WITH,NO-3404609481920549,AND"; // then given() @@ -187,7 +181,7 @@ void givenManufacturerIdAndSemanticModelIdFilter_whenCallFilteredEndpoint_thenRe .contentType(ContentType.JSON) .log().all() .when() - .get("/api/assets/as-built" + filter + filterOperator) + .get("/api/assets/as-built" + filter) .then() .log().all() .statusCode(200) @@ -198,8 +192,7 @@ void givenManufacturerIdAndSemanticModelIdFilter_whenCallFilteredEndpoint_thenRe void givenIdShortStartsWithFilter_whenCallFilteredEndpoint_thenReturnExpectedResult() throws JoseException { // given assetsSupport.defaultAssetsStored(); - final String filter = "?filter=idShort,STARTS_WITH,ntier_"; - final String filterOperator = "&filterOperator=AND"; + final String filter = "?filter=idShort,STARTS_WITH,ntier_,AND"; // then given() @@ -207,7 +200,7 @@ void givenIdShortStartsWithFilter_whenCallFilteredEndpoint_thenReturnExpectedRes .contentType(ContentType.JSON) .log().all() .when() - .get("/api/assets/as-built" + filter + filterOperator) + .get("/api/assets/as-built" + filter) .then() .log().all() .statusCode(200) @@ -218,8 +211,7 @@ void givenIdShortStartsWithFilter_whenCallFilteredEndpoint_thenReturnExpectedRes void givenManufacturingDateFilter_whenCallFilteredEndpoint_thenReturnExpectedResult() throws JoseException { // given assetsSupport.defaultAssetsStored(); - final String filter = "?filter=manufacturingDate,AT_LOCAL_DATE,2014-11-18"; - final String filterOperator = "&filterOperator=AND"; + final String filter = "?filter=manufacturingDate,AT_LOCAL_DATE,2014-11-18,AND"; // then given() @@ -227,7 +219,7 @@ void givenManufacturingDateFilter_whenCallFilteredEndpoint_thenReturnExpectedRes .contentType(ContentType.JSON) .log().all() .when() - .get("/api/assets/as-built" + filter + filterOperator) + .get("/api/assets/as-built" + filter) .then() .log().all() .statusCode(200) @@ -238,8 +230,7 @@ void givenManufacturingDateFilter_whenCallFilteredEndpoint_thenReturnExpectedRes void givenSemanticDataModelAndManufacturingDateFilterOR_whenCallFilteredEndpoint_thenReturnExpectedResult() throws JoseException { // given assetsSupport.defaultAssetsStored(); - final String filter = "?filter=manufacturingDate,AT_LOCAL_DATE,2014-11-18&filter=semanticDataModel,EQUAL,SERIALPART"; - final String filterOperator = "&filterOperator=OR"; + final String filter = "?filter=manufacturingDate,AT_LOCAL_DATE,2014-11-18,OR&filter=semanticDataModel,EQUAL,SERIALPART,OR"; // then given() @@ -247,7 +238,7 @@ void givenSemanticDataModelAndManufacturingDateFilterOR_whenCallFilteredEndpoint .contentType(ContentType.JSON) .log().all() .when() - .get("/api/assets/as-built" + filter + filterOperator) + .get("/api/assets/as-built" + filter) .then() .log().all() .statusCode(200) @@ -258,8 +249,7 @@ void givenSemanticDataModelAndManufacturingDateFilterOR_whenCallFilteredEndpoint void givenSemanticDataModelAndManufacturingDateFilterAnd_whenCallFilteredEndpoint_thenReturnExpectedResult() throws JoseException { // given assetsSupport.defaultAssetsStored(); - final String filter = "?filter=manufacturingDate,AT_LOCAL_DATE,2014-11-18&filter=semanticDataModel,EQUAL,SERIALPART"; - final String filterOperator = "&filterOperator=AND"; + final String filter = "?filter=manufacturingDate,AT_LOCAL_DATE,2014-11-18,AND&filter=semanticDataModel,EQUAL,SERIALPART,AND"; // then given() @@ -267,7 +257,7 @@ void givenSemanticDataModelAndManufacturingDateFilterAnd_whenCallFilteredEndpoin .contentType(ContentType.JSON) .log().all() .when() - .get("/api/assets/as-built" + filter + filterOperator) + .get("/api/assets/as-built" + filter) .then() .log().all() .statusCode(200) @@ -278,8 +268,7 @@ void givenSemanticDataModelAndManufacturingDateFilterAnd_whenCallFilteredEndpoin void givenSemanticDataModelAndOwnerOR_whenCallFilteredEndpoint_thenReturnExpectedResult() throws JoseException { // given assetsSupport.defaultAssetsStored(); - final String filter = "?filter=owner,EQUAL,SUPPLIER&filter=id,STARTS_WITH,urn:uuid:f7cf62fe-9e25-472b-9148-66"; - final String filterOperator = "&filterOperator=OR"; + final String filter = "?filter=owner,EQUAL,SUPPLIER,AND&filter=id,STARTS_WITH,urn:uuid:f7cf62fe-9e25-472b-9148-66,OR"; // then given() @@ -287,7 +276,7 @@ void givenSemanticDataModelAndOwnerOR_whenCallFilteredEndpoint_thenReturnExpecte .contentType(ContentType.JSON) .log().all() .when() - .get("/api/assets/as-built" + filter + filterOperator) + .get("/api/assets/as-built" + filter) .then() .log().all() .statusCode(200) @@ -298,8 +287,7 @@ void givenSemanticDataModelAndOwnerOR_whenCallFilteredEndpoint_thenReturnExpecte void givenSemanticDataModelAsMultipleValuesAndOwnerOR_whenCallFilteredEndpoint_thenReturnExpectedResult() throws JoseException { // given assetsSupport.defaultAssetsStored(); - final String filter = "?filter=owner,EQUAL,SUPPLIER&filter=semanticDataModel,EQUAL,SERIALPART&filter=semanticDataModel,EQUAL,BATCH"; - final String filterOperator = "&filterOperator=OR"; + final String filter = "?filter=owner,EQUAL,SUPPLIER,AND&filter=semanticDataModel,EQUAL,SERIALPART,OR&filter=semanticDataModel,EQUAL,BATCH,OR"; // then given() @@ -307,7 +295,7 @@ void givenSemanticDataModelAsMultipleValuesAndOwnerOR_whenCallFilteredEndpoint_t .contentType(ContentType.JSON) .log().all() .when() - .get("/api/assets/as-built" + filter + filterOperator) + .get("/api/assets/as-built" + filter) .then() .log().all() .statusCode(200) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerAllIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerAllIT.java index 3142a3843a..38533afa52 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerAllIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerAllIT.java @@ -85,12 +85,11 @@ void shouldReturnAssetsByOwnerFiltering(String ownerValue, int totalItemsValue) assetsSupport.defaultAssetsAsPlannedStored(); //THEN filter=owner,EQUAL,OWN - final String filterOperator = "AND"; + final String filter = "owner,EQUAL," + ownerValue + ",AND"; given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) - .queryParam("filter", "owner,EQUAL," + ownerValue) - .queryParam("filterOperator", filterOperator) + .queryParam("filter", filter) .when() .get("/api/assets/as-planned") .then() diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerFilteringIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerFilteringIT.java index 6c2e1dc433..6e1046245d 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerFilteringIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/assets/AssetAsPlannedControllerFilteringIT.java @@ -60,15 +60,14 @@ void givenNoFilter_whenCallFilteredEndpoint_thenReturnExpectedResult() throws Jo void givenOwnFilter_whenCallFilteredEndpoint_thenReturnExpectedResult() throws JoseException { // given assetsSupport.defaultAssetsAsPlannedStored(); - final String filter = "?filter=owner,EQUAL,OWN"; - final String filterOperator = "&filterOperator=AND"; + final String filter = "?filter=owner,EQUAL,OWN,AND"; // then given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) .log().all() .when() - .get("/api/assets/as-planned" + filter + filterOperator) + .get("/api/assets/as-planned" + filter) .then() .log().all() .statusCode(200) @@ -79,8 +78,7 @@ void givenOwnFilter_whenCallFilteredEndpoint_thenReturnExpectedResult() throws J void givenNameAtManufacturerFilter_whenCallFilteredEndpoint_thenReturnExpectedResult() throws JoseException { // given assetsSupport.defaultAssetsAsPlannedStored(); - final String filter = "?filter=nameAtManufacturer,STARTS_WITH,Vehicle"; - final String filterOperator = "&filterOperator=AND"; + final String filter = "?filter=nameAtManufacturer,STARTS_WITH,Vehicle,AND"; // then given() @@ -88,7 +86,7 @@ void givenNameAtManufacturerFilter_whenCallFilteredEndpoint_thenReturnExpectedRe .contentType(ContentType.JSON) .log().all() .when() - .get("/api/assets/as-planned" + filter + filterOperator) + .get("/api/assets/as-planned" + filter) .then() .log().all() .statusCode(200) @@ -99,8 +97,7 @@ void givenNameAtManufacturerFilter_whenCallFilteredEndpoint_thenReturnExpectedRe void givenNameAtManufacturerAndOwnerFilter_whenCallFilteredEndpoint_thenReturnExpectedResult() throws JoseException { // given assetsSupport.defaultAssetsAsPlannedStored(); - final String filter = "?filter=nameAtManufacturer,STARTS_WITH,Vehicle&filter=owner,EQUAL,SUPPLIER"; - final String filterOperator = "&filterOperator=AND"; + final String filter = "?filter=nameAtManufacturer,STARTS_WITH,Vehicle,AND&filter=owner,EQUAL,SUPPLIER,AND"; // then given() @@ -108,7 +105,7 @@ void givenNameAtManufacturerAndOwnerFilter_whenCallFilteredEndpoint_thenReturnEx .contentType(ContentType.JSON) .log().all() .when() - .get("/api/assets/as-planned" + filter + filterOperator) + .get("/api/assets/as-planned" + filter) .then() .log().all() .statusCode(200) @@ -119,8 +116,7 @@ void givenNameAtManufacturerAndOwnerFilter_whenCallFilteredEndpoint_thenReturnEx void givenSemanticDataModelAndOwnerOR_whenCallFilteredEndpoint_thenReturnExpectedResult() throws JoseException { // given assetsSupport.defaultAssetsAsPlannedStored(); - final String filter = "?filter=owner,EQUAL,SUPPLIER&filter=id,STARTS_WITH,urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01"; - final String filterOperator = "&filterOperator=OR"; + final String filter = "?filter=owner,EQUAL,SUPPLIER,OR&filter=id,STARTS_WITH,urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01,OR"; // then given() @@ -128,7 +124,7 @@ void givenSemanticDataModelAndOwnerOR_whenCallFilteredEndpoint_thenReturnExpecte .contentType(ContentType.JSON) .log().all() .when() - .get("/api/assets/as-planned" + filter + filterOperator) + .get("/api/assets/as-planned" + filter) .then() .log().all() .statusCode(200) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/AlertControllerFilterIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/AlertControllerFilterIT.java index 7ea4a2f0fd..cccd1cc548 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/AlertControllerFilterIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/AlertControllerFilterIT.java @@ -62,8 +62,7 @@ void givenAlerts_whenProvideNoFilter_thenReturnAll() throws JoseException { void givenAlerts_whenProvideBpnFilter_thenReturnExpectedResult() throws JoseException { // given alertNotificationsSupport.defaultAlertsStored(); - String filter = "?filter=bpn,STARTS_WITH,BPNL00000003AXS2"; - final String filterOperator = "&filterOperator=OR"; + String filter = "?filter=bpn,STARTS_WITH,BPNL00000003AXS2,OR"; // when/then given() @@ -72,7 +71,7 @@ void givenAlerts_whenProvideBpnFilter_thenReturnExpectedResult() throws JoseExce .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts" + filter + filterOperator) + .get("/api/alerts" + filter) .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -85,8 +84,7 @@ void givenAlerts_whenProvideBpnFilter_thenReturnExpectedResult() throws JoseExce void givenAlerts_whenProvideBpnFilterAnd_thenReturnExpectedResult() throws JoseException { // given alertNotificationsSupport.defaultAlertsStored(); - String filter = "?filter=bpn,STARTS_WITH,BPNL00000003AXS2&filter=createdDate,AT_LOCAL_DATE," + LocalDate.now(); - final String filterOperator = "&filterOperator=OR"; + String filter = "?filter=bpn,STARTS_WITH,BPNL00000003AXS2,AND&filter=createdDate,AT_LOCAL_DATE," + LocalDate.now() + ",AND"; // when/then given() @@ -95,12 +93,12 @@ void givenAlerts_whenProvideBpnFilterAnd_thenReturnExpectedResult() throws JoseE .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts" + filter + filterOperator) + .get("/api/alerts" + filter) .then() .statusCode(200) .body("page", Matchers.is(0)) .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(4)) - .body("totalItems", Matchers.is(4)); + .body("content", Matchers.hasSize(1)) + .body("totalItems", Matchers.is(1)); } } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/InvestigationControllerFilterIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/InvestigationControllerFilterIT.java index 25ef84d931..861b222d74 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/InvestigationControllerFilterIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/InvestigationControllerFilterIT.java @@ -62,8 +62,7 @@ void givenInvestigations_whenProvideNoFilter_thenReturnAll() throws JoseExceptio void givenInvestigations_whenProvideBpnFilter_thenReturnExpectedResult() throws JoseException { // given InvestigationNotificationSupport.defaultInvestigationsStored(); - String filter = "?filter=bpn,STARTS_WITH,BPNL00000003AXS2"; - final String filterOperator = "&filterOperator=OR"; + String filter = "?filter=bpn,STARTS_WITH,BPNL00000003AXS2,OR"; // when/then given() @@ -72,7 +71,7 @@ void givenInvestigations_whenProvideBpnFilter_thenReturnExpectedResult() throws .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/investigations" + filter + filterOperator) + .get("/api/investigations" + filter) .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -85,8 +84,7 @@ void givenInvestigations_whenProvideBpnFilter_thenReturnExpectedResult() throws void givenInvestigations_whenProvideBpnFilterAnd_thenReturnExpectedResult() throws JoseException { // given InvestigationNotificationSupport.defaultInvestigationsStored(); - String filter = "?filter=bpn,STARTS_WITH,BPNL00000003AXS3&filter=createdDate,AT_LOCAL_DATE," + LocalDate.now(); - final String filterOperator = "&filterOperator=AND"; + String filter = "?filter=bpn,STARTS_WITH,BPNL00000003AXS3,AND&filter=createdDate,AT_LOCAL_DATE," + LocalDate.now() + ",AND"; // when/then given() @@ -95,7 +93,7 @@ void givenInvestigations_whenProvideBpnFilterAnd_thenReturnExpectedResult() thro .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/investigations" + filter + filterOperator) + .get("/api/investigations" + filter) .then() .statusCode(200) .body("page", Matchers.is(0)) From f5f2d15989054d7d9807cd3afee5d4bf8981dbf7 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Fri, 20 Oct 2023 16:52:06 +0200 Subject: [PATCH 03/27] chore: TRACEFOSS-2725 add changelog --- CHANGELOG.md | 2 ++ .../traceability/common/repository/BaseSpecification.java | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffca19b39e..aadf900fac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,11 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Added - Added Table columns settings in part tables to show/hide/reorder table columns +- Support for Filtering on Alerts and Notifications endpoints ### Changed - Updated user manual to reflect the table column settings feature +- Changed Filter to support Logical operator (AND,OR) on searchCriteria ### Removed diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/repository/BaseSpecification.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/repository/BaseSpecification.java index 6402b77157..9f3a2248e4 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/repository/BaseSpecification.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/repository/BaseSpecification.java @@ -40,8 +40,6 @@ @Getter public abstract class BaseSpecification implements Specification { - private static final String OWNER_FIELD_NAME = "owner"; - private final SearchCriteriaFilter searchCriteriaFilter; protected BaseSpecification(SearchCriteriaFilter searchCriteriaFilter) { @@ -83,7 +81,6 @@ public static Specification toSpecification(List Date: Fri, 20 Oct 2023 23:37:36 +0200 Subject: [PATCH 04/27] chore: TRACEFOSS-2725 cleanup tests --- .../alert/rest/AlertController.java | 71 +- .../rest/InvestigationsController.java | 71 +- .../model/NotificationSideBaseEntity.java | 2 +- .../InvestigationNotificationsSupport.java | 277 ++++++-- .../common/support/InvestigationsSupport.java | 8 +- .../alert/PublisherAlertsControllerIT.java | 26 +- .../alert/ReadAlertsControllerIT.java | 53 +- .../alert/ReceiverAlertsControllerIT.java | 20 +- .../InvestigationControllerFilterIT.java | 16 +- .../PublisherInvestigationsControllerIT.java | 22 +- .../ReadInvestigationsControllerIT.java | 655 ++---------------- .../ReceiverInvestigationsControllerIT.java | 63 +- 12 files changed, 412 insertions(+), 872 deletions(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/rest/AlertController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/rest/AlertController.java index 95c463fdd1..86ca6e7184 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/rest/AlertController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/rest/AlertController.java @@ -126,10 +126,10 @@ public QualityNotificationIdResponse alertAssets(@RequestBody @Valid StartQualit return new QualityNotificationIdResponse(alertService.start(from(cleanStartQualityNotificationRequest)).value()); } - @Operation(operationId = "getCreatedAlerts", - summary = "Gets created alerts", + @Operation(operationId = "getAlerts", + summary = "Gets alerts", tags = {"Alerts"}, - description = "The endpoint returns created alerts as paged result.", + description = "The endpoint returns alerts as paged result.", security = @SecurityRequirement(name = "oAuth2", scopes = "profile email")) @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Returns the paged result found for Asset", content = @Content( mediaType = "application/json", @@ -179,71 +179,6 @@ public QualityNotificationIdResponse alertAssets(@RequestBody @Valid StartQualit content = @Content( mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))}) - @GetMapping("/created") - public PageResult getCreatedAlerts(OwnPageable pageable) { - log.info(API_LOG_START + "/created"); - return AlertResponseMapper.fromAsPageResult(alertService.getCreated(OwnPageable.toPageable(pageable))); - } - - @Operation(operationId = "getReceivedAlerts", - summary = "Gets received alerts", - tags = {"Alerts"}, - description = "The endpoint returns received alerts as paged result.", - security = @SecurityRequirement(name = "oAuth2", scopes = "profile email")) - @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Returns the paged result found for Asset", content = @Content( - mediaType = "application/json", - array = @ArraySchema(arraySchema = @Schema(description = "AlertData", implementation = AlertResponse.class, additionalProperties = Schema.AdditionalPropertiesValue.FALSE), maxItems = Integer.MAX_VALUE) - )), - @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 = "404", - description = "Not found.", - content = @Content( - mediaType = "application/json", - schema = @Schema(implementation = ErrorResponse.class))), - @ApiResponse( - responseCode = "415", - description = "Unsupported media type", - 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("/received") - public PageResult getReceivedAlerts(OwnPageable pageable) { - log.info(API_LOG_START + "/received"); - return AlertResponseMapper.fromAsPageResult(alertService.getReceived(OwnPageable.toPageable(pageable))); - } - @GetMapping("") public PageResult getAlerts(OwnPageable pageable, SearchCriteriaRequestParam filter) { return AlertResponseMapper.fromAsPageResult(alertService.getNotifications(OwnPageable.toPageable(pageable), filter.toSearchCriteria())); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/investigation/rest/InvestigationsController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/investigation/rest/InvestigationsController.java index 20493385b6..9f70efc90a 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/investigation/rest/InvestigationsController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/investigation/rest/InvestigationsController.java @@ -126,13 +126,12 @@ public QualityNotificationIdResponse investigateAssets(@RequestBody @Valid Start StartQualityNotificationRequest cleanRequest = sanitize(request); log.info(API_LOG_START + " with params: {}", cleanRequest); return new QualityNotificationIdResponse(investigationService.start(from(cleanRequest)).value()); - } - @Operation(operationId = "getCreatedInvestigations", - summary = "Gets created investigations", + @Operation(operationId = "getInvestigations", + summary = "Gets investigations", tags = {"Investigations"}, - description = "The endpoint returns created investigations as paged result.", + description = "The endpoint returns investigations as paged result.", security = @SecurityRequirement(name = "oAuth2", scopes = "profile email")) @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Returns the paged result found for Asset", content = @Content( mediaType = "application/json", @@ -181,70 +180,6 @@ public QualityNotificationIdResponse investigateAssets(@RequestBody @Valid Start content = @Content( mediaType = "application/json", schema = @Schema(implementation = ErrorResponse.class)))}) - @GetMapping("/created") - public PageResult getCreatedInvestigations(OwnPageable pageable) { - log.info(API_LOG_START + "/created"); - return InvestigationResponseMapper.fromAsPageResult(investigationService.getCreated(OwnPageable.toPageable(pageable))); - } - - @Operation(operationId = "getReceivedInvestigations", - summary = "Gets received investigations", - tags = {"Investigations"}, - description = "The endpoint returns received investigations as paged result.", - security = @SecurityRequirement(name = "oAuth2", scopes = "profile email")) - @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Returns the paged result found for Asset", content = @Content( - mediaType = "application/json", - array = @ArraySchema(arraySchema = @Schema(description = "InvestigationData", implementation = InvestigationResponse.class), minItems = 0, maxItems = Integer.MAX_VALUE) - )), - @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 = "404", - description = "Not found.", - content = @Content( - mediaType = "application/json", - schema = @Schema(implementation = ErrorResponse.class))), - @ApiResponse( - responseCode = "415", - description = "Unsupported media type", - 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("/received") - public PageResult getReceivedInvestigations(OwnPageable pageable) { - log.info(API_LOG_START + "/received"); - return InvestigationResponseMapper.fromAsPageResult(investigationService.getReceived(OwnPageable.toPageable(pageable))); - } - @GetMapping("") public PageResult getInvestigations(OwnPageable pageable, SearchCriteriaRequestParam filter) { return InvestigationResponseMapper.fromAsPageResult(investigationService.getNotifications(OwnPageable.toPageable(pageable), filter.toSearchCriteria())); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/model/NotificationSideBaseEntity.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/model/NotificationSideBaseEntity.java index 6d4887a53b..b3ed03a796 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/model/NotificationSideBaseEntity.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/model/NotificationSideBaseEntity.java @@ -21,5 +21,5 @@ public enum NotificationSideBaseEntity { SENDER, - RECEIVER; + RECEIVER } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/InvestigationNotificationsSupport.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/InvestigationNotificationsSupport.java index caeee10166..fc3ac77a9e 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/InvestigationNotificationsSupport.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/InvestigationNotificationsSupport.java @@ -34,67 +34,117 @@ import static java.time.temporal.ChronoUnit.DAYS; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.not; @Component public class InvestigationNotificationsSupport { + private static final String OWN_BPN = "BPNL00000001OWN"; + private static final String OWN_BPN_COMPANY_NAME = "Car Company"; + private static final String OTHER_BPN = "BPNL00000002OTHER"; + private static final String OTHER_BPN_COMPANY_NAME = "Parts Company"; + @Autowired JpaInvestigationNotificationRepository jpaInvestigationNotificationRepository; public void defaultInvestigationsStored() { - Instant now = Instant.now(); - String testBpn = "BPNL00000003AXS3"; - String testBpn2 = "BPNL00000003AXS2"; + storeCreatedInvestigations(); + storeReceivedInvestigations(); + } + + public InvestigationNotificationEntity storedNotification(InvestigationNotificationEntity notification) { + return jpaInvestigationNotificationRepository.save(notification); + } + + public void storedNotifications(InvestigationNotificationEntity... notifications) { + Arrays.stream(notifications) + .forEach(this::storedNotification); + } + + + public void assertNotificationsSize(int size) { + List notifications = jpaInvestigationNotificationRepository.findAll(); + assertThat(notifications).hasSize(size); + } + + + private void storeCreatedInvestigations() { + Instant now = Instant.parse("2023-10-10T10:10:10.00Z"); InvestigationEntity investigation1 = InvestigationEntity.builder() .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.SENT) + .bpn(OWN_BPN) + .status(NotificationStatusBaseEntity.CREATED) .side(NotificationSideBaseEntity.SENDER) .description("1") - .createdDate(now.minusSeconds(10L)) + .createdDate(now.minus(3L, DAYS)) .build(); InvestigationEntity investigation2 = InvestigationEntity.builder() .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) + .bpn(OWN_BPN) + .status(NotificationStatusBaseEntity.SENT) .description("2") .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(21L)) + .createdDate(now.minus(2L, DAYS)) + .updated(now.minus(2L, DAYS)) .build(); InvestigationEntity investigation3 = InvestigationEntity.builder() .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CLOSED) + .bpn(OWN_BPN) + .status(NotificationStatusBaseEntity.RECEIVED) .description("3") .side(NotificationSideBaseEntity.SENDER) - .createdDate(now) + .createdDate(now.minus(1L, DAYS)) + .updated(now.minus(1L, DAYS)) .build(); InvestigationEntity investigation4 = InvestigationEntity.builder() .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) + .bpn(OWN_BPN) + .status(NotificationStatusBaseEntity.ACKNOWLEDGED) .description("4") .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(20L)) + .createdDate(now) + .updated(now) .build(); InvestigationEntity investigation5 = InvestigationEntity.builder() .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.ACKNOWLEDGED) + .bpn(OWN_BPN) + .status(NotificationStatusBaseEntity.ACCEPTED) + .acceptReason("Almighty demon king accepted this one") .description("5") .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.minus(2L, DAYS)) + .createdDate(now) + .updated(now) .build(); InvestigationEntity investigation6 = InvestigationEntity.builder() .assets(Collections.emptyList()) - .bpn(testBpn2) - .status(NotificationStatusBaseEntity.ACKNOWLEDGED) + .bpn(OWN_BPN) + .status(NotificationStatusBaseEntity.DECLINED) + .declineReason("Almighty demon king has declined this one") .description("6") - .side(NotificationSideBaseEntity.RECEIVER) - .createdDate(now.minus(2L, DAYS)) + .side(NotificationSideBaseEntity.SENDER) + .createdDate(now.plus(1L, DAYS)) + .updated(now.plus(1L, DAYS)) + .build(); + InvestigationEntity investigation7 = InvestigationEntity.builder() + .assets(Collections.emptyList()) + .bpn(OWN_BPN) + .status(NotificationStatusBaseEntity.CANCELED) + .description("7") + .side(NotificationSideBaseEntity.SENDER) + .createdDate(now.plus(2L, DAYS)) + .updated(now.plus(2L, DAYS)) + .build(); + InvestigationEntity investigation8 = InvestigationEntity.builder() + .assets(Collections.emptyList()) + .bpn(OWN_BPN) + .status(NotificationStatusBaseEntity.CLOSED) + .description("8") + .closeReason("Almighty demon king has closed that one") + .side(NotificationSideBaseEntity.SENDER) + .createdDate(now.plus(3L, DAYS)) + .updated(now.plus(3L, DAYS)) .build(); - storedNotifications( InvestigationNotificationEntity @@ -102,58 +152,199 @@ public void defaultInvestigationsStored() { .id("1") .investigation(investigation1) .status(NotificationStatusBaseEntity.CREATED) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a11") + .createdBy(OWN_BPN) + .createdByName(OWN_BPN_COMPANY_NAME) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a1") .build(), InvestigationNotificationEntity .builder() - .status(NotificationStatusBaseEntity.CREATED) + .createdBy(OWN_BPN) + .createdByName(OWN_BPN_COMPANY_NAME) + .status(NotificationStatusBaseEntity.SENT) .id("2") .investigation(investigation2) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a22") + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a2") .build(), InvestigationNotificationEntity .builder() - .status(NotificationStatusBaseEntity.CREATED) + .status(NotificationStatusBaseEntity.RECEIVED) .id("3") + .createdBy(OTHER_BPN) + .createdByName(OTHER_BPN_COMPANY_NAME) .investigation(investigation3) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a33") + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a3") .build(), InvestigationNotificationEntity .builder() - .status(NotificationStatusBaseEntity.CREATED) + .status(NotificationStatusBaseEntity.ACKNOWLEDGED) .id("4") + .createdBy(OTHER_BPN) + .createdByName(OTHER_BPN_COMPANY_NAME) .investigation(investigation4) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a44") + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a4") .build(), InvestigationNotificationEntity .builder() - .status(NotificationStatusBaseEntity.CREATED) + .status(NotificationStatusBaseEntity.ACCEPTED) .id("5") + .createdBy(OTHER_BPN) + .createdByName(OTHER_BPN_COMPANY_NAME) .investigation(investigation5) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a55") + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a5") .build(), InvestigationNotificationEntity .builder() - .status(NotificationStatusBaseEntity.ACKNOWLEDGED) + .status(NotificationStatusBaseEntity.DECLINED) .id("6") + .createdBy(OTHER_BPN) + .createdByName(OTHER_BPN_COMPANY_NAME) .investigation(investigation6) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a66") + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a6") + .build(), + InvestigationNotificationEntity + .builder() + .status(NotificationStatusBaseEntity.CANCELED) + .id("7") + .createdBy(OWN_BPN) + .createdByName(OWN_BPN_COMPANY_NAME) + .investigation(investigation7) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a7") + .build(), + InvestigationNotificationEntity + .builder() + .status(NotificationStatusBaseEntity.CLOSED) + .id("8") + .createdBy(OWN_BPN) + .createdByName(OWN_BPN_COMPANY_NAME) + .investigation(investigation8) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a8") .build() ); } - public InvestigationNotificationEntity storedNotification(InvestigationNotificationEntity notification) { - return jpaInvestigationNotificationRepository.save(notification); - } + private void storeReceivedInvestigations() { + Instant now = Instant.parse("2023-10-10T10:10:10.00Z"); + String otherBPN = "BPNL00000002OTHER"; - public void storedNotifications(InvestigationNotificationEntity... notifications) { - Arrays.stream(notifications) - .forEach(this::storedNotification); + InvestigationEntity investigation1 = InvestigationEntity.builder() + .assets(Collections.emptyList()) + .bpn(otherBPN) + .status(NotificationStatusBaseEntity.RECEIVED) + .side(NotificationSideBaseEntity.RECEIVER) + .description("11") + .createdDate(now.minusSeconds(5L)) + .build(); + InvestigationEntity investigation2 = InvestigationEntity.builder() + .assets(Collections.emptyList()) + .bpn(otherBPN) + .status(NotificationStatusBaseEntity.ACKNOWLEDGED) + .description("22") + .side(NotificationSideBaseEntity.RECEIVER) + .createdDate(now.plusSeconds(2L)) + .build(); + InvestigationEntity investigation3 = InvestigationEntity.builder() + .assets(Collections.emptyList()) + .bpn(otherBPN) + .status(NotificationStatusBaseEntity.ACCEPTED) + .description("33") + .side(NotificationSideBaseEntity.RECEIVER) + .createdDate(now) + .build(); + InvestigationEntity investigation4 = InvestigationEntity.builder() + .assets(Collections.emptyList()) + .bpn(otherBPN) + .status(NotificationStatusBaseEntity.DECLINED) + .description("44") + .side(NotificationSideBaseEntity.RECEIVER) + .createdDate(now.plusSeconds(20L)) + .build(); + InvestigationEntity investigation5 = InvestigationEntity.builder() + .assets(Collections.emptyList()) + .bpn(otherBPN) + .status(NotificationStatusBaseEntity.CANCELED) + .description("55") + .side(NotificationSideBaseEntity.RECEIVER) + .createdDate(now.plusSeconds(40L)) + .build(); + InvestigationEntity investigation6 = InvestigationEntity.builder() + .assets(Collections.emptyList()) + .bpn(otherBPN) + .status(NotificationStatusBaseEntity.CLOSED) + .description("55") + .side(NotificationSideBaseEntity.RECEIVER) + .createdDate(now.plusSeconds(40L)) + .build(); + + storedNotifications( + InvestigationNotificationEntity + .builder() + .id("11") + .investigation(investigation1) + .status(NotificationStatusBaseEntity.RECEIVED) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a11") + .build(), + InvestigationNotificationEntity + .builder() + .id("22") + .investigation(investigation2) + .status(NotificationStatusBaseEntity.ACKNOWLEDGED) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a22") + .build(), + InvestigationNotificationEntity + .builder() + .id("33") + .investigation(investigation3) + .status(NotificationStatusBaseEntity.ACCEPTED) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a33") + .build(), + InvestigationNotificationEntity + .builder() + .id("44") + .investigation(investigation4) + .status(NotificationStatusBaseEntity.DECLINED) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a44") + .build(), + InvestigationNotificationEntity + .builder() + .id("55") + .investigation(investigation5) + .status(NotificationStatusBaseEntity.CANCELED) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a55") + .build(), + InvestigationNotificationEntity + .builder() + .id("66") + .investigation(investigation6) + .status(NotificationStatusBaseEntity.CLOSED) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a66") + .build() + ); } + public InvestigationNotificationEntity storeInvestigationNotification() { + Instant now = Instant.parse("2023-10-10T10:10:10.00Z"); - public void assertNotificationsSize(int size) { - List notifications = jpaInvestigationNotificationRepository.findAll(); - assertThat(notifications).hasSize(size); + InvestigationEntity investigation = InvestigationEntity.builder() + .assets(Collections.emptyList()) + .bpn(OWN_BPN) + .status(NotificationStatusBaseEntity.SENT) + .description("2") + .side(NotificationSideBaseEntity.SENDER) + .createdDate(now.minus(2L, DAYS)) + .updated(now.minus(2L, DAYS)) + .build(); + InvestigationNotificationEntity notificationEntity = InvestigationNotificationEntity + .builder() + .status(NotificationStatusBaseEntity.SENT) + .id("1") + .createdBy(OWN_BPN) + .createdByName(OWN_BPN_COMPANY_NAME) + .sendTo(OTHER_BPN) + .sendToName(OTHER_BPN_COMPANY_NAME) + .investigation(investigation) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a1") + .build(); + storedNotifications(notificationEntity); + return jpaInvestigationNotificationRepository.findById(notificationEntity.getId()).get(); } } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/InvestigationsSupport.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/InvestigationsSupport.java index 3b1fe051f6..e1fb906b3c 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/InvestigationsSupport.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/InvestigationsSupport.java @@ -83,10 +83,6 @@ public void assertInvestigationStatus(QualityNotificationStatus investigationSta ); } - public void storedInvestigations(InvestigationEntity... investigations) { - jpaInvestigationRepository.saveAll(Arrays.asList(investigations)); - } - public Long storedInvestigation(InvestigationEntity investigation) { return jpaInvestigationRepository.save(investigation).getId(); } @@ -94,4 +90,8 @@ public Long storedInvestigation(InvestigationEntity investigation) { public InvestigationEntity storedInvestigationFullObject(InvestigationEntity investigation) { return jpaInvestigationRepository.save(investigation); } + + public List findAllInvestigations() { + return jpaInvestigationRepository.findAll(); + } } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/PublisherAlertsControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/PublisherAlertsControllerIT.java index f288e3cb21..2c2286b463 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/PublisherAlertsControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/PublisherAlertsControllerIT.java @@ -161,7 +161,8 @@ void shouldStartAlert() throws JsonProcessingException, JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts/created") + .param("filter", "side,EQUAL,SENDER,AND") + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -217,7 +218,7 @@ void shouldStartAlertForAsPlanned() throws JsonProcessingException, JoseExceptio .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts/created") + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -325,6 +326,7 @@ void givenWrongStatus_whenUpdateAlert_thenBadRequest() throws JsonProcessingExce @Test void shouldCancelAlert() throws JsonProcessingException, JoseException { // given + String filterString = "side,EQUAL,SENDER,AND"; assetsSupport.defaultAssetsStored(); val startAlertRequest = StartQualityNotificationRequest.builder() .partIds(List.of("urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca978")) @@ -350,7 +352,8 @@ void shouldCancelAlert() throws JsonProcessingException, JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts/created") + .param("filter", filterString) + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -373,7 +376,8 @@ void shouldCancelAlert() throws JsonProcessingException, JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts/created") + .param("filter", filterString) + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -428,7 +432,8 @@ void shouldApproveAlertStatus() throws JsonProcessingException, JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts/created") + .param("filter", "side,EQUAL,SENDER,AND") + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -440,6 +445,7 @@ void shouldApproveAlertStatus() throws JsonProcessingException, JoseException { @Test void shouldCloseAlertStatus() throws JsonProcessingException, JoseException { // given + String filterString = "side,EQUAL,SENDER,AND"; List partIds = List.of( "urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca978" // BPN: BPNL00000003AYRE ); @@ -485,7 +491,8 @@ void shouldCloseAlertStatus() throws JsonProcessingException, JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts/created") + .param("filter", filterString) + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -511,7 +518,8 @@ void shouldCloseAlertStatus() throws JsonProcessingException, JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts/created") + .param("filter", filterString) + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -549,6 +557,7 @@ void givenNoAuthorization_whenCancel_thenReturn401() { @Test void shouldBeCreatedBySender() throws JsonProcessingException, JoseException { // given + String filterString = "side,EQUAL,SENDER,AND"; List partIds = List.of( "urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca978", // BPN: BPNL00000003AYRE "urn:uuid:d387fa8e-603c-42bd-98c3-4d87fef8d2bb", // BPN: BPNL00000003AYRE @@ -590,7 +599,8 @@ void shouldBeCreatedBySender() throws JsonProcessingException, JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts/created") + .param("filter", filterString) + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/ReadAlertsControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/ReadAlertsControllerIT.java index 31761a6f56..23f6c5393c 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/ReadAlertsControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/ReadAlertsControllerIT.java @@ -92,7 +92,8 @@ void shouldReturnNoReceivedAlerts() throws JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts/received") + .param("filter", "side,EQUAL,RECEIVER,AND") + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -102,13 +103,18 @@ void shouldReturnNoReceivedAlerts() throws JoseException { @Test void shouldReturnNoCreatedAlerts() throws JoseException { + // given + String filterString = "side,EQUAL,SENDER,AND"; + + // when/then given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .param("page", "0") .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts/created") + .param("filter", filterString) + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -208,7 +214,8 @@ void givenAlerts_whenGetAlerts_thenReturnSortedByCreationTime() throws JoseExcep .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts/created") + .param("filter", "side,EQUAL,SENDER,AND") + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -221,6 +228,7 @@ void givenAlerts_whenGetAlerts_thenReturnSortedByCreationTime() throws JoseExcep void givenSortByCreatedDateProvided_whenGetAlerts_thenReturnAlertsProperlySorted() throws JoseException { // given String sortString = "createdDate,desc"; + String filterString = "side,EQUAL,SENDER,AND"; Instant now = Instant.now(); String testBpn = bpnSupport.testBpn(); @@ -310,7 +318,11 @@ void givenSortByCreatedDateProvided_whenGetAlerts_thenReturnAlertsProperlySorted .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts/created?page=0&size=10&sort=$sortString".replace("$sortString", sortString)) + .param("filter", filterString) + .param("page", 0) + .param("size", 10) + .param("sort", sortString) + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -325,6 +337,7 @@ void givenSortByDescriptionProvided_whenGetAlerts_thenReturnAlertsProperlySorted String sortString = "description,desc"; Instant now = Instant.now(); String testBpn = bpnSupport.testBpn(); + String filterString = "side,EQUAL,SENDER,AND"; AlertEntity firstAlert = AlertEntity.builder() .assets(Collections.emptyList()) @@ -412,7 +425,11 @@ void givenSortByDescriptionProvided_whenGetAlerts_thenReturnAlertsProperlySorted .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts/created?page=0&size=10&sort=$sortString".replace("$sortString", sortString)) + .param("filter", filterString) + .param("page", 0) + .param("size", 10) + .param("sort", sortString) + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -425,6 +442,7 @@ void givenSortByDescriptionProvided_whenGetAlerts_thenReturnAlertsProperlySorted @Test void givenSortByStatusProvided_whenGetAlerts_thenReturnAlertsProperlySorted() throws JoseException { // given + String filterString = "side,EQUAL,SENDER,AND"; String sortString = "status,asc"; Instant now = Instant.now(); String testBpn = bpnSupport.testBpn(); @@ -515,7 +533,11 @@ void givenSortByStatusProvided_whenGetAlerts_thenReturnAlertsProperlySorted() th .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts/created?page=0&size=10&sort=$sortString".replace("$sortString", sortString)) + .param("filter", filterString) + .param("page", 0) + .param("size", 10) + .param("sort", sortString) + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -529,6 +551,7 @@ void givenSortByStatusProvided_whenGetAlerts_thenReturnAlertsProperlySorted() th void givenInvalidSort_whenGetCreated_thenBadRequest() throws JoseException { // given String sortString = "createdDate,failure"; + String filterString = "side,EQUAL,SENDER,AND"; // when/then given() @@ -537,7 +560,11 @@ void givenInvalidSort_whenGetCreated_thenBadRequest() throws JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts/created?page=0&size=10&sort=$sortString".replace("$sortString", sortString)) + .param("filter", filterString) + .param("page", 0) + .param("size", 10) + .param("sort", sortString) + .get("/api/alerts") .then() .statusCode(400) .body("message", Matchers.is( @@ -548,6 +575,7 @@ void givenInvalidSort_whenGetCreated_thenBadRequest() throws JoseException { @Test void shouldReturnPagedCreatedAlerts() throws JoseException { // given + String filterString = "side,EQUAL,SENDER,AND"; Instant now = Instant.now(); String testBpn = bpnSupport.testBpn(); @@ -573,7 +601,8 @@ void shouldReturnPagedCreatedAlerts() throws JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts/created") + .param("filter", filterString) + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(2)) @@ -591,6 +620,7 @@ void shouldReturnProperlyPagedReceivedAlerts() throws JoseException { String senderName = "Sender name"; String receiverBPN = "BPN0002"; String receiverName = "Receiver name"; + String filterString = "side,EQUAL,RECEIVER,AND"; IntStream.range(101, 201) .forEach(number -> @@ -630,7 +660,8 @@ void shouldReturnProperlyPagedReceivedAlerts() throws JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts/received") + .param("filter", filterString) + .get("/api/alerts") .then() .statusCode(200) .body("content.createdBy", Matchers.hasItems(senderBPN)) @@ -736,7 +767,9 @@ void shouldReturnReceivedAlertsSortedByCreationTime() throws JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts/received?sort=$sortString".replace("$sortString", sortString)) + .param("filter", "side,EQUAL,RECEIVER,AND") + .param("sort", sortString) + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/ReceiverAlertsControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/ReceiverAlertsControllerIT.java index 18fccbcf74..1200a651de 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/ReceiverAlertsControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/ReceiverAlertsControllerIT.java @@ -47,6 +47,7 @@ class ReceiverAlertsControllerIT extends IntegrationTestSpecification { void ShouldAcknowledgeReceivedAlert() throws JoseException { // given var alertId = alertsSupport.defaultReceivedAlertStored(); + String filterString = "side,EQUAL,RECEIVER,AND"; // when given() @@ -71,7 +72,8 @@ void ShouldAcknowledgeReceivedAlert() throws JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/alerts/received") + .param("filter", filterString) + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -83,6 +85,7 @@ void ShouldAcknowledgeReceivedAlert() throws JoseException { void shouldNotUpdateToAcknowledgedNonExistingAlert() throws JoseException { // given final long notExistingAlertId = 1234L; + String filterString = "side,EQUAL,RECEIVER,AND"; // when given() @@ -105,7 +108,8 @@ void shouldNotUpdateToAcknowledgedNonExistingAlert() throws JoseException { .param("size", "15") .contentType(ContentType.JSON) .when() - .get("/api/alerts/received") + .param("filter", filterString) + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -117,6 +121,7 @@ void shouldNotUpdateToAcknowledgedNonExistingAlert() throws JoseException { void shouldNotUpdateToAcceptedNonExistingAlert() throws JoseException { // given final long notExistingAlertId = 1234L; + String filterString = "side,EQUAL,RECEIVER,AND"; // when given() @@ -140,7 +145,8 @@ void shouldNotUpdateToAcceptedNonExistingAlert() throws JoseException { .param("size", "15") .contentType(ContentType.JSON) .when() - .get("/api/alerts/received") + .param("filter", filterString) + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -152,6 +158,7 @@ void shouldNotUpdateToAcceptedNonExistingAlert() throws JoseException { void shouldNotUpdateToDeclinedNonExistingAlert() throws JoseException { // given final long notExistingAlertId = 1234L; + String filterString = "side,EQUAL,RECEIVER,AND"; // when given() @@ -175,7 +182,8 @@ void shouldNotUpdateToDeclinedNonExistingAlert() throws JoseException { .param("size", "15") .contentType(ContentType.JSON) .when() - .get("/api/alerts/received") + .param("filter", filterString) + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -188,6 +196,7 @@ void shouldNotUpdateToDeclinedNonExistingAlert() throws JoseException { void shouldNotUpdateWithInvalidRequest(final String request) throws JoseException { // given final long notExistingAlertId = 1234L; + String filterString = "side,EQUAL,SENDER,AND"; // when given() @@ -206,7 +215,8 @@ void shouldNotUpdateWithInvalidRequest(final String request) throws JoseExceptio .param("size", "15") .contentType(ContentType.JSON) .when() - .get("/api/alerts/received") + .param("filter", filterString) + .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/InvestigationControllerFilterIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/InvestigationControllerFilterIT.java index 861b222d74..cc44b3f698 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/InvestigationControllerFilterIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/InvestigationControllerFilterIT.java @@ -54,15 +54,15 @@ void givenInvestigations_whenProvideNoFilter_thenReturnAll() throws JoseExceptio .statusCode(200) .body("page", Matchers.is(0)) .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(6)) - .body("totalItems", Matchers.is(6)); + .body("totalItems", Matchers.is(14)) + .body("content", Matchers.hasSize(10)); } @Test void givenInvestigations_whenProvideBpnFilter_thenReturnExpectedResult() throws JoseException { // given InvestigationNotificationSupport.defaultInvestigationsStored(); - String filter = "?filter=bpn,STARTS_WITH,BPNL00000003AXS2,OR"; + String filter = "?filter=bpn,STARTS_WITH,BPNL00000002OTHER,OR"; // when/then given() @@ -76,15 +76,15 @@ void givenInvestigations_whenProvideBpnFilter_thenReturnExpectedResult() throws .statusCode(200) .body("page", Matchers.is(0)) .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(1)) - .body("totalItems", Matchers.is(1)); + .body("totalItems", Matchers.is(6)) + .body("content", Matchers.hasSize(6)); } @Test void givenInvestigations_whenProvideBpnFilterAnd_thenReturnExpectedResult() throws JoseException { // given InvestigationNotificationSupport.defaultInvestigationsStored(); - String filter = "?filter=bpn,STARTS_WITH,BPNL00000003AXS3,AND&filter=createdDate,AT_LOCAL_DATE," + LocalDate.now() + ",AND"; + String filter = "?filter=bpn,STARTS_WITH,BPNL00000001OWN,AND&filter=createdDate,AT_LOCAL_DATE,2023-10-10,AND"; // when/then given() @@ -98,7 +98,7 @@ void givenInvestigations_whenProvideBpnFilterAnd_thenReturnExpectedResult() thro .statusCode(200) .body("page", Matchers.is(0)) .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(4)) - .body("totalItems", Matchers.is(4)); + .body("totalItems", Matchers.is(2)) + .body("content", Matchers.hasSize(2)); } } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/PublisherInvestigationsControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/PublisherInvestigationsControllerIT.java index ac0dab8e81..59fc6d3163 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/PublisherInvestigationsControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/PublisherInvestigationsControllerIT.java @@ -155,7 +155,8 @@ void shouldStartInvestigation() throws JsonProcessingException, JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/investigations/created") + .param("filter", "side,EQUAL,SENDER,AND") + .get("/api/investigations") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -285,7 +286,8 @@ void shouldCancelInvestigation() throws JsonProcessingException, JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/investigations/created") + .param("filter", "side,EQUAL,SENDER,AND") + .get("/api/investigations") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -306,7 +308,8 @@ void shouldCancelInvestigation() throws JsonProcessingException, JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/investigations/created") + .param("filter", "side,EQUAL,SENDER,AND") + .get("/api/investigations") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -359,7 +362,8 @@ void shouldApproveInvestigationStatus() throws JsonProcessingException, JoseExce .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/investigations/created") + .param("filter", "side,EQUAL,SENDER,AND") + .get("/api/investigations") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -375,6 +379,7 @@ void shouldCloseInvestigationStatus() throws JsonProcessingException, JoseExcept "urn:uuid:fe99da3d-b0de-4e80-81da-882aebcca978" // BPN: BPNL00000003AYRE ); String description = "at least 15 characters long investigation description"; + String filterString = "side,EQUAL,SENDER,AND"; assetsSupport.defaultAssetsStored(); val startInvestigationRequest = StartQualityNotificationRequest.builder() @@ -413,7 +418,8 @@ void shouldCloseInvestigationStatus() throws JsonProcessingException, JoseExcept .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/investigations/created") + .param("filter", "side,EQUAL,SENDER,AND") + .get("/api/investigations") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -440,7 +446,8 @@ void shouldCloseInvestigationStatus() throws JsonProcessingException, JoseExcept .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/investigations/created") + .param("filter", filterString) + .get("/api/investigations") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -517,7 +524,8 @@ void shouldBeCreatedBySender() throws JsonProcessingException, JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/investigations/created") + .param("filter", "side,EQUAL,SENDER,AND") + .get("/api/investigations") .then() .statusCode(200) .body("page", Matchers.is(0)) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/ReadInvestigationsControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/ReadInvestigationsControllerIT.java index 21808809b7..ba64c2b96c 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/ReadInvestigationsControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/ReadInvestigationsControllerIT.java @@ -36,7 +36,6 @@ import java.time.Instant; import java.util.Collections; import java.util.List; -import java.util.UUID; import java.util.stream.IntStream; import static io.restassured.RestAssured.given; @@ -53,31 +52,19 @@ class ReadInvestigationsControllerIT extends IntegrationTestSpecification { InvestigationsSupport investigationsSupport; @Test - void shouldNotReturnCreatedInvestigationWithoutAuthentication() { - given() - .param("page", "0") - .param("size", "10") - .contentType(ContentType.JSON) - .when() - .get("/api/investigations/created") - .then() - .statusCode(401); - } - - @Test - void shouldNotReturnReceivedInvestigationWithoutAuthentication() { + void shouldNotReturnInvestigationWithoutAuthentication() { given() .param("page", "0") .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/investigations/received") + .get("/api/investigations") .then() .statusCode(401); } @Test - void shouldNotReturnInvestigationWithoutAuthentication() { + void shouldNotReturnInvestigationWithIdWithoutAuthentication() { given() .contentType(ContentType.JSON) .when() @@ -87,30 +74,15 @@ void shouldNotReturnInvestigationWithoutAuthentication() { } @Test - void shouldReturnNoReceivedInvestigations() throws JoseException { - given() - .header(oAuth2Support.jwtAuthorization(ADMIN)) - .param("page", "0") - .param("size", "10") - .contentType(ContentType.JSON) - .when() - .get("/api/investigations/received") - .then() - .statusCode(200) - .body("page", Matchers.is(0)) - .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(0)); - } - - @Test - void shouldReturnNoCreatedInvestigations() throws JoseException { + void shouldReturnNoInvestigations() throws JoseException { + // when/then given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .param("page", "0") .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/investigations/created") + .get("/api/investigations") .then() .statusCode(200) .body("page", Matchers.is(0)) @@ -119,89 +91,11 @@ void shouldReturnNoCreatedInvestigations() throws JoseException { } @Test - void givenInvestigations_whenGetInvestigations_thenReturnSortedByCreationTime() throws JoseException { + void givenInvestigations_whenGetSenderInvestigationsSortedAsc_thenReturnProperlySorted() throws JoseException { // given - Instant now = Instant.now(); - String testBpn = bpnSupport.testBpn(); - - InvestigationEntity firstInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .side(NotificationSideBaseEntity.SENDER) - .description("1") - .createdDate(now.minusSeconds(10L)) - .build(); - InvestigationEntity secondInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("2") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(21L)) - .build(); - InvestigationEntity thirdInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("3") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now) - .build(); - InvestigationEntity fourthInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("4") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(20L)) - .build(); - InvestigationEntity fifthInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("5") - .side(NotificationSideBaseEntity.RECEIVER) - .createdDate(now.plusSeconds(40L)) - .build(); - - investigationNotificationsSupport.storedNotifications( - InvestigationNotificationEntity - .builder() - .id("1") - .investigation(firstInvestigation) - .status(NotificationStatusBaseEntity.CREATED) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - InvestigationNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("2") - .investigation(secondInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - InvestigationNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("3") - .investigation(thirdInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - InvestigationNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("4") - .investigation(fourthInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - InvestigationNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("5") - .investigation(fifthInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build() - ); + String filterString = "side,EQUAL,SENDER,AND"; + String sortString = "createdDate,ASC"; + investigationNotificationsSupport.defaultInvestigationsStored(); // then given() @@ -210,322 +104,95 @@ void givenInvestigations_whenGetInvestigations_thenReturnSortedByCreationTime() .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/investigations/created") + .param("filter", filterString) + .param("sort", sortString) + .get("/api/investigations") .then() .statusCode(200) .body("page", Matchers.is(0)) .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(4)) - .body("totalItems", Matchers.is(4)); + .body("totalItems", Matchers.is(8)) + .body("content", Matchers.hasSize(8)) + .body("content.description", Matchers.containsInRelativeOrder("1", "2", "3", "4", "5", "6", "7", "8")); } @Test - void givenSortByCreatedDateProvided_whenGetInvestigations_thenReturnInvestigationsProperlySorted() throws JoseException { + void givenInvestigations_whenGetSenderInvestigationsSortedDesc_thenReturnProperlySorted() throws JoseException { // given - String sortString = "createdDate,desc"; - Instant now = Instant.now(); - String testBpn = bpnSupport.testBpn(); - - InvestigationEntity firstInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .side(NotificationSideBaseEntity.SENDER) - .description("1") - .createdDate(now.minusSeconds(10L)) - .build(); - InvestigationEntity secondInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("2") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(21L)) - .build(); - InvestigationEntity thirdInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("3") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now) - .build(); - InvestigationEntity fourthInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("4") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(20L)) - .build(); - InvestigationEntity fifthInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("5") - .side(NotificationSideBaseEntity.RECEIVER) - .createdDate(now.plusSeconds(40L)) - .build(); - - investigationNotificationsSupport.storedNotifications( - InvestigationNotificationEntity - .builder() - .id("1") - .investigation(firstInvestigation) - .status(NotificationStatusBaseEntity.CREATED) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - InvestigationNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("2") - .investigation(secondInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - InvestigationNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("3") - .investigation(thirdInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - InvestigationNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("4") - .investigation(fourthInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - InvestigationNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("5") - .investigation(fifthInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build() - ); + String filterString = "side,EQUAL,SENDER,AND"; + String sortString = "createdDate,DESC"; + investigationNotificationsSupport.defaultInvestigationsStored(); - // when/then + // then given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .param("page", "0") .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/investigations/created?page=0&size=10&sort=$sortString".replace("$sortString", sortString)) + .param("filter", filterString) + .param("sort", sortString) + .get("/api/investigations") .then() .statusCode(200) .body("page", Matchers.is(0)) .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(4)) - .body("totalItems", Matchers.is(4)); + .body("totalItems", Matchers.is(8)) + .body("content", Matchers.hasSize(8)) + .body("content.description", Matchers.containsInRelativeOrder("8", "7", "6", "5", "4", "3", "2", "1")); } @Test void givenSortByDescriptionProvided_whenGetInvestigations_thenReturnInvestigationsProperlySorted() throws JoseException { // given - String sortString = "description,desc"; - Instant now = Instant.now(); - String testBpn = bpnSupport.testBpn(); - - InvestigationEntity firstInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.SENT) - .side(NotificationSideBaseEntity.SENDER) - .description("1") - .createdDate(now.minusSeconds(10L)) - .build(); - InvestigationEntity secondInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("2") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(21L)) - .build(); - InvestigationEntity thirdInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CLOSED) - .description("3") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now) - .build(); - InvestigationEntity fourthInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("4") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(20L)) - .build(); - InvestigationEntity fifthInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.ACKNOWLEDGED) - .description("5") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(40L)) - .build(); - - - investigationNotificationsSupport.storedNotifications( - InvestigationNotificationEntity - .builder() - .id("1") - .investigation(firstInvestigation) - .status(NotificationStatusBaseEntity.CREATED) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - InvestigationNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("2") - .investigation(secondInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - InvestigationNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("3") - .investigation(thirdInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - InvestigationNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("4") - .investigation(fourthInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - InvestigationNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("5") - .investigation(fifthInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build() - ); + String filterString = "side,EQUAL,SENDER,AND"; + String sortString = "description,ASC"; + investigationNotificationsSupport.defaultInvestigationsStored(); + // then given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .param("page", "0") .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/investigations/created?page=0&size=10&sort=$sortString".replace("$sortString", sortString)) + .param("filter", filterString) + .param("sort", sortString) + .get("/api/investigations") .then() .statusCode(200) .body("page", Matchers.is(0)) .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(5)) - .body("totalItems", Matchers.is(5)) - .body("content.description", Matchers.containsInRelativeOrder("5", "4", "3", "2", "1")); + .body("totalItems", Matchers.is(8)) + .body("content", Matchers.hasSize(8)) + .body("content.description", Matchers.containsInRelativeOrder("1", "2", "3", "4", "5", "6", "7", "8")); } @Test void givenSortByStatusProvided_whenGetInvestigations_thenReturnInvestigationsProperlySorted() throws JoseException { // given - String sortString = "status,asc"; - Instant now = Instant.now(); - String testBpn = bpnSupport.testBpn(); - - InvestigationEntity firstInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.SENT) - .side(NotificationSideBaseEntity.SENDER) - .description("1") - .createdDate(now.minusSeconds(10L)) - .build(); - InvestigationEntity secondInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("2") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(21L)) - .build(); - InvestigationEntity thirdInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CLOSED) - .description("3") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now) - .build(); - InvestigationEntity fourthInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("4") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(20L)) - .build(); - InvestigationEntity fifthInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.ACKNOWLEDGED) - .description("5") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(40L)) - .build(); - - - investigationNotificationsSupport.storedNotifications( - InvestigationNotificationEntity - .builder() - .id("1") - .investigation(firstInvestigation) - .status(NotificationStatusBaseEntity.CREATED) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - InvestigationNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("2") - .investigation(secondInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - InvestigationNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("3") - .investigation(thirdInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - InvestigationNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("4") - .investigation(fourthInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - InvestigationNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("5") - .investigation(fifthInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build() - ); + String filterString = "side,EQUAL,SENDER,AND"; + String sortString = "status,ASC"; + investigationNotificationsSupport.defaultInvestigationsStored(); + // then given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .param("page", "0") .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/investigations/created?page=0&size=10&sort=$sortString".replace("$sortString", sortString)) + .param("filter", filterString) + .param("sort", sortString) + .get("/api/investigations") .then() .statusCode(200) .body("page", Matchers.is(0)) .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(5)) - .body("totalItems", Matchers.is(5)) - .body("content.status", Matchers.containsInRelativeOrder("ACKNOWLEDGED", "CLOSED", "CREATED", "CREATED", "SENT")); + .body("totalItems", Matchers.is(8)) + .body("content", Matchers.hasSize(8)) + .body("content.status", Matchers.containsInRelativeOrder("ACCEPTED", "ACKNOWLEDGED", "CANCELED", "CLOSED", "CREATED", "DECLINED", "RECEIVED", "SENT")); } @Test @@ -540,7 +207,10 @@ void givenInvalidSort_whenGetCreated_thenBadRequest() throws JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/investigations/created?page=0&size=10&sort=$sortString".replace("$sortString", sortString)) + .param("page", 0) + .param("size", 10) + .param("sort", sortString) + .get("/api/investigations") .then() .statusCode(400) .body("message", Matchers.is( @@ -549,7 +219,7 @@ void givenInvalidSort_whenGetCreated_thenBadRequest() throws JoseException { } @Test - void shouldReturnPagedCreatedInvestigations() throws JoseException { + void shouldReturnPagedInvestigations() throws JoseException { // given Instant now = Instant.now(); String testBpn = bpnSupport.testBpn(); @@ -576,7 +246,7 @@ void shouldReturnPagedCreatedInvestigations() throws JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/investigations/created") + .get("/api/investigations") .then() .statusCode(200) .body("page", Matchers.is(2)) @@ -586,172 +256,7 @@ void shouldReturnPagedCreatedInvestigations() throws JoseException { } @Test - void shouldReturnProperlyPagedReceivedInvestigations() throws JoseException { - // given - Instant now = Instant.now(); - String testBpn = bpnSupport.testBpn(); - String senderBPN = "BPN0001"; - String senderName = "Sender name"; - String receiverBPN = "BPN0002"; - String receiverName = "Receiver name"; - - IntStream.range(101, 201) - .forEach(number -> - { - InvestigationEntity investigationEntity = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .side(NotificationSideBaseEntity.RECEIVER) - .createdDate(now) - .build(); - - InvestigationEntity investigation = investigationsSupport.storedInvestigationFullObject(investigationEntity); - - InvestigationNotificationEntity notificationEntity = InvestigationNotificationEntity - .builder() - .id(UUID.randomUUID().toString()) - .investigation(investigation) - .createdBy(senderBPN) - .status(NotificationStatusBaseEntity.CREATED) - .createdByName(senderName) - .sendTo(receiverBPN) - .sendToName(receiverName) - .messageId("messageId") - .build(); - - InvestigationNotificationEntity persistedNotification = investigationNotificationsSupport.storedNotification(notificationEntity); - persistedNotification.setInvestigation(investigation); - investigationNotificationsSupport.storedNotification(persistedNotification); - } - ); - - // when/then - given() - .header(oAuth2Support.jwtAuthorization(ADMIN)) - .param("page", "2") - .param("size", "10") - .contentType(ContentType.JSON) - .when() - .get("/api/investigations/received") - .then() - .statusCode(200) - .body("content.createdBy", Matchers.hasItems(senderBPN)) - .body("content.createdByName", Matchers.hasItems(senderName)) - .body("content.sendTo", Matchers.hasItems(receiverBPN)) - .body("content.sendToName", Matchers.hasItems(receiverName)) - .body("page", Matchers.is(2)) - .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(10)) - .body("totalItems", Matchers.is(100)); - } - - @Test - void shouldReturnReceivedInvestigationsSortedByCreationTime() throws JoseException { - // given - String sortString = "createdDate,desc"; - Instant now = Instant.now(); - String testBpn = bpnSupport.testBpn(); - - InvestigationEntity firstInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.RECEIVED) - .side(NotificationSideBaseEntity.RECEIVER) - .description("1") - .createdDate(now.minusSeconds(5L)) - .build(); - InvestigationEntity secondInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.RECEIVED) - .description("2") - .side(NotificationSideBaseEntity.RECEIVER) - .createdDate(now.plusSeconds(2L)) - .build(); - InvestigationEntity thirdInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.RECEIVED) - .description("3") - .side(NotificationSideBaseEntity.RECEIVER) - .createdDate(now) - .build(); - InvestigationEntity fourthInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.RECEIVED) - .description("4") - .side(NotificationSideBaseEntity.RECEIVER) - .createdDate(now.plusSeconds(20L)) - .build(); - InvestigationEntity fifthInvestigation = InvestigationEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("5") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(40L)) - .build(); - - investigationNotificationsSupport.storedNotifications( - InvestigationNotificationEntity - .builder() - .id("1") - .investigation(firstInvestigation) - .status(NotificationStatusBaseEntity.CREATED) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - InvestigationNotificationEntity - .builder() - .id("2") - .investigation(secondInvestigation) - .status(NotificationStatusBaseEntity.CREATED) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - InvestigationNotificationEntity - .builder() - .id("3") - .investigation(thirdInvestigation) - .status(NotificationStatusBaseEntity.CREATED) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - InvestigationNotificationEntity - .builder() - .id("4") - .investigation(fourthInvestigation) - .status(NotificationStatusBaseEntity.CREATED) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - InvestigationNotificationEntity - .builder() - .id("5") - .investigation(fifthInvestigation) - .status(NotificationStatusBaseEntity.CREATED) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build() - ); - - // then - given() - .header(oAuth2Support.jwtAuthorization(ADMIN)) - .param("page", "0") - .param("size", "10") - .contentType(ContentType.JSON) - .when() - .get("/api/investigations/received?sort=$sortString".replace("$sortString", sortString)) - .then() - .statusCode(200) - .body("page", Matchers.is(0)) - .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(4)) - .body("totalItems", Matchers.is(4)) - .body("content.description", Matchers.containsInRelativeOrder("4", "2", "3", "1")) - .body("content.createdDate", Matchers.hasItems(isIso8601DateTime())); - } - - @Test - void givenNoInvestigationId_whenGetInvestigationById_thenReturnNotFound() throws JoseException { + void givenNonExistingInvestigation_whenGetInvestigationById_thenReturnNotFound() throws JoseException { given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) @@ -765,57 +270,25 @@ void givenNoInvestigationId_whenGetInvestigationById_thenReturnNotFound() throws @Test void shouldReturnInvestigationById() throws JoseException { // given - String testBpn = bpnSupport.testBpn(); - String senderBPN = "BPN0001"; - String senderName = "Sender name"; - String receiverBPN = "BPN0002"; - String receiverName = "Receiver name"; - - InvestigationEntity investigationEntity = - InvestigationEntity - .builder() - .id(1L) - .assets(List.of()) - .bpn(testBpn) - .description("1") - .status(NotificationStatusBaseEntity.RECEIVED) - .side(NotificationSideBaseEntity.SENDER) - .createdDate(Instant.now()) - .build(); - - InvestigationEntity persistedInvestigation = investigationsSupport.storedInvestigationFullObject(investigationEntity); - - InvestigationNotificationEntity notificationEntity = investigationNotificationsSupport.storedNotification( - InvestigationNotificationEntity - .builder() - .id("1") - .investigation(persistedInvestigation) - .createdBy(senderBPN) - .createdByName(senderName) - .sendTo(receiverBPN) - .status(NotificationStatusBaseEntity.CREATED) - .sendToName(receiverName) - .build()); - notificationEntity.setInvestigation(persistedInvestigation); - investigationNotificationsSupport.storedNotification(notificationEntity); - Long investigationId = persistedInvestigation.getId(); + InvestigationNotificationEntity storedInvestigationNotification = investigationNotificationsSupport.storeInvestigationNotification(); + InvestigationEntity storedInvestigation = storedInvestigationNotification.getInvestigation(); // when/then given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) .when() - .get("/api/investigations/{investigationId}", investigationId) + .get("/api/investigations/{investigationId}", storedInvestigation.getId()) .then() .statusCode(200) - .body("id", Matchers.is(investigationId.intValue())) - .body("status", Matchers.is("RECEIVED")) - .body("description", Matchers.is("1")) + .body("id", Matchers.is(storedInvestigation.getId().intValue())) + .body("status", Matchers.is(storedInvestigation.getStatus().name())) + .body("description", Matchers.is(storedInvestigation.getDescription())) .body("assetIds", Matchers.empty()) - .body("createdBy", Matchers.is(senderBPN)) - .body("createdByName", Matchers.is(senderName)) - .body("sendTo", Matchers.is(receiverBPN)) - .body("sendToName", Matchers.is(receiverName)) + .body("createdBy", Matchers.is(storedInvestigationNotification.getCreatedBy())) + .body("createdByName", Matchers.is(storedInvestigationNotification.getCreatedByName())) + .body("sendTo", Matchers.is(storedInvestigationNotification.getSendTo())) + .body("sendToName", Matchers.is(storedInvestigationNotification.getSendToName())) .body("createdDate", isIso8601DateTime()); } } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/ReceiverInvestigationsControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/ReceiverInvestigationsControllerIT.java index 0cc19a3436..cf461e80ef 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/ReceiverInvestigationsControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/ReceiverInvestigationsControllerIT.java @@ -70,12 +70,13 @@ void ShouldAcknowledgeReceivedInvestigation() throws JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .get("/api/investigations/received") + .get("/api/investigations") .then() .statusCode(200) .body("page", Matchers.is(0)) .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(1)); + .body("content", Matchers.hasSize(1)) + .body("content.status", Matchers.containsInRelativeOrder("RECEIVED")); } @Test @@ -83,7 +84,7 @@ void shouldNotUpdateToAcknowledgedNonExistingInvestigation() throws JoseExceptio // given final long notExistingInvestigationId = 1234L; - // when + // when/then given() .contentType(ContentType.JSON) .body(""" @@ -96,20 +97,6 @@ void shouldNotUpdateToAcknowledgedNonExistingInvestigation() throws JoseExceptio .post("/api/investigations/{notExistingInvestigationId}/update", notExistingInvestigationId) .then() .statusCode(404); - - // then - given() - .header(oAuth2Support.jwtAuthorization(ADMIN)) - .param("page", "0") - .param("size", "15") - .contentType(ContentType.JSON) - .when() - .get("/api/investigations/received") - .then() - .statusCode(200) - .body("page", Matchers.is(0)) - .body("pageSize", Matchers.is(15)) - .body("content", Matchers.hasSize(0)); } @Test @@ -131,20 +118,6 @@ void shouldNotUpdateToAcceptedNonExistingInvestigation() throws JoseException { .post("/api/investigations/{notExistingInvestigationId}/update", notExistingInvestigationId) .then() .statusCode(404); - - // then - given() - .header(oAuth2Support.jwtAuthorization(ADMIN)) - .param("page", "0") - .param("size", "15") - .contentType(ContentType.JSON) - .when() - .get("/api/investigations/received") - .then() - .statusCode(200) - .body("page", Matchers.is(0)) - .body("pageSize", Matchers.is(15)) - .body("content", Matchers.hasSize(0)); } @Test @@ -166,20 +139,6 @@ void shouldNotUpdateToDeclinedNonExistingInvestigation() throws JoseException { .post("/api/investigations/{notExistingInvestigationId}/update", notExistingInvestigationId) .then() .statusCode(404); - - // then - given() - .header(oAuth2Support.jwtAuthorization(ADMIN)) - .param("page", "0") - .param("size", "15") - .contentType(ContentType.JSON) - .when() - .get("/api/investigations/received") - .then() - .statusCode(200) - .body("page", Matchers.is(0)) - .body("pageSize", Matchers.is(15)) - .body("content", Matchers.hasSize(0)); } @ParameterizedTest @@ -197,20 +156,6 @@ void shouldNotUpdateWithInvalidRequest(final String request) throws JoseExceptio .post("/api/investigations/{notExistingInvestigationId}/update", Long.toString(notExistingInvestigationId)) .then() .statusCode(400); - - // then - given() - .header(oAuth2Support.jwtAuthorization(ADMIN)) - .param("page", "0") - .param("size", "15") - .contentType(ContentType.JSON) - .when() - .get("/api/investigations/received") - .then() - .statusCode(200) - .body("page", Matchers.is(0)) - .body("pageSize", Matchers.is(15)) - .body("content", Matchers.hasSize(0)); } From 02f0137ea31a452f0c57f826f2848ff970babc15 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Fri, 20 Oct 2023 23:39:37 +0200 Subject: [PATCH 05/27] chore: TRACEFOSS-2725 regenerate api --- .../openapi/traceability-foss-backend.json | 6106 ++++++++++++++++- 1 file changed, 6105 insertions(+), 1 deletion(-) diff --git a/tx-backend/openapi/traceability-foss-backend.json b/tx-backend/openapi/traceability-foss-backend.json index c29d6220ce..a0e76dea8d 100644 --- a/tx-backend/openapi/traceability-foss-backend.json +++ b/tx-backend/openapi/traceability-foss-backend.json @@ -1 +1,6105 @@ -{"openapi":"3.0.1","info":{"title":"Trace-FOSS - OpenAPI Documentation","description":"Trace-FOSS is a system for tracking parts along the supply chain. A high level of transparency across the supplier network enables faster intervention based on a recorded event in the supply chain. This saves costs by seamlessly tracking parts and creates trust through clearly defined and secure data access by the companies and persons involved in the process.","license":{"name":"License: Apache 2.0"},"version":"1.0.0"},"servers":[{"url":"http://localhost:9998/api","description":"Generated server url"}],"security":[{"oAuth2":["profile email"]}],"tags":[{"name":"ShellDescriptorController","description":"Shell Descriptor Controller"},{"name":"Investigations","description":"Operations on Investigation Notification"}],"paths":{"/bpn-config":{"get":{"tags":["BpnEdcMapping"],"summary":"Get BPN EDC URL mappings","description":"The endpoint returns a result of BPN EDC URL mappings.","operationId":"getBpnEdcs","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}}},"security":[{"oAuth2":["profile email"]}]},"put":{"tags":["BpnEdcMapping"],"summary":"Updates BPN EDC URL mappings","description":"The endpoint updates BPN EDC URL mappings","operationId":"updateBpnEdcMappings","requestBody":{"content":{"application/json":{"schema":{"maxItems":1000,"minItems":0,"type":"array","items":{"$ref":"#/components/schemas/BpnMappingRequest"}}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found for BpnEdcMapping","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]},"post":{"tags":["BpnEdcMapping"],"summary":"Creates BPN EDC URL mappings","description":"The endpoint creates BPN EDC URL mappings","operationId":"createBpnEdcUrlMappings","requestBody":{"content":{"application/json":{"schema":{"maxItems":1000,"minItems":0,"type":"array","items":{"$ref":"#/components/schemas/BpnMappingRequest"}}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found for BpnEdcMapping","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/submodel/data/{submodelId}":{"get":{"tags":["Submodel"],"summary":"Gets Submodel by its id","description":"The endpoint returns Submodel for given id. Used for data providing functionality","operationId":"getSubmodelById","parameters":[{"name":"submodelId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found","content":{"application/json":{}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]},"post":{"tags":["Submodel"],"summary":"Save Submodel","description":"This endpoint allows you to save a Submodel identified by its ID.","operationId":"saveSubmodel","parameters":[{"name":"submodelId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"string"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No Content."}},"security":[{"oAuth2":["profile email"]}]}},"/investigations":{"post":{"tags":["Investigations"],"summary":"Start investigations by part ids","description":"The endpoint starts investigations based on part ids provided.","operationId":"investigateAssets","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartQualityNotificationRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"201":{"description":"Created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QualityNotificationIdResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations/{investigationId}/update":{"post":{"tags":["Investigations"],"summary":"Update investigations by id","description":"The endpoint updates investigations by their id.","operationId":"updateInvestigation","parameters":[{"name":"investigationId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateQualityNotificationRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No content."},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations/{investigationId}/close":{"post":{"tags":["Investigations"],"summary":"Close investigations by id","description":"The endpoint closes investigations by their id.","operationId":"closeInvestigation","parameters":[{"name":"investigationId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloseQualityNotificationRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No content."},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations/{investigationId}/cancel":{"post":{"tags":["Investigations"],"summary":"Cancles investigations by id","description":"The endpoint cancles investigations by their id.","operationId":"cancelInvestigation","parameters":[{"name":"investigationId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No content."},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations/{investigationId}/approve":{"post":{"tags":["Investigations"],"summary":"Approves investigations by id","description":"The endpoint approves investigations by their id.","operationId":"approveInvestigation","parameters":[{"name":"investigationId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No content."},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/edc/notification/contract":{"post":{"tags":["Notifications"],"summary":"Triggers EDC notification contract","description":"The endpoint Triggers EDC notification contract based on notification type and method","operationId":"createNotificationContract","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateNotificationContractRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"201":{"description":"Created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateNotificationContractResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-planned/sync":{"post":{"tags":["AssetsAsPlanned"],"summary":"Synchronizes assets from IRS","description":"The endpoint synchronizes the assets from irs.","operationId":"sync","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyncAssetsRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"201":{"description":"Created."}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-planned/detail-information":{"post":{"tags":["AssetsAsPlanned"],"summary":"Searches for assets by ids.","description":"The endpoint searchs for assets by id and returns a list of them.","operationId":"getDetailInformation","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetDetailInformationRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found for Asset","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built/sync":{"post":{"tags":["AssetsAsBuilt"],"summary":"Synchronizes assets from IRS","description":"The endpoint synchronizes the assets from irs.","operationId":"sync_1","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyncAssetsRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"201":{"description":"Created."}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built/detail-information":{"post":{"tags":["AssetsAsBuilt"],"summary":"Searches for assets by ids.","description":"The endpoint searchs for assets by id and returns a list of them.","operationId":"getDetailInformation_1","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetDetailInformationRequest"}}},"required":true},"responses":{"200":{"description":"Returns the paged result found for Asset","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts":{"post":{"tags":["Alerts"],"summary":"Start alert by part ids","description":"The endpoint starts alert based on part ids provided.","operationId":"alertAssets","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartQualityNotificationRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"201":{"description":"Created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QualityNotificationIdResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts/{alertId}/update":{"post":{"tags":["Alerts"],"summary":"Update alert by id","description":"The endpoint updates alert by their id.","operationId":"updateAlert","parameters":[{"name":"alertId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateQualityNotificationRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No content."},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts/{alertId}/close":{"post":{"tags":["Alerts"],"summary":"Close alert by id","description":"The endpoint closes alert by id.","operationId":"closeAlert","parameters":[{"name":"alertId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloseQualityNotificationRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No content."},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts/{alertId}/cancel":{"post":{"tags":["Alerts"],"summary":"Cancels alert by id","description":"The endpoint cancels alert by id.","operationId":"cancelAlert","parameters":[{"name":"alertId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No content."},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts/{alertId}/approve":{"post":{"tags":["Alerts"],"summary":"Approves alert by id","description":"The endpoint approves alert by id.","operationId":"approveAlert","parameters":[{"name":"alertId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No content."},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-planned/{assetId}":{"get":{"tags":["AssetsAsPlanned"],"summary":"Get asset by id","description":"The endpoint returns an asset filtered by id .","operationId":"assetById","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the assets found","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"qualityAlertsInStatusActive":{"type":"integer","format":"int32"},"qualityInvestigationsInStatusActive":{"type":"integer","format":"int32"}}}}}}}},"security":[{"oAuth2":["profile email"]}]},"patch":{"tags":["AssetsAsPlanned"],"summary":"Updates asset","description":"The endpoint updates asset by provided quality type.","operationId":"updateAsset","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAssetRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the updated asset","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"qualityAlertsInStatusActive":{"type":"integer","format":"int32"},"qualityInvestigationsInStatusActive":{"type":"integer","format":"int32"}}}}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built/{assetId}":{"get":{"tags":["AssetsAsBuilt"],"summary":"Get asset by id","description":"The endpoint returns an asset filtered by id .","operationId":"assetById_1","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the assets found","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"qualityAlertsInStatusActive":{"type":"integer","format":"int32"},"qualityInvestigationsInStatusActive":{"type":"integer","format":"int32"}}}}}}}},"security":[{"oAuth2":["profile email"]}]},"patch":{"tags":["AssetsAsBuilt"],"summary":"Updates asset","description":"The endpoint updates asset by provided quality type.","operationId":"updateAsset_1","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAssetRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the updated asset","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"qualityAlertsInStatusActive":{"type":"integer","format":"int32"},"qualityInvestigationsInStatusActive":{"type":"integer","format":"int32"}}}}}}}},"security":[{"oAuth2":["profile email"]}]}},"/shelldescriptors":{"get":{"tags":["ShellDescriptorController"],"summary":"FindAll shell descriptors","description":"The endpoint returns all shell descriptors.","operationId":"findAll","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"ShellDescriptors found.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ShellDescriptorResponse"}}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]},"delete":{"tags":["Registry","ShellDescriptorController"],"summary":"Triggers deleteAll of shell descriptors list","description":"The endpoint deletes all shell descriptors.","operationId":"deleteAll","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"Deleted."},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/registry/reload":{"get":{"tags":["Registry"],"summary":"Triggers reload of shell descriptors","description":"The endpoint Triggers reload of shell descriptors.","operationId":"reload","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"202":{"description":"Created registry reload job."},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations/{investigationId}":{"get":{"tags":["Investigations"],"summary":"Gets investigations by id","description":"The endpoint returns investigations as paged result by their id.","operationId":"getInvestigation","parameters":[{"name":"investigationId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"OK.","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":-2147483648,"type":"array","description":"Investigations","items":{"$ref":"#/components/schemas/InvestigationResponse"}}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations/received":{"get":{"tags":["Investigations"],"summary":"Gets received investigations","description":"The endpoint returns received investigations as paged result.","operationId":"getReceivedInvestigations","parameters":[{"name":"pageable","in":"query","required":true,"schema":{"$ref":"#/components/schemas/OwnPageable"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found for Asset","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations/created":{"get":{"tags":["Investigations"],"summary":"Gets created investigations","description":"The endpoint returns created investigations as paged result.","operationId":"getCreatedInvestigations","parameters":[{"name":"pageable","in":"query","required":true,"schema":{"$ref":"#/components/schemas/OwnPageable"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found for Asset","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/dashboard":{"get":{"tags":["Dashboard"],"summary":"Returns dashboard related data","description":"The endpoint can return limited data based on the user role","operationId":"dashboard","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns dashboard data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-planned":{"get":{"tags":["AssetsAsPlanned"],"summary":"Get assets by pagination","description":"The endpoint returns a paged result of assets.","operationId":"AssetsAsPlanned","parameters":[{"name":"pageable","in":"query","required":true,"schema":{"$ref":"#/components/schemas/OwnPageable"}},{"name":"filter","in":"query","required":true,"schema":{"$ref":"#/components/schemas/SearchCriteriaRequestParam"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found for Asset","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array","items":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"qualityAlertsInStatusActive":{"type":"integer","format":"int32"},"qualityInvestigationsInStatusActive":{"type":"integer","format":"int32"}}}}}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-planned/{assetId}/children/{childId}":{"get":{"tags":["AssetsAsPlanned"],"summary":"Get asset by child id","description":"The endpoint returns an asset filtered by child id.","operationId":"assetByChildId","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}},{"name":"childId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","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 asset by childId","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"qualityAlertsInStatusActive":{"type":"integer","format":"int32"},"qualityInvestigationsInStatusActive":{"type":"integer","format":"int32"}}}}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-planned/distinctFilterValues":{"get":{"tags":["Assets","AssetsAsPlanned"],"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":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","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"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built":{"get":{"tags":["AssetsAsBuilt"],"summary":"Get assets by pagination","description":"The endpoint returns a paged result of assets.","operationId":"assets","parameters":[{"name":"pageable","in":"query","required":true,"schema":{"$ref":"#/components/schemas/OwnPageable"}},{"name":"searchCriteriaRequestParam","in":"query","required":true,"schema":{"$ref":"#/components/schemas/SearchCriteriaRequestParam"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found for Asset","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array","items":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"qualityAlertsInStatusActive":{"type":"integer","format":"int32"},"qualityInvestigationsInStatusActive":{"type":"integer","format":"int32"}}}}}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built/{assetId}/children/{childId}":{"get":{"tags":["AssetsAsBuilt"],"summary":"Get asset by child id","description":"The endpoint returns an asset filtered by child id.","operationId":"assetByChildId_1","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}},{"name":"childId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the asset by childId","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"qualityAlertsInStatusActive":{"type":"integer","format":"int32"},"qualityInvestigationsInStatusActive":{"type":"integer","format":"int32"}}}}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built/distinctFilterValues":{"get":{"tags":["AssetsAsBuilt","Assets"],"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":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","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"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built/countries":{"get":{"tags":["AssetsAsBuilt"],"summary":"Get map of assets","description":"The endpoint returns a map for assets consumed by the map.","operationId":"assetsCountryMap","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","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":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"integer","format":"int64"}}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts/{alertId}":{"get":{"tags":["Alerts"],"summary":"Gets Alert by id","description":"The endpoint returns alert by id.","operationId":"getAlert","parameters":[{"name":"alertId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"OK.","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Alerts","items":{"$ref":"#/components/schemas/AlertResponse"}}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts/received":{"get":{"tags":["Alerts"],"summary":"Gets received alerts","description":"The endpoint returns received alerts as paged result.","operationId":"getReceivedAlerts","parameters":[{"name":"pageable","in":"query","required":true,"schema":{"$ref":"#/components/schemas/OwnPageable"}}],"responses":{"200":{"description":"Returns the paged result found for Asset","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array"}}}},"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts/created":{"get":{"tags":["Alerts"],"summary":"Gets created alerts","description":"The endpoint returns created alerts as paged result.","operationId":"getCreatedAlerts","parameters":[{"name":"pageable","in":"query","required":true,"schema":{"$ref":"#/components/schemas/OwnPageable"}}],"responses":{"200":{"description":"Returns the paged result found for Asset","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array"}}}},"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/submodel/data":{"delete":{"tags":["Submodel"],"summary":"Delete All Submodels","description":"Deletes all submodels from the system.","operationId":"deleteSubmodels","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No Content."}},"security":[{"oAuth2":["profile email"]}]}},"/bpn-config/{bpn}":{"delete":{"tags":["BpnEdcMapping"],"summary":"Deletes BPN EDC URL mappings","description":"The endpoint deletes BPN EDC URL mappings","operationId":"deleteBpnEdcUrlMappings","parameters":[{"name":"bpn","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"Deleted."},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}}},"components":{"schemas":{"BpnMappingRequest":{"required":["bpn","url"],"type":"object","properties":{"bpn":{"maxLength":255,"minLength":0,"type":"string"},"url":{"maxLength":255,"minLength":0,"type":"string"}}},"ErrorResponse":{"type":"object","properties":{"message":{"maxLength":1000,"minLength":0,"pattern":"^.*$","type":"string"}}},"StartQualityNotificationRequest":{"required":["severity"],"type":"object","properties":{"partIds":{"maxItems":100,"minItems":1,"type":"array","items":{"type":"string"}},"description":{"maxLength":1000,"minLength":15,"type":"string"},"targetDate":{"type":"string","format":"date-time"},"severity":{"type":"string","enum":["MINOR","MAJOR","CRITICAL","LIFE_THREATENING"]},"receiverBpn":{"type":"string"},"asBuilt":{"type":"boolean"}}},"QualityNotificationIdResponse":{"type":"object","properties":{"id":{"type":"integer","format":"int64"}}},"UpdateQualityNotificationRequest":{"required":["status"],"type":"object","properties":{"status":{"type":"string","description":"The UpdateInvestigationStatus","enum":["ACKNOWLEDGED","ACCEPTED","DECLINED"]},"reason":{"type":"string"}}},"CloseQualityNotificationRequest":{"type":"object","properties":{"reason":{"maxLength":1000,"minLength":15,"type":"string"}}},"CreateNotificationContractRequest":{"required":["notificationMethod","notificationType"],"type":"object","properties":{"notificationType":{"type":"string","enum":["QUALITY_INVESTIGATION","QUALITY_ALERT"]},"notificationMethod":{"type":"string","enum":["RECEIVE","UPDATE","RESOLVE"]}}},"CreateNotificationContractResponse":{"type":"object","properties":{"notificationAssetId":{"type":"string"},"accessPolicyId":{"type":"string"},"contractDefinitionId":{"type":"string"}}},"SyncAssetsRequest":{"type":"object","properties":{"globalAssetIds":{"maxItems":100,"minItems":1,"type":"array","description":"Assets","items":{"type":"string"}}}},"GetDetailInformationRequest":{"type":"object","properties":{"assetIds":{"maxItems":50,"minItems":1,"type":"array","items":{"type":"string"}}}},"UpdateAssetRequest":{"required":["qualityType"],"type":"object","properties":{"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]}}},"DescriptionsResponse":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"}}},"DetailAspectDataAsBuiltResponse":{"type":"object","properties":{"partId":{"maxLength":255,"minLength":0,"type":"string"},"customerPartId":{"maxLength":255,"minLength":0,"type":"string"},"nameAtCustomer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturingCountry":{"maxLength":255,"minLength":0,"type":"string"},"manufacturingDate":{"maxLength":255,"minLength":0,"type":"string"}}},"DetailAspectDataAsPlannedResponse":{"type":"object","properties":{"validityPeriodFrom":{"maxLength":255,"minLength":0,"type":"string"},"validityPeriodTo":{"maxLength":255,"minLength":0,"type":"string"}}},"DetailAspectDataResponse":{"type":"object","oneOf":[{"$ref":"#/components/schemas/DetailAspectDataAsBuiltResponse"},{"$ref":"#/components/schemas/DetailAspectDataAsPlannedResponse"},{"$ref":"#/components/schemas/PartSiteInformationAsPlannedResponse"},{"$ref":"#/components/schemas/DetailAspectDataTractionBatteryCodeResponse"}]},"DetailAspectDataTractionBatteryCodeResponse":{"type":"object","properties":{"productType":{"maxLength":255,"minLength":0,"type":"string"},"tractionBatteryCode":{"maxLength":255,"minLength":0,"type":"string"},"subcomponents":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectDataTractionBatteryCodeSubcomponentResponse"}}}},"DetailAspectDataTractionBatteryCodeSubcomponentResponse":{"type":"object","properties":{"productType":{"maxLength":255,"minLength":0,"type":"string"},"tractionBatteryCode":{"maxLength":255,"minLength":0,"type":"string"}}},"DetailAspectModelResponse":{"type":"object","properties":{"type":{"type":"string","enum":["AS_BUILT","AS_PLANNED","TRACTION_BATTERY_CODE","SINGLE_LEVEL_BOM_AS_BUILT","SINGLE_LEVEL_USAGE_AS_BUILT","SINGLE_LEVEL_BOM_AS_PLANNED","PART_SITE_INFORMATION_AS_PLANNED"]},"data":{"$ref":"#/components/schemas/DetailAspectDataResponse"}}},"PartSiteInformationAsPlannedResponse":{"type":"object","properties":{"functionValidUntil":{"type":"string"},"function":{"type":"string"},"functionValidFrom":{"type":"string"},"catenaXSiteId":{"type":"string"}}},"ShellDescriptorResponse":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"globalAssetId":{"type":"string"}}},"InvestigationResponse":{"type":"object","properties":{"id":{"maximum":255,"minimum":0,"type":"integer","format":"int64"},"status":{"maxLength":255,"minLength":0,"type":"string","enum":["CREATED","SENT","RECEIVED","ACKNOWLEDGED","ACCEPTED","DECLINED","CANCELED","CLOSED"]},"description":{"maxLength":1000,"minLength":0,"type":"string"},"createdBy":{"maxLength":255,"minLength":0,"type":"string"},"createdByName":{"maxLength":255,"minLength":0,"type":"string"},"createdDate":{"maxLength":50,"minLength":0,"type":"string"},"assetIds":{"maxItems":1000,"minItems":0,"type":"array","description":"assetIds","items":{"type":"string"}},"channel":{"maxLength":255,"minLength":0,"type":"string","enum":["SENDER","RECEIVER"]},"reason":{"$ref":"#/components/schemas/QualityNotificationReasonResponse"},"sendTo":{"maxLength":255,"minLength":0,"type":"string"},"sendToName":{"maxLength":255,"minLength":0,"type":"string"},"severity":{"maxLength":255,"minLength":0,"type":"string","enum":["MINOR","MAJOR","CRITICAL","LIFE-THREATENING"]},"targetDate":{"maxLength":50,"minLength":0,"type":"string"},"errorMessage":{"maxLength":255,"minLength":0,"type":"string"}}},"QualityNotificationReasonResponse":{"type":"object","properties":{"close":{"maxLength":1000,"minLength":0,"type":"string"},"accept":{"maxLength":1000,"minLength":0,"type":"string"},"decline":{"maxLength":1000,"minLength":0,"type":"string"}}},"OwnPageable":{"type":"object","properties":{"page":{"type":"integer","format":"int32"},"size":{"type":"integer","format":"int32"},"sort":{"maxItems":2147483647,"type":"array","description":"Content of Assets PageResults","example":"manufacturerPartId,desc","items":{"type":"string"}}}},"DashboardResponse":{"type":"object","properties":{"myParts":{"type":"integer","format":"int64"},"otherParts":{"type":"integer","format":"int64"},"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"}}},"SearchCriteriaRequestParam":{"type":"object","properties":{"filter":{"maxItems":2147483647,"type":"array","description":"Filter Criteria","example":"owner,EQUAL,OWN","items":{"type":"string"}},"filterOperator":{"type":"string","description":"The filter logical operator","example":"AND","enum":["AND","OR"]}}},"AlertResponse":{"type":"object","properties":{"id":{"maximum":255,"minimum":0,"type":"integer","format":"int64"},"status":{"maxLength":255,"minLength":0,"type":"string","enum":["CREATED","SENT","RECEIVED","ACKNOWLEDGED","ACCEPTED","DECLINED","CANCELED","CLOSED"]},"description":{"maxLength":1000,"minLength":0,"type":"string"},"createdBy":{"maxLength":255,"minLength":0,"type":"string"},"createdByName":{"maxLength":255,"minLength":0,"type":"string"},"createdDate":{"maxLength":50,"minLength":0,"type":"string"},"assetIds":{"maxItems":1000,"minItems":0,"type":"array","description":"assetIds","items":{"type":"string"}},"channel":{"maxLength":255,"minLength":0,"type":"string","enum":["SENDER","RECEIVER"]},"reason":{"$ref":"#/components/schemas/QualityNotificationReasonResponse"},"sendTo":{"maxLength":255,"minLength":0,"type":"string"},"sendToName":{"maxLength":255,"minLength":0,"type":"string"},"severity":{"maxLength":255,"minLength":0,"type":"string","enum":["MINOR","MAJOR","CRITICAL","LIFE-THREATENING"]},"targetDate":{"maxLength":50,"minLength":0,"type":"string"},"errorMessage":{"maxLength":255,"minLength":0,"type":"string"}}}},"securitySchemes":{"oAuth2":{"type":"oauth2","flows":{"clientCredentials":{"scopes":{"profile email":""}}}}}}} \ No newline at end of file +{ + "openapi" : "3.0.1", + "info" : { + "title" : "Trace-FOSS - OpenAPI Documentation", + "description" : "Trace-FOSS is a system for tracking parts along the supply chain. A high level of transparency across the supplier network enables faster intervention based on a recorded event in the supply chain. This saves costs by seamlessly tracking parts and creates trust through clearly defined and secure data access by the companies and persons involved in the process.", + "license" : { + "name" : "License: Apache 2.0" + }, + "version" : "1.0.0" + }, + "servers" : [ + { + "url" : "http://localhost:9998/api", + "description" : "Generated server url" + } + ], + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ], + "tags" : [ + { + "name" : "ShellDescriptorController", + "description" : "Shell Descriptor Controller" + }, + { + "name" : "Investigations", + "description" : "Operations on Investigation Notification" + } + ], + "paths" : { + "/bpn-config" : { + "get" : { + "tags" : [ + "BpnEdcMapping" + ], + "summary" : "Get BPN EDC URL mappings", + "description" : "The endpoint returns a result of BPN EDC URL mappings.", + "operationId" : "getBpnEdcs", + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "200" : { + "description" : "Returns the paged result found", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + }, + "put" : { + "tags" : [ + "BpnEdcMapping" + ], + "summary" : "Updates BPN EDC URL mappings", + "description" : "The endpoint updates BPN EDC URL mappings", + "operationId" : "updateBpnEdcMappings", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 1000, + "minItems" : 0, + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/BpnMappingRequest" + } + } + } + }, + "required" : true + }, + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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 paged result found for BpnEdcMapping", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + }, + "post" : { + "tags" : [ + "BpnEdcMapping" + ], + "summary" : "Creates BPN EDC URL mappings", + "description" : "The endpoint creates BPN EDC URL mappings", + "operationId" : "createBpnEdcUrlMappings", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 1000, + "minItems" : 0, + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/BpnMappingRequest" + } + } + } + }, + "required" : true + }, + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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 paged result found for BpnEdcMapping", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/submodel/data/{submodelId}" : { + "get" : { + "tags" : [ + "Submodel" + ], + "summary" : "Gets Submodel by its id", + "description" : "The endpoint returns Submodel for given id. Used for data providing functionality", + "operationId" : "getSubmodelById", + "parameters" : [ + { + "name" : "submodelId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } + ], + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "200" : { + "description" : "Returns the paged result found", + "content" : { + "application/json" : {} + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + }, + "post" : { + "tags" : [ + "Submodel" + ], + "summary" : "Save Submodel", + "description" : "This endpoint allows you to save a Submodel identified by its ID.", + "operationId" : "saveSubmodel", + "parameters" : [ + { + "name" : "submodelId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } + ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "type" : "string" + } + } + }, + "required" : true + }, + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "204" : { + "description" : "No Content." + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/investigations" : { + "get" : { + "tags" : [ + "Investigations" + ], + "summary" : "Gets investigations", + "description" : "The endpoint returns investigations as paged result.", + "operationId" : "getInvestigations", + "parameters" : [ + { + "name" : "pageable", + "in" : "query", + "required" : true, + "schema" : { + "$ref" : "#/components/schemas/OwnPageable" + } + }, + { + "name" : "filter", + "in" : "query", + "required" : true, + "schema" : { + "$ref" : "#/components/schemas/SearchCriteriaRequestParam" + } + } + ], + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "200" : { + "description" : "Returns the paged result found for Asset", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + }, + "post" : { + "tags" : [ + "Investigations" + ], + "summary" : "Start investigations by part ids", + "description" : "The endpoint starts investigations based on part ids provided.", + "operationId" : "investigateAssets", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/StartQualityNotificationRequest" + } + } + }, + "required" : true + }, + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "201" : { + "description" : "Created.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/QualityNotificationIdResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/investigations/{investigationId}/update" : { + "post" : { + "tags" : [ + "Investigations" + ], + "summary" : "Update investigations by id", + "description" : "The endpoint updates investigations by their id.", + "operationId" : "updateInvestigation", + "parameters" : [ + { + "name" : "investigationId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "integer", + "format" : "int64" + } + } + ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/UpdateQualityNotificationRequest" + } + } + }, + "required" : true + }, + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "204" : { + "description" : "No content." + }, + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/investigations/{investigationId}/close" : { + "post" : { + "tags" : [ + "Investigations" + ], + "summary" : "Close investigations by id", + "description" : "The endpoint closes investigations by their id.", + "operationId" : "closeInvestigation", + "parameters" : [ + { + "name" : "investigationId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "integer", + "format" : "int64" + } + } + ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/CloseQualityNotificationRequest" + } + } + }, + "required" : true + }, + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "204" : { + "description" : "No content." + }, + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/investigations/{investigationId}/cancel" : { + "post" : { + "tags" : [ + "Investigations" + ], + "summary" : "Cancles investigations by id", + "description" : "The endpoint cancles investigations by their id.", + "operationId" : "cancelInvestigation", + "parameters" : [ + { + "name" : "investigationId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "integer", + "format" : "int64" + } + } + ], + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "204" : { + "description" : "No content." + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/investigations/{investigationId}/approve" : { + "post" : { + "tags" : [ + "Investigations" + ], + "summary" : "Approves investigations by id", + "description" : "The endpoint approves investigations by their id.", + "operationId" : "approveInvestigation", + "parameters" : [ + { + "name" : "investigationId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "integer", + "format" : "int64" + } + } + ], + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "204" : { + "description" : "No content." + }, + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/edc/notification/contract" : { + "post" : { + "tags" : [ + "Notifications" + ], + "summary" : "Triggers EDC notification contract", + "description" : "The endpoint Triggers EDC notification contract based on notification type and method", + "operationId" : "createNotificationContract", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/CreateNotificationContractRequest" + } + } + }, + "required" : true + }, + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "201" : { + "description" : "Created.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/CreateNotificationContractResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/assets/as-planned/sync" : { + "post" : { + "tags" : [ + "AssetsAsPlanned" + ], + "summary" : "Synchronizes assets from IRS", + "description" : "The endpoint synchronizes the assets from irs.", + "operationId" : "sync", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/SyncAssetsRequest" + } + } + }, + "required" : true + }, + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "201" : { + "description" : "Created." + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/assets/as-planned/detail-information" : { + "post" : { + "tags" : [ + "AssetsAsPlanned" + ], + "summary" : "Searches for assets by ids.", + "description" : "The endpoint searchs for assets by id and returns a list of them.", + "operationId" : "getDetailInformation", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GetDetailInformationRequest" + } + } + }, + "required" : true + }, + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "200" : { + "description" : "Returns the paged result found for Asset", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/assets/as-built/sync" : { + "post" : { + "tags" : [ + "AssetsAsBuilt" + ], + "summary" : "Synchronizes assets from IRS", + "description" : "The endpoint synchronizes the assets from irs.", + "operationId" : "sync_1", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/SyncAssetsRequest" + } + } + }, + "required" : true + }, + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "201" : { + "description" : "Created." + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/assets/as-built/detail-information" : { + "post" : { + "tags" : [ + "AssetsAsBuilt" + ], + "summary" : "Searches for assets by ids.", + "description" : "The endpoint searchs for assets by id and returns a list of them.", + "operationId" : "getDetailInformation_1", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GetDetailInformationRequest" + } + } + }, + "required" : true + }, + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "200" : { + "description" : "Returns the paged result found for Asset", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/alerts" : { + "get" : { + "tags" : [ + "Alerts" + ], + "summary" : "Gets alerts", + "description" : "The endpoint returns alerts as paged result.", + "operationId" : "getAlerts", + "parameters" : [ + { + "name" : "pageable", + "in" : "query", + "required" : true, + "schema" : { + "$ref" : "#/components/schemas/OwnPageable" + } + }, + { + "name" : "filter", + "in" : "query", + "required" : true, + "schema" : { + "$ref" : "#/components/schemas/SearchCriteriaRequestParam" + } + } + ], + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "200" : { + "description" : "Returns the paged result found for Asset", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "type" : "array" + } + } + } + }, + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + }, + "post" : { + "tags" : [ + "Alerts" + ], + "summary" : "Start alert by part ids", + "description" : "The endpoint starts alert based on part ids provided.", + "operationId" : "alertAssets", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/StartQualityNotificationRequest" + } + } + }, + "required" : true + }, + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "201" : { + "description" : "Created.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/QualityNotificationIdResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/alerts/{alertId}/update" : { + "post" : { + "tags" : [ + "Alerts" + ], + "summary" : "Update alert by id", + "description" : "The endpoint updates alert by their id.", + "operationId" : "updateAlert", + "parameters" : [ + { + "name" : "alertId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "integer", + "format" : "int64" + } + } + ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/UpdateQualityNotificationRequest" + } + } + }, + "required" : true + }, + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "204" : { + "description" : "No content." + }, + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/alerts/{alertId}/close" : { + "post" : { + "tags" : [ + "Alerts" + ], + "summary" : "Close alert by id", + "description" : "The endpoint closes alert by id.", + "operationId" : "closeAlert", + "parameters" : [ + { + "name" : "alertId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "integer", + "format" : "int64" + } + } + ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/CloseQualityNotificationRequest" + } + } + }, + "required" : true + }, + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "204" : { + "description" : "No content." + }, + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/alerts/{alertId}/cancel" : { + "post" : { + "tags" : [ + "Alerts" + ], + "summary" : "Cancels alert by id", + "description" : "The endpoint cancels alert by id.", + "operationId" : "cancelAlert", + "parameters" : [ + { + "name" : "alertId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "integer", + "format" : "int64" + } + } + ], + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "204" : { + "description" : "No content." + }, + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/alerts/{alertId}/approve" : { + "post" : { + "tags" : [ + "Alerts" + ], + "summary" : "Approves alert by id", + "description" : "The endpoint approves alert by id.", + "operationId" : "approveAlert", + "parameters" : [ + { + "name" : "alertId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "integer", + "format" : "int64" + } + } + ], + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "204" : { + "description" : "No content." + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/assets/as-planned/{assetId}" : { + "get" : { + "tags" : [ + "AssetsAsPlanned" + ], + "summary" : "Get asset by id", + "description" : "The endpoint returns an asset filtered by id .", + "operationId" : "assetById", + "parameters" : [ + { + "name" : "assetId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } + ], + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "200" : { + "description" : "Returns the assets found", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Assets", + "items" : { + "type" : "object", + "properties" : { + "id" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "idShort" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "semanticModelId" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "businessPartner" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "manufacturerName" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "nameAtManufacturer" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "manufacturerPartId" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "owner" : { + "type" : "string", + "enum" : [ + "SUPPLIER", + "CUSTOMER", + "OWN", + "UNKNOWN" + ] + }, + "childRelations" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Child relationships", + "items" : { + "$ref" : "#/components/schemas/DescriptionsResponse" + } + }, + "parentRelations" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Parent relationships", + "items" : { + "$ref" : "#/components/schemas/DescriptionsResponse" + } + }, + "activeAlert" : { + "type" : "boolean" + }, + "underInvestigation" : { + "type" : "boolean" + }, + "qualityType" : { + "type" : "string", + "enum" : [ + "Ok", + "Minor", + "Major", + "Critical", + "LifeThreatening" + ] + }, + "van" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "semanticDataModel" : { + "type" : "string", + "enum" : [ + "BATCH", + "SERIALPART", + "UNKNOWN", + "PARTASPLANNED", + "JUSTINSEQUENCE" + ] + }, + "classification" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "detailAspectModels" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/DetailAspectModelResponse" + } + }, + "qualityAlertsInStatusActive" : { + "type" : "integer", + "format" : "int32" + }, + "qualityInvestigationsInStatusActive" : { + "type" : "integer", + "format" : "int32" + } + } + } + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + }, + "patch" : { + "tags" : [ + "AssetsAsPlanned" + ], + "summary" : "Updates asset", + "description" : "The endpoint updates asset by provided quality type.", + "operationId" : "updateAsset", + "parameters" : [ + { + "name" : "assetId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } + ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/UpdateAssetRequest" + } + } + }, + "required" : true + }, + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "200" : { + "description" : "Returns the updated asset", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Assets", + "items" : { + "type" : "object", + "properties" : { + "id" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "idShort" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "semanticModelId" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "businessPartner" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "manufacturerName" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "nameAtManufacturer" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "manufacturerPartId" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "owner" : { + "type" : "string", + "enum" : [ + "SUPPLIER", + "CUSTOMER", + "OWN", + "UNKNOWN" + ] + }, + "childRelations" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Child relationships", + "items" : { + "$ref" : "#/components/schemas/DescriptionsResponse" + } + }, + "parentRelations" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Parent relationships", + "items" : { + "$ref" : "#/components/schemas/DescriptionsResponse" + } + }, + "activeAlert" : { + "type" : "boolean" + }, + "underInvestigation" : { + "type" : "boolean" + }, + "qualityType" : { + "type" : "string", + "enum" : [ + "Ok", + "Minor", + "Major", + "Critical", + "LifeThreatening" + ] + }, + "van" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "semanticDataModel" : { + "type" : "string", + "enum" : [ + "BATCH", + "SERIALPART", + "UNKNOWN", + "PARTASPLANNED", + "JUSTINSEQUENCE" + ] + }, + "classification" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "detailAspectModels" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/DetailAspectModelResponse" + } + }, + "qualityAlertsInStatusActive" : { + "type" : "integer", + "format" : "int32" + }, + "qualityInvestigationsInStatusActive" : { + "type" : "integer", + "format" : "int32" + } + } + } + } + } + } + }, + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/assets/as-built/{assetId}" : { + "get" : { + "tags" : [ + "AssetsAsBuilt" + ], + "summary" : "Get asset by id", + "description" : "The endpoint returns an asset filtered by id .", + "operationId" : "assetById_1", + "parameters" : [ + { + "name" : "assetId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } + ], + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "200" : { + "description" : "Returns the assets found", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Assets", + "items" : { + "type" : "object", + "properties" : { + "id" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "idShort" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "semanticModelId" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "businessPartner" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "manufacturerName" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "nameAtManufacturer" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "manufacturerPartId" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "owner" : { + "type" : "string", + "enum" : [ + "SUPPLIER", + "CUSTOMER", + "OWN", + "UNKNOWN" + ] + }, + "childRelations" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Child relationships", + "items" : { + "$ref" : "#/components/schemas/DescriptionsResponse" + } + }, + "parentRelations" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Parent relationships", + "items" : { + "$ref" : "#/components/schemas/DescriptionsResponse" + } + }, + "activeAlert" : { + "type" : "boolean" + }, + "underInvestigation" : { + "type" : "boolean" + }, + "qualityType" : { + "type" : "string", + "enum" : [ + "Ok", + "Minor", + "Major", + "Critical", + "LifeThreatening" + ] + }, + "van" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "semanticDataModel" : { + "type" : "string", + "enum" : [ + "BATCH", + "SERIALPART", + "UNKNOWN", + "PARTASPLANNED", + "JUSTINSEQUENCE" + ] + }, + "classification" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "detailAspectModels" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/DetailAspectModelResponse" + } + }, + "qualityAlertsInStatusActive" : { + "type" : "integer", + "format" : "int32" + }, + "qualityInvestigationsInStatusActive" : { + "type" : "integer", + "format" : "int32" + } + } + } + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + }, + "patch" : { + "tags" : [ + "AssetsAsBuilt" + ], + "summary" : "Updates asset", + "description" : "The endpoint updates asset by provided quality type.", + "operationId" : "updateAsset_1", + "parameters" : [ + { + "name" : "assetId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } + ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/UpdateAssetRequest" + } + } + }, + "required" : true + }, + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "200" : { + "description" : "Returns the updated asset", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Assets", + "items" : { + "type" : "object", + "properties" : { + "id" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "idShort" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "semanticModelId" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "businessPartner" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "manufacturerName" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "nameAtManufacturer" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "manufacturerPartId" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "owner" : { + "type" : "string", + "enum" : [ + "SUPPLIER", + "CUSTOMER", + "OWN", + "UNKNOWN" + ] + }, + "childRelations" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Child relationships", + "items" : { + "$ref" : "#/components/schemas/DescriptionsResponse" + } + }, + "parentRelations" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Parent relationships", + "items" : { + "$ref" : "#/components/schemas/DescriptionsResponse" + } + }, + "activeAlert" : { + "type" : "boolean" + }, + "underInvestigation" : { + "type" : "boolean" + }, + "qualityType" : { + "type" : "string", + "enum" : [ + "Ok", + "Minor", + "Major", + "Critical", + "LifeThreatening" + ] + }, + "van" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "semanticDataModel" : { + "type" : "string", + "enum" : [ + "BATCH", + "SERIALPART", + "UNKNOWN", + "PARTASPLANNED", + "JUSTINSEQUENCE" + ] + }, + "classification" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "detailAspectModels" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/DetailAspectModelResponse" + } + }, + "qualityAlertsInStatusActive" : { + "type" : "integer", + "format" : "int32" + }, + "qualityInvestigationsInStatusActive" : { + "type" : "integer", + "format" : "int32" + } + } + } + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/shelldescriptors" : { + "get" : { + "tags" : [ + "ShellDescriptorController" + ], + "summary" : "FindAll shell descriptors", + "description" : "The endpoint returns all shell descriptors.", + "operationId" : "findAll", + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "200" : { + "description" : "ShellDescriptors found.", + "content" : { + "application/json" : { + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ShellDescriptorResponse" + } + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + }, + "delete" : { + "tags" : [ + "Registry", + "ShellDescriptorController" + ], + "summary" : "Triggers deleteAll of shell descriptors list", + "description" : "The endpoint deletes all shell descriptors.", + "operationId" : "deleteAll", + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "204" : { + "description" : "Deleted." + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/registry/reload" : { + "get" : { + "tags" : [ + "Registry" + ], + "summary" : "Triggers reload of shell descriptors", + "description" : "The endpoint Triggers reload of shell descriptors.", + "operationId" : "reload", + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "202" : { + "description" : "Created registry reload job." + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/investigations/{investigationId}" : { + "get" : { + "tags" : [ + "Investigations" + ], + "summary" : "Gets investigations by id", + "description" : "The endpoint returns investigations as paged result by their id.", + "operationId" : "getInvestigation", + "parameters" : [ + { + "name" : "investigationId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "integer", + "format" : "int64" + } + } + ], + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" : "OK.", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "minItems" : -2147483648, + "type" : "array", + "description" : "Investigations", + "items" : { + "$ref" : "#/components/schemas/InvestigationResponse" + } + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/dashboard" : { + "get" : { + "tags" : [ + "Dashboard" + ], + "summary" : "Returns dashboard related data", + "description" : "The endpoint can return limited data based on the user role", + "operationId" : "dashboard", + "responses" : { + "200" : { + "description" : "Returns dashboard data", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/DashboardResponse" + } + } + } + }, + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/assets/as-planned" : { + "get" : { + "tags" : [ + "AssetsAsPlanned" + ], + "summary" : "Get assets by pagination", + "description" : "The endpoint returns a paged result of assets.", + "operationId" : "AssetsAsPlanned", + "parameters" : [ + { + "name" : "pageable", + "in" : "query", + "required" : true, + "schema" : { + "$ref" : "#/components/schemas/OwnPageable" + } + }, + { + "name" : "filter", + "in" : "query", + "required" : true, + "schema" : { + "$ref" : "#/components/schemas/SearchCriteriaRequestParam" + } + } + ], + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "200" : { + "description" : "Returns the paged result found for Asset", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array", + "items" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Assets", + "items" : { + "type" : "object", + "properties" : { + "id" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "idShort" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "semanticModelId" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "businessPartner" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "manufacturerName" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "nameAtManufacturer" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "manufacturerPartId" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "owner" : { + "type" : "string", + "enum" : [ + "SUPPLIER", + "CUSTOMER", + "OWN", + "UNKNOWN" + ] + }, + "childRelations" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Child relationships", + "items" : { + "$ref" : "#/components/schemas/DescriptionsResponse" + } + }, + "parentRelations" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Parent relationships", + "items" : { + "$ref" : "#/components/schemas/DescriptionsResponse" + } + }, + "activeAlert" : { + "type" : "boolean" + }, + "underInvestigation" : { + "type" : "boolean" + }, + "qualityType" : { + "type" : "string", + "enum" : [ + "Ok", + "Minor", + "Major", + "Critical", + "LifeThreatening" + ] + }, + "van" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "semanticDataModel" : { + "type" : "string", + "enum" : [ + "BATCH", + "SERIALPART", + "UNKNOWN", + "PARTASPLANNED", + "JUSTINSEQUENCE" + ] + }, + "classification" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "detailAspectModels" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/DetailAspectModelResponse" + } + }, + "qualityAlertsInStatusActive" : { + "type" : "integer", + "format" : "int32" + }, + "qualityInvestigationsInStatusActive" : { + "type" : "integer", + "format" : "int32" + } + } + } + } + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/assets/as-planned/{assetId}/children/{childId}" : { + "get" : { + "tags" : [ + "AssetsAsPlanned" + ], + "summary" : "Get asset by child id", + "description" : "The endpoint returns an asset filtered by child id.", + "operationId" : "assetByChildId", + "parameters" : [ + { + "name" : "assetId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, + { + "name" : "childId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } + ], + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "200" : { + "description" : "Returns the asset by childId", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Assets", + "items" : { + "type" : "object", + "properties" : { + "id" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "idShort" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "semanticModelId" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "businessPartner" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "manufacturerName" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "nameAtManufacturer" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "manufacturerPartId" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "owner" : { + "type" : "string", + "enum" : [ + "SUPPLIER", + "CUSTOMER", + "OWN", + "UNKNOWN" + ] + }, + "childRelations" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Child relationships", + "items" : { + "$ref" : "#/components/schemas/DescriptionsResponse" + } + }, + "parentRelations" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Parent relationships", + "items" : { + "$ref" : "#/components/schemas/DescriptionsResponse" + } + }, + "activeAlert" : { + "type" : "boolean" + }, + "underInvestigation" : { + "type" : "boolean" + }, + "qualityType" : { + "type" : "string", + "enum" : [ + "Ok", + "Minor", + "Major", + "Critical", + "LifeThreatening" + ] + }, + "van" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "semanticDataModel" : { + "type" : "string", + "enum" : [ + "BATCH", + "SERIALPART", + "UNKNOWN", + "PARTASPLANNED", + "JUSTINSEQUENCE" + ] + }, + "classification" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "detailAspectModels" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/DetailAspectModelResponse" + } + }, + "qualityAlertsInStatusActive" : { + "type" : "integer", + "format" : "int32" + }, + "qualityInvestigationsInStatusActive" : { + "type" : "integer", + "format" : "int32" + } + } + } + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/assets/as-planned/distinctFilterValues" : { + "get" : { + "tags" : [ + "Assets", + "AssetsAsPlanned" + ], + "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" : { + "200" : { + "description" : "Returns a distinct filter values for given fieldName.", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" + } + } + } + }, + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/assets/as-built" : { + "get" : { + "tags" : [ + "AssetsAsBuilt" + ], + "summary" : "Get assets by pagination", + "description" : "The endpoint returns a paged result of assets.", + "operationId" : "assets", + "parameters" : [ + { + "name" : "pageable", + "in" : "query", + "required" : true, + "schema" : { + "$ref" : "#/components/schemas/OwnPageable" + } + }, + { + "name" : "searchCriteriaRequestParam", + "in" : "query", + "required" : true, + "schema" : { + "$ref" : "#/components/schemas/SearchCriteriaRequestParam" + } + } + ], + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "200" : { + "description" : "Returns the paged result found for Asset", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array", + "items" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Assets", + "items" : { + "type" : "object", + "properties" : { + "id" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "idShort" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "semanticModelId" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "businessPartner" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "manufacturerName" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "nameAtManufacturer" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "manufacturerPartId" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "owner" : { + "type" : "string", + "enum" : [ + "SUPPLIER", + "CUSTOMER", + "OWN", + "UNKNOWN" + ] + }, + "childRelations" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Child relationships", + "items" : { + "$ref" : "#/components/schemas/DescriptionsResponse" + } + }, + "parentRelations" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Parent relationships", + "items" : { + "$ref" : "#/components/schemas/DescriptionsResponse" + } + }, + "activeAlert" : { + "type" : "boolean" + }, + "underInvestigation" : { + "type" : "boolean" + }, + "qualityType" : { + "type" : "string", + "enum" : [ + "Ok", + "Minor", + "Major", + "Critical", + "LifeThreatening" + ] + }, + "van" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "semanticDataModel" : { + "type" : "string", + "enum" : [ + "BATCH", + "SERIALPART", + "UNKNOWN", + "PARTASPLANNED", + "JUSTINSEQUENCE" + ] + }, + "classification" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "detailAspectModels" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/DetailAspectModelResponse" + } + }, + "qualityAlertsInStatusActive" : { + "type" : "integer", + "format" : "int32" + }, + "qualityInvestigationsInStatusActive" : { + "type" : "integer", + "format" : "int32" + } + } + } + } + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/assets/as-built/{assetId}/children/{childId}" : { + "get" : { + "tags" : [ + "AssetsAsBuilt" + ], + "summary" : "Get asset by child id", + "description" : "The endpoint returns an asset filtered by child id.", + "operationId" : "assetByChildId_1", + "parameters" : [ + { + "name" : "assetId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, + { + "name" : "childId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } + ], + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "200" : { + "description" : "Returns the asset by childId", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Assets", + "items" : { + "type" : "object", + "properties" : { + "id" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "idShort" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "semanticModelId" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "businessPartner" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "manufacturerName" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "nameAtManufacturer" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "manufacturerPartId" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "owner" : { + "type" : "string", + "enum" : [ + "SUPPLIER", + "CUSTOMER", + "OWN", + "UNKNOWN" + ] + }, + "childRelations" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Child relationships", + "items" : { + "$ref" : "#/components/schemas/DescriptionsResponse" + } + }, + "parentRelations" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Parent relationships", + "items" : { + "$ref" : "#/components/schemas/DescriptionsResponse" + } + }, + "activeAlert" : { + "type" : "boolean" + }, + "underInvestigation" : { + "type" : "boolean" + }, + "qualityType" : { + "type" : "string", + "enum" : [ + "Ok", + "Minor", + "Major", + "Critical", + "LifeThreatening" + ] + }, + "van" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "semanticDataModel" : { + "type" : "string", + "enum" : [ + "BATCH", + "SERIALPART", + "UNKNOWN", + "PARTASPLANNED", + "JUSTINSEQUENCE" + ] + }, + "classification" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "detailAspectModels" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/DetailAspectModelResponse" + } + }, + "qualityAlertsInStatusActive" : { + "type" : "integer", + "format" : "int32" + }, + "qualityInvestigationsInStatusActive" : { + "type" : "integer", + "format" : "int32" + } + } + } + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/assets/as-built/distinctFilterValues" : { + "get" : { + "tags" : [ + "AssetsAsBuilt", + "Assets" + ], + "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" : { + "200" : { + "description" : "Returns a distinct filter values for given fieldName.", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" + } + } + } + }, + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/assets/as-built/countries" : { + "get" : { + "tags" : [ + "AssetsAsBuilt" + ], + "summary" : "Get map of assets", + "description" : "The endpoint returns a map for assets consumed by the map.", + "operationId" : "assetsCountryMap", + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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 assets found", + "content" : { + "application/json" : { + "schema" : { + "type" : "object", + "additionalProperties" : { + "type" : "integer", + "format" : "int64" + } + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/alerts/{alertId}" : { + "get" : { + "tags" : [ + "Alerts" + ], + "summary" : "Gets Alert by id", + "description" : "The endpoint returns alert by id.", + "operationId" : "getAlert", + "parameters" : [ + { + "name" : "alertId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "integer", + "format" : "int64" + } + } + ], + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" : "OK.", + "content" : { + "application/json" : { + "schema" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Alerts", + "items" : { + "$ref" : "#/components/schemas/AlertResponse" + } + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/submodel/data" : { + "delete" : { + "tags" : [ + "Submodel" + ], + "summary" : "Delete All Submodels", + "description" : "Deletes all submodels from the system.", + "operationId" : "deleteSubmodels", + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "204" : { + "description" : "No Content." + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + }, + "/bpn-config/{bpn}" : { + "delete" : { + "tags" : [ + "BpnEdcMapping" + ], + "summary" : "Deletes BPN EDC URL mappings", + "description" : "The endpoint deletes BPN EDC URL mappings", + "operationId" : "deleteBpnEdcUrlMappings", + "parameters" : [ + { + "name" : "bpn", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } + ], + "responses" : { + "429" : { + "description" : "Too many requests.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "400" : { + "description" : "Bad request.", + "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" + } + } + } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "204" : { + "description" : "Deleted." + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security" : [ + { + "oAuth2" : [ + "profile email" + ] + } + ] + } + } + }, + "components" : { + "schemas" : { + "BpnMappingRequest" : { + "required" : [ + "bpn", + "url" + ], + "type" : "object", + "properties" : { + "bpn" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "url" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + } + } + }, + "ErrorResponse" : { + "type" : "object", + "properties" : { + "message" : { + "maxLength" : 1000, + "minLength" : 0, + "pattern" : "^.*$", + "type" : "string" + } + } + }, + "StartQualityNotificationRequest" : { + "required" : [ + "severity" + ], + "type" : "object", + "properties" : { + "partIds" : { + "maxItems" : 100, + "minItems" : 1, + "type" : "array", + "items" : { + "type" : "string" + } + }, + "description" : { + "maxLength" : 1000, + "minLength" : 15, + "type" : "string" + }, + "targetDate" : { + "type" : "string", + "format" : "date-time" + }, + "severity" : { + "type" : "string", + "enum" : [ + "MINOR", + "MAJOR", + "CRITICAL", + "LIFE_THREATENING" + ] + }, + "receiverBpn" : { + "type" : "string" + }, + "asBuilt" : { + "type" : "boolean" + } + } + }, + "QualityNotificationIdResponse" : { + "type" : "object", + "properties" : { + "id" : { + "type" : "integer", + "format" : "int64" + } + } + }, + "UpdateQualityNotificationRequest" : { + "required" : [ + "status" + ], + "type" : "object", + "properties" : { + "status" : { + "type" : "string", + "description" : "The UpdateInvestigationStatus", + "enum" : [ + "ACKNOWLEDGED", + "ACCEPTED", + "DECLINED" + ] + }, + "reason" : { + "type" : "string" + } + } + }, + "CloseQualityNotificationRequest" : { + "type" : "object", + "properties" : { + "reason" : { + "maxLength" : 1000, + "minLength" : 15, + "type" : "string" + } + } + }, + "CreateNotificationContractRequest" : { + "required" : [ + "notificationMethod", + "notificationType" + ], + "type" : "object", + "properties" : { + "notificationType" : { + "type" : "string", + "enum" : [ + "QUALITY_INVESTIGATION", + "QUALITY_ALERT" + ] + }, + "notificationMethod" : { + "type" : "string", + "enum" : [ + "RECEIVE", + "UPDATE", + "RESOLVE" + ] + } + } + }, + "CreateNotificationContractResponse" : { + "type" : "object", + "properties" : { + "notificationAssetId" : { + "type" : "string" + }, + "accessPolicyId" : { + "type" : "string" + }, + "contractDefinitionId" : { + "type" : "string" + } + } + }, + "SyncAssetsRequest" : { + "type" : "object", + "properties" : { + "globalAssetIds" : { + "maxItems" : 100, + "minItems" : 1, + "type" : "array", + "description" : "Assets", + "items" : { + "type" : "string" + } + } + } + }, + "GetDetailInformationRequest" : { + "type" : "object", + "properties" : { + "assetIds" : { + "maxItems" : 50, + "minItems" : 1, + "type" : "array", + "items" : { + "type" : "string" + } + } + } + }, + "UpdateAssetRequest" : { + "required" : [ + "qualityType" + ], + "type" : "object", + "properties" : { + "qualityType" : { + "type" : "string", + "enum" : [ + "Ok", + "Minor", + "Major", + "Critical", + "LifeThreatening" + ] + } + } + }, + "DescriptionsResponse" : { + "type" : "object", + "properties" : { + "id" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "idShort" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + } + } + }, + "DetailAspectDataAsBuiltResponse" : { + "type" : "object", + "properties" : { + "partId" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "customerPartId" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "nameAtCustomer" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "manufacturingCountry" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "manufacturingDate" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + } + } + }, + "DetailAspectDataAsPlannedResponse" : { + "type" : "object", + "properties" : { + "validityPeriodFrom" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "validityPeriodTo" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + } + } + }, + "DetailAspectDataResponse" : { + "type" : "object", + "oneOf" : [ + { + "$ref" : "#/components/schemas/DetailAspectDataAsBuiltResponse" + }, + { + "$ref" : "#/components/schemas/DetailAspectDataAsPlannedResponse" + }, + { + "$ref" : "#/components/schemas/PartSiteInformationAsPlannedResponse" + }, + { + "$ref" : "#/components/schemas/DetailAspectDataTractionBatteryCodeResponse" + } + ] + }, + "DetailAspectDataTractionBatteryCodeResponse" : { + "type" : "object", + "properties" : { + "productType" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "tractionBatteryCode" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "subcomponents" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/DetailAspectDataTractionBatteryCodeSubcomponentResponse" + } + } + } + }, + "DetailAspectDataTractionBatteryCodeSubcomponentResponse" : { + "type" : "object", + "properties" : { + "productType" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "tractionBatteryCode" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + } + } + }, + "DetailAspectModelResponse" : { + "type" : "object", + "properties" : { + "type" : { + "type" : "string", + "enum" : [ + "AS_BUILT", + "AS_PLANNED", + "TRACTION_BATTERY_CODE", + "SINGLE_LEVEL_BOM_AS_BUILT", + "SINGLE_LEVEL_USAGE_AS_BUILT", + "SINGLE_LEVEL_BOM_AS_PLANNED", + "PART_SITE_INFORMATION_AS_PLANNED" + ] + }, + "data" : { + "$ref" : "#/components/schemas/DetailAspectDataResponse" + } + } + }, + "PartSiteInformationAsPlannedResponse" : { + "type" : "object", + "properties" : { + "functionValidUntil" : { + "type" : "string" + }, + "function" : { + "type" : "string" + }, + "functionValidFrom" : { + "type" : "string" + }, + "catenaXSiteId" : { + "type" : "string" + } + } + }, + "ShellDescriptorResponse" : { + "type" : "object", + "properties" : { + "id" : { + "type" : "integer", + "format" : "int64" + }, + "globalAssetId" : { + "type" : "string" + } + } + }, + "OwnPageable" : { + "type" : "object", + "properties" : { + "page" : { + "type" : "integer", + "format" : "int32" + }, + "size" : { + "type" : "integer", + "format" : "int32" + }, + "sort" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Content of Assets PageResults", + "example" : "manufacturerPartId,desc", + "items" : { + "type" : "string" + } + } + } + }, + "SearchCriteriaRequestParam" : { + "type" : "object", + "properties" : { + "filter" : { + "maxItems" : 2147483647, + "type" : "array", + "description" : "Filter Criteria", + "example" : "owner,EQUAL,OWN", + "items" : { + "type" : "string" + } + } + } + }, + "InvestigationResponse" : { + "type" : "object", + "properties" : { + "id" : { + "maximum" : 255, + "minimum" : 0, + "type" : "integer", + "format" : "int64" + }, + "status" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string", + "enum" : [ + "CREATED", + "SENT", + "RECEIVED", + "ACKNOWLEDGED", + "ACCEPTED", + "DECLINED", + "CANCELED", + "CLOSED" + ] + }, + "description" : { + "maxLength" : 1000, + "minLength" : 0, + "type" : "string" + }, + "createdBy" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "createdByName" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "createdDate" : { + "maxLength" : 50, + "minLength" : 0, + "type" : "string" + }, + "assetIds" : { + "maxItems" : 1000, + "minItems" : 0, + "type" : "array", + "description" : "assetIds", + "items" : { + "type" : "string" + } + }, + "channel" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string", + "enum" : [ + "SENDER", + "RECEIVER" + ] + }, + "reason" : { + "$ref" : "#/components/schemas/QualityNotificationReasonResponse" + }, + "sendTo" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "sendToName" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "severity" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string", + "enum" : [ + "MINOR", + "MAJOR", + "CRITICAL", + "LIFE-THREATENING" + ] + }, + "targetDate" : { + "maxLength" : 50, + "minLength" : 0, + "type" : "string" + }, + "errorMessage" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + } + } + }, + "QualityNotificationReasonResponse" : { + "type" : "object", + "properties" : { + "close" : { + "maxLength" : 1000, + "minLength" : 0, + "type" : "string" + }, + "accept" : { + "maxLength" : 1000, + "minLength" : 0, + "type" : "string" + }, + "decline" : { + "maxLength" : 1000, + "minLength" : 0, + "type" : "string" + } + } + }, + "DashboardResponse" : { + "type" : "object", + "properties" : { + "myParts" : { + "type" : "integer", + "format" : "int64" + }, + "otherParts" : { + "type" : "integer", + "format" : "int64" + }, + "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" + } + } + }, + "AlertResponse" : { + "type" : "object", + "properties" : { + "id" : { + "maximum" : 255, + "minimum" : 0, + "type" : "integer", + "format" : "int64" + }, + "status" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string", + "enum" : [ + "CREATED", + "SENT", + "RECEIVED", + "ACKNOWLEDGED", + "ACCEPTED", + "DECLINED", + "CANCELED", + "CLOSED" + ] + }, + "description" : { + "maxLength" : 1000, + "minLength" : 0, + "type" : "string" + }, + "createdBy" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "createdByName" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "createdDate" : { + "maxLength" : 50, + "minLength" : 0, + "type" : "string" + }, + "assetIds" : { + "maxItems" : 1000, + "minItems" : 0, + "type" : "array", + "description" : "assetIds", + "items" : { + "type" : "string" + } + }, + "channel" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string", + "enum" : [ + "SENDER", + "RECEIVER" + ] + }, + "reason" : { + "$ref" : "#/components/schemas/QualityNotificationReasonResponse" + }, + "sendTo" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "sendToName" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + }, + "severity" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string", + "enum" : [ + "MINOR", + "MAJOR", + "CRITICAL", + "LIFE-THREATENING" + ] + }, + "targetDate" : { + "maxLength" : 50, + "minLength" : 0, + "type" : "string" + }, + "errorMessage" : { + "maxLength" : 255, + "minLength" : 0, + "type" : "string" + } + } + } + }, + "securitySchemes" : { + "oAuth2" : { + "type" : "oauth2", + "flows" : { + "clientCredentials" : { + "scopes" : { + "profile email" : "" + } + } + } + } + } + } +} From 340419b2c33647d453a23fa4dda33ecfc4f16861 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Sat, 21 Oct 2023 00:12:50 +0200 Subject: [PATCH 06/27] chore: TRACEFOSS-2725 tests cleanup for alerts --- CHANGELOG.md | 4 +- .../support/AlertNotificationsSupport.java | 296 +++++++-- .../alert/AlertControllerFilterIT.java | 16 +- .../alert/ReadAlertsControllerIT.java | 624 ++---------------- .../ReadInvestigationsControllerIT.java | 2 +- 5 files changed, 311 insertions(+), 631 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aadf900fac..53a75d6f59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,14 +9,14 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Added - Added Table columns settings in part tables to show/hide/reorder table columns -- Support for Filtering on Alerts and Notifications endpoints +- new endpoints supporting filtering feature for investigations and alers api/investigations api/alerts ### Changed - Updated user manual to reflect the table column settings feature - Changed Filter to support Logical operator (AND,OR) on searchCriteria ### Removed - +- Removed no longer needed endpoints api/investigations/created, api/investigations/received, api/alerts/created, api/alerts/received ## [8.0.0 - 16.10.2023] diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/AlertNotificationsSupport.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/AlertNotificationsSupport.java index 0dc0e01fea..ae933876be 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/AlertNotificationsSupport.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/AlertNotificationsSupport.java @@ -22,6 +22,8 @@ import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.alert.model.AlertEntity; import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.alert.model.AlertNotificationEntity; import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.alert.repository.JpaAlertNotificationRepository; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.investigation.model.InvestigationEntity; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.investigation.model.InvestigationNotificationEntity; import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.NotificationSideBaseEntity; import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.NotificationStatusBaseEntity; import org.springframework.beans.factory.annotation.Autowired; @@ -33,107 +35,315 @@ import java.util.Collections; import java.util.List; +import static java.time.temporal.ChronoUnit.DAYS; import static org.assertj.core.api.Assertions.assertThat; @Component public class AlertNotificationsSupport { + private static final String OWN_BPN = "BPNL00000001OWN"; + private static final String OWN_BPN_COMPANY_NAME = "Car Company"; + private static final String OTHER_BPN = "BPNL00000002OTHER"; + private static final String OTHER_BPN_COMPANY_NAME = "Parts Company"; + @Autowired JpaAlertNotificationRepository jpaAlertNotificationRepository; public void defaultAlertsStored() { - Instant now = Instant.now(); - AlertEntity firstAlert = AlertEntity.builder() + storeCreatedAlerts(); + storeReceivedAlerts(); + } + + public AlertNotificationEntity storedAlertNotification(AlertNotificationEntity notification) { + return jpaAlertNotificationRepository.save(notification); + } + + public void storedAlertNotifications(AlertNotificationEntity... notifications) { + Arrays.stream(notifications).forEach(this::storedAlertNotification); + } + + public void assertAlertNotificationsSize(int size) { + List notifications = jpaAlertNotificationRepository.findAll(); + + assertThat(notifications).hasSize(size); + } + + private void storeCreatedAlerts() { + Instant now = Instant.parse("2023-10-10T10:10:10.00Z"); + + AlertEntity alert1 = AlertEntity.builder() .assets(Collections.emptyList()) - .bpn("BPNL00000003AXS3") + .bpn(OWN_BPN) .status(NotificationStatusBaseEntity.CREATED) .side(NotificationSideBaseEntity.SENDER) .description("1") - .createdDate(now.minusSeconds(10L)) + .createdDate(now.minus(3L, DAYS)) .build(); - AlertEntity secondAlert = AlertEntity.builder() + AlertEntity alert2 = AlertEntity.builder() .assets(Collections.emptyList()) - .bpn("BPNL00000003AXS3") - .status(NotificationStatusBaseEntity.CREATED) + .bpn(OWN_BPN) + .status(NotificationStatusBaseEntity.SENT) .description("2") .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(21L)) + .createdDate(now.minus(2L, DAYS)) + .updated(now.minus(2L, DAYS)) .build(); - AlertEntity thirdAlert = AlertEntity.builder() + AlertEntity alert3 = AlertEntity.builder() .assets(Collections.emptyList()) - .bpn("BPNL00000003AXS3") - .status(NotificationStatusBaseEntity.CREATED) + .bpn(OWN_BPN) + .status(NotificationStatusBaseEntity.RECEIVED) .description("3") .side(NotificationSideBaseEntity.SENDER) - .createdDate(now) + .createdDate(now.minus(1L, DAYS)) + .updated(now.minus(1L, DAYS)) .build(); - AlertEntity fourthAlert = AlertEntity.builder() + AlertEntity alert4 = AlertEntity.builder() .assets(Collections.emptyList()) - .bpn("BPNL00000003AXS3") - .status(NotificationStatusBaseEntity.CREATED) + .bpn(OWN_BPN) + .status(NotificationStatusBaseEntity.ACKNOWLEDGED) .description("4") .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.minus(2L, ChronoUnit.DAYS)) + .createdDate(now) + .updated(now) .build(); - AlertEntity fifthAlert = AlertEntity.builder() + AlertEntity alert5 = AlertEntity.builder() .assets(Collections.emptyList()) - .bpn("BPNL00000003AXS2") - .status(NotificationStatusBaseEntity.CREATED) + .bpn(OWN_BPN) + .status(NotificationStatusBaseEntity.ACCEPTED) + .acceptReason("Almighty demon king accepted this one") .description("5") - .side(NotificationSideBaseEntity.RECEIVER) - .createdDate(now.plusSeconds(40L)) + .side(NotificationSideBaseEntity.SENDER) + .createdDate(now) + .updated(now) + .build(); + AlertEntity alert6 = AlertEntity.builder() + .assets(Collections.emptyList()) + .bpn(OWN_BPN) + .status(NotificationStatusBaseEntity.DECLINED) + .declineReason("Almighty demon king has declined this one") + .description("6") + .side(NotificationSideBaseEntity.SENDER) + .createdDate(now.plus(1L, DAYS)) + .updated(now.plus(1L, DAYS)) + .build(); + AlertEntity alert7 = AlertEntity.builder() + .assets(Collections.emptyList()) + .bpn(OWN_BPN) + .status(NotificationStatusBaseEntity.CANCELED) + .description("7") + .side(NotificationSideBaseEntity.SENDER) + .createdDate(now.plus(2L, DAYS)) + .updated(now.plus(2L, DAYS)) + .build(); + AlertEntity alert8 = AlertEntity.builder() + .assets(Collections.emptyList()) + .bpn(OWN_BPN) + .status(NotificationStatusBaseEntity.CLOSED) + .description("8") + .closeReason("Almighty demon king has closed that one") + .side(NotificationSideBaseEntity.SENDER) + .createdDate(now.plus(3L, DAYS)) + .updated(now.plus(3L, DAYS)) .build(); storedAlertNotifications( AlertNotificationEntity .builder() .id("1") - .alert(firstAlert) + .alert(alert1) .status(NotificationStatusBaseEntity.CREATED) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a11") + .createdBy(OWN_BPN) + .createdByName(OWN_BPN_COMPANY_NAME) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a1") .build(), AlertNotificationEntity .builder() - .status(NotificationStatusBaseEntity.CREATED) + .createdBy(OWN_BPN) + .createdByName(OWN_BPN_COMPANY_NAME) + .status(NotificationStatusBaseEntity.SENT) .id("2") - .alert(secondAlert) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a22") + .alert(alert2) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a2") .build(), AlertNotificationEntity .builder() - .status(NotificationStatusBaseEntity.CREATED) + .status(NotificationStatusBaseEntity.RECEIVED) .id("3") - .alert(thirdAlert) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a33") + .createdBy(OTHER_BPN) + .createdByName(OTHER_BPN_COMPANY_NAME) + .alert(alert3) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a3") .build(), AlertNotificationEntity .builder() - .status(NotificationStatusBaseEntity.CREATED) + .status(NotificationStatusBaseEntity.ACKNOWLEDGED) .id("4") - .alert(fourthAlert) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a44") + .createdBy(OTHER_BPN) + .createdByName(OTHER_BPN_COMPANY_NAME) + .alert(alert4) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a4") .build(), AlertNotificationEntity .builder() - .status(NotificationStatusBaseEntity.CREATED) + .status(NotificationStatusBaseEntity.ACCEPTED) .id("5") - .alert(fifthAlert) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a55") + .createdBy(OTHER_BPN) + .createdByName(OTHER_BPN_COMPANY_NAME) + .alert(alert5) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a5") + .build(), + AlertNotificationEntity + .builder() + .status(NotificationStatusBaseEntity.DECLINED) + .id("6") + .createdBy(OTHER_BPN) + .createdByName(OTHER_BPN_COMPANY_NAME) + .alert(alert6) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a6") + .build(), + AlertNotificationEntity + .builder() + .status(NotificationStatusBaseEntity.CANCELED) + .id("7") + .createdBy(OWN_BPN) + .createdByName(OWN_BPN_COMPANY_NAME) + .alert(alert7) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a7") + .build(), + AlertNotificationEntity + .builder() + .status(NotificationStatusBaseEntity.CLOSED) + .id("8") + .createdBy(OWN_BPN) + .createdByName(OWN_BPN_COMPANY_NAME) + .alert(alert8) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a8") .build() ); } - public AlertNotificationEntity storedAlertNotification(AlertNotificationEntity notification) { - return jpaAlertNotificationRepository.save(notification); - } + private void storeReceivedAlerts() { + Instant now = Instant.parse("2023-10-10T10:10:10.00Z"); - public void storedAlertNotifications(AlertNotificationEntity... notifications) { - Arrays.stream(notifications).forEach(this::storedAlertNotification); + AlertEntity alert1 = AlertEntity.builder() + .assets(Collections.emptyList()) + .bpn(OTHER_BPN) + .status(NotificationStatusBaseEntity.RECEIVED) + .side(NotificationSideBaseEntity.RECEIVER) + .description("11") + .createdDate(now.minusSeconds(5L)) + .build(); + AlertEntity alert2 = AlertEntity.builder() + .assets(Collections.emptyList()) + .bpn(OTHER_BPN) + .status(NotificationStatusBaseEntity.ACKNOWLEDGED) + .description("22") + .side(NotificationSideBaseEntity.RECEIVER) + .createdDate(now.plusSeconds(2L)) + .build(); + AlertEntity alert3 = AlertEntity.builder() + .assets(Collections.emptyList()) + .bpn(OTHER_BPN) + .status(NotificationStatusBaseEntity.ACCEPTED) + .description("33") + .side(NotificationSideBaseEntity.RECEIVER) + .createdDate(now) + .build(); + AlertEntity alert4 = AlertEntity.builder() + .assets(Collections.emptyList()) + .bpn(OTHER_BPN) + .status(NotificationStatusBaseEntity.DECLINED) + .description("44") + .side(NotificationSideBaseEntity.RECEIVER) + .createdDate(now.plusSeconds(20L)) + .build(); + AlertEntity alert5 = AlertEntity.builder() + .assets(Collections.emptyList()) + .bpn(OTHER_BPN) + .status(NotificationStatusBaseEntity.CANCELED) + .description("55") + .side(NotificationSideBaseEntity.RECEIVER) + .createdDate(now.plusSeconds(40L)) + .build(); + AlertEntity alert6 = AlertEntity.builder() + .assets(Collections.emptyList()) + .bpn(OTHER_BPN) + .status(NotificationStatusBaseEntity.CLOSED) + .description("55") + .side(NotificationSideBaseEntity.RECEIVER) + .createdDate(now.plusSeconds(40L)) + .build(); + + storedAlertNotifications( + AlertNotificationEntity + .builder() + .id("11") + .alert(alert1) + .status(NotificationStatusBaseEntity.RECEIVED) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a11") + .build(), + AlertNotificationEntity + .builder() + .id("22") + .alert(alert2) + .status(NotificationStatusBaseEntity.ACKNOWLEDGED) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a22") + .build(), + AlertNotificationEntity + .builder() + .id("33") + .alert(alert3) + .status(NotificationStatusBaseEntity.ACCEPTED) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a33") + .build(), + AlertNotificationEntity + .builder() + .id("44") + .alert(alert4) + .status(NotificationStatusBaseEntity.DECLINED) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a44") + .build(), + AlertNotificationEntity + .builder() + .id("55") + .alert(alert5) + .status(NotificationStatusBaseEntity.CANCELED) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a55") + .build(), + AlertNotificationEntity + .builder() + .id("66") + .alert(alert6) + .status(NotificationStatusBaseEntity.CLOSED) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a66") + .build() + ); } - public void assertAlertNotificationsSize(int size) { - List notifications = jpaAlertNotificationRepository.findAll(); + public AlertNotificationEntity storeAlertNotification() { + Instant now = Instant.parse("2023-10-10T10:10:10.00Z"); - assertThat(notifications).hasSize(size); + AlertEntity alert = AlertEntity.builder() + .assets(Collections.emptyList()) + .bpn(OWN_BPN) + .status(NotificationStatusBaseEntity.SENT) + .description("2") + .side(NotificationSideBaseEntity.SENDER) + .createdDate(now.minus(2L, DAYS)) + .updated(now.minus(2L, DAYS)) + .build(); + AlertNotificationEntity notificationEntity = AlertNotificationEntity + .builder() + .status(NotificationStatusBaseEntity.SENT) + .id("1") + .createdBy(OWN_BPN) + .createdByName(OWN_BPN_COMPANY_NAME) + .sendTo(OTHER_BPN) + .sendToName(OTHER_BPN_COMPANY_NAME) + .alert(alert) + .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a1") + .build(); + storedAlertNotifications(notificationEntity); + return jpaAlertNotificationRepository.findById(notificationEntity.getId()).get(); } } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/AlertControllerFilterIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/AlertControllerFilterIT.java index cccd1cc548..f1ffff6dfc 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/AlertControllerFilterIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/AlertControllerFilterIT.java @@ -54,15 +54,15 @@ void givenAlerts_whenProvideNoFilter_thenReturnAll() throws JoseException { .statusCode(200) .body("page", Matchers.is(0)) .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(5)) - .body("totalItems", Matchers.is(5)); + .body("totalItems", Matchers.is(14)) + .body("content", Matchers.hasSize(10)); } @Test void givenAlerts_whenProvideBpnFilter_thenReturnExpectedResult() throws JoseException { // given alertNotificationsSupport.defaultAlertsStored(); - String filter = "?filter=bpn,STARTS_WITH,BPNL00000003AXS2,OR"; + String filter = "?filter=bpn,STARTS_WITH,BPNL00000001OWN,OR"; // when/then given() @@ -76,15 +76,15 @@ void givenAlerts_whenProvideBpnFilter_thenReturnExpectedResult() throws JoseExce .statusCode(200) .body("page", Matchers.is(0)) .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(1)) - .body("totalItems", Matchers.is(1)); + .body("content", Matchers.hasSize(8)) + .body("totalItems", Matchers.is(8)); } @Test void givenAlerts_whenProvideBpnFilterAnd_thenReturnExpectedResult() throws JoseException { // given alertNotificationsSupport.defaultAlertsStored(); - String filter = "?filter=bpn,STARTS_WITH,BPNL00000003AXS2,AND&filter=createdDate,AT_LOCAL_DATE," + LocalDate.now() + ",AND"; + String filter = "?filter=bpn,STARTS_WITH,BPNL00000001OWN,AND&filter=createdDate,AT_LOCAL_DATE,2023-10-10,AND"; // when/then given() @@ -98,7 +98,7 @@ void givenAlerts_whenProvideBpnFilterAnd_thenReturnExpectedResult() throws JoseE .statusCode(200) .body("page", Matchers.is(0)) .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(1)) - .body("totalItems", Matchers.is(1)); + .body("content", Matchers.hasSize(2)) + .body("totalItems", Matchers.is(2)); } } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/ReadAlertsControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/ReadAlertsControllerIT.java index 23f6c5393c..a7ec012ccd 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/ReadAlertsControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/alert/ReadAlertsControllerIT.java @@ -26,6 +26,8 @@ import org.eclipse.tractusx.traceability.integration.common.support.BpnSupport; import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.alert.model.AlertEntity; import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.alert.model.AlertNotificationEntity; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.investigation.model.InvestigationEntity; +import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.investigation.model.InvestigationNotificationEntity; import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.NotificationSideBaseEntity; import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.NotificationStatusBaseEntity; import org.hamcrest.Matchers; @@ -65,34 +67,24 @@ void shouldNotReturnAlertWithoutAuthentication() { } @Test - void shouldNotReturnCreatedAlertWithoutAuthentication() { + void shouldNotReturnAlertsWithoutAuthentication() { given() .contentType(ContentType.JSON) .when() - .get("/api/alerts/created") + .get("/api/alerts") .then() .statusCode(401); } - @Test - void shouldNotReturnReceivedAlertWithoutAuthentication() { - given() - .contentType(ContentType.JSON) - .when() - .get("/api/alerts/received") - .then() - .statusCode(401); - } @Test - void shouldReturnNoReceivedAlerts() throws JoseException { + void shouldReturnNoAlerts() throws JoseException { given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .param("page", "0") .param("size", "10") .contentType(ContentType.JSON) .when() - .param("filter", "side,EQUAL,RECEIVER,AND") .get("/api/alerts") .then() .statusCode(200) @@ -102,11 +94,13 @@ void shouldReturnNoReceivedAlerts() throws JoseException { } @Test - void shouldReturnNoCreatedAlerts() throws JoseException { + void givenAlerts_whenGetSenderAlertsSortedAsc_thenReturnProperlySorted() throws JoseException { // given String filterString = "side,EQUAL,SENDER,AND"; + String sortString = "createdDate,ASC"; + alertNotificationsSupport.defaultAlertsStored(); - // when/then + // then given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .param("page", "0") @@ -114,204 +108,25 @@ void shouldReturnNoCreatedAlerts() throws JoseException { .contentType(ContentType.JSON) .when() .param("filter", filterString) + .param("sort", sortString) .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(0)); - } - - @Test - void givenAlerts_whenGetAlerts_thenReturnSortedByCreationTime() throws JoseException { - // given - Instant now = Instant.now(); - String testBpn = bpnSupport.testBpn(); - - AlertEntity firstInvestigation = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .side(NotificationSideBaseEntity.SENDER) - .description("1") - .createdDate(now.minusSeconds(10L)) - .build(); - AlertEntity secondInvestigation = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("2") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(21L)) - .build(); - AlertEntity thirdInvestigation = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("3") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now) - .build(); - AlertEntity fourthInvestigation = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("4") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(20L)) - .build(); - AlertEntity fifthInvestigation = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("5") - .side(NotificationSideBaseEntity.RECEIVER) - .createdDate(now.plusSeconds(40L)) - .build(); - - alertNotificationsSupport.storedAlertNotifications( - AlertNotificationEntity - .builder() - .id("1") - .alert(firstInvestigation) - .status(NotificationStatusBaseEntity.CREATED) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - AlertNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("2") - .alert(secondInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - AlertNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("3") - .alert(thirdInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - AlertNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("4") - .alert(fourthInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - AlertNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("5") - .alert(fifthInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build() - ); - - // when/then - given() - .header(oAuth2Support.jwtAuthorization(ADMIN)) - .param("page", "0") - .param("size", "10") - .contentType(ContentType.JSON) - .when() - .param("filter", "side,EQUAL,SENDER,AND") - .get("/api/alerts") - .then() - .statusCode(200) - .body("page", Matchers.is(0)) - .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(4)) - .body("totalItems", Matchers.is(4)); + .body("totalItems", Matchers.is(8)) + .body("content", Matchers.hasSize(8)) + .body("content.description", Matchers.containsInRelativeOrder("1", "2", "3", "4", "5", "6", "7", "8")); } @Test - void givenSortByCreatedDateProvided_whenGetAlerts_thenReturnAlertsProperlySorted() throws JoseException { + void givenAlerts_whenGetSenderAlertsSortedDesc_thenReturnProperlySorted() throws JoseException { // given - String sortString = "createdDate,desc"; String filterString = "side,EQUAL,SENDER,AND"; - Instant now = Instant.now(); - String testBpn = bpnSupport.testBpn(); - - AlertEntity firstInvestigation = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .side(NotificationSideBaseEntity.SENDER) - .description("1") - .createdDate(now.minusSeconds(10L)) - .build(); - AlertEntity secondInvestigation = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("2") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(21L)) - .build(); - AlertEntity thirdInvestigation = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("3") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now) - .build(); - AlertEntity fourthInvestigation = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("4") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(20L)) - .build(); - AlertEntity fifthInvestigation = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("5") - .side(NotificationSideBaseEntity.RECEIVER) - .createdDate(now.plusSeconds(40L)) - .build(); - - - alertNotificationsSupport.storedAlertNotifications( - AlertNotificationEntity - .builder() - .id("1") - .alert(firstInvestigation) - .status(NotificationStatusBaseEntity.CREATED) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - AlertNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("2") - .alert(secondInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - AlertNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("3") - .alert(thirdInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - AlertNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("4") - .alert(fourthInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - AlertNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("5") - .alert(fifthInvestigation) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build() - ); + String sortString = "createdDate,DESC"; + alertNotificationsSupport.defaultAlertsStored(); + // then given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .param("page", "0") @@ -319,106 +134,26 @@ void givenSortByCreatedDateProvided_whenGetAlerts_thenReturnAlertsProperlySorted .contentType(ContentType.JSON) .when() .param("filter", filterString) - .param("page", 0) - .param("size", 10) .param("sort", sortString) .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(4)) - .body("totalItems", Matchers.is(4)); + .body("totalItems", Matchers.is(8)) + .body("content", Matchers.hasSize(8)) + .body("content.description", Matchers.containsInRelativeOrder("8", "7", "6", "5", "4", "3", "2", "1")); } + @Test - void givenSortByDescriptionProvided_whenGetAlerts_thenReturnAlertsProperlySorted() throws JoseException { + void givenSortByDescriptionProvided_whenGetInvestigations_thenReturnInvestigationsProperlySorted() throws JoseException { // given - String sortString = "description,desc"; - Instant now = Instant.now(); - String testBpn = bpnSupport.testBpn(); String filterString = "side,EQUAL,SENDER,AND"; + String sortString = "description,ASC"; + alertNotificationsSupport.defaultAlertsStored(); - AlertEntity firstAlert = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.SENT) - .side(NotificationSideBaseEntity.SENDER) - .description("1") - .createdDate(now.minusSeconds(10L)) - .build(); - AlertEntity secondAlert = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("2") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(21L)) - .build(); - AlertEntity thirdAlert = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CLOSED) - .description("3") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now) - .build(); - AlertEntity fourthAlert = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("4") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(20L)) - .build(); - AlertEntity fifthAlert = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.ACKNOWLEDGED) - .description("5") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(40L)) - .build(); - - - alertNotificationsSupport.storedAlertNotifications( - AlertNotificationEntity - .builder() - .id("1") - .alert(firstAlert) - .status(NotificationStatusBaseEntity.CREATED) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - AlertNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("2") - .alert(secondAlert) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - AlertNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("3") - .alert(thirdAlert) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - AlertNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("4") - .alert(fourthAlert) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - AlertNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("5") - .alert(fifthAlert) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build() - ); - + // then given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .param("page", "0") @@ -426,107 +161,25 @@ void givenSortByDescriptionProvided_whenGetAlerts_thenReturnAlertsProperlySorted .contentType(ContentType.JSON) .when() .param("filter", filterString) - .param("page", 0) - .param("size", 10) .param("sort", sortString) .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(5)) - .body("totalItems", Matchers.is(5)) - .body("content.description", Matchers.containsInRelativeOrder("5", "4", "3", "2", "1")); + .body("totalItems", Matchers.is(8)) + .body("content", Matchers.hasSize(8)) + .body("content.description", Matchers.containsInRelativeOrder("1", "2", "3", "4", "5", "6", "7", "8")); } @Test - void givenSortByStatusProvided_whenGetAlerts_thenReturnAlertsProperlySorted() throws JoseException { + void givenSortByStatusProvided_whenGetInvestigations_thenReturnInvestigationsProperlySorted() throws JoseException { // given String filterString = "side,EQUAL,SENDER,AND"; - String sortString = "status,asc"; - Instant now = Instant.now(); - String testBpn = bpnSupport.testBpn(); - - AlertEntity firstAlert = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.SENT) - .side(NotificationSideBaseEntity.SENDER) - .description("1") - .createdDate(now.minusSeconds(10L)) - .build(); - AlertEntity secondAlert = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("2") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(21L)) - .build(); - AlertEntity thirdAlert = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CLOSED) - .description("3") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now) - .build(); - AlertEntity fourthAlert = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("4") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(20L)) - .build(); - AlertEntity fifthAlert = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.ACKNOWLEDGED) - .description("5") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(40L)) - .build(); - - - alertNotificationsSupport.storedAlertNotifications( - AlertNotificationEntity - .builder() - .id("1") - .alert(firstAlert) - .status(NotificationStatusBaseEntity.CREATED) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - AlertNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("2") - .alert(secondAlert) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - AlertNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("3") - .alert(thirdAlert) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - AlertNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("4") - .alert(fourthAlert) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - AlertNotificationEntity - .builder() - .status(NotificationStatusBaseEntity.CREATED) - .id("5") - .alert(fifthAlert) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build() - ); + String sortString = "status,ASC"; + alertNotificationsSupport.defaultAlertsStored(); + // then given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .param("page", "0") @@ -534,24 +187,21 @@ void givenSortByStatusProvided_whenGetAlerts_thenReturnAlertsProperlySorted() th .contentType(ContentType.JSON) .when() .param("filter", filterString) - .param("page", 0) - .param("size", 10) .param("sort", sortString) .get("/api/alerts") .then() .statusCode(200) .body("page", Matchers.is(0)) .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(5)) - .body("totalItems", Matchers.is(5)) - .body("content.status", Matchers.containsInRelativeOrder("ACKNOWLEDGED", "CLOSED", "CREATED", "CREATED", "SENT")); + .body("totalItems", Matchers.is(8)) + .body("content", Matchers.hasSize(8)) + .body("content.status", Matchers.containsInRelativeOrder("ACCEPTED", "ACKNOWLEDGED", "CANCELED", "CLOSED", "CREATED", "DECLINED", "RECEIVED", "SENT")); } @Test - void givenInvalidSort_whenGetCreated_thenBadRequest() throws JoseException { + void givenInvalidSort_whenGet_thenBadRequest() throws JoseException { // given String sortString = "createdDate,failure"; - String filterString = "side,EQUAL,SENDER,AND"; // when/then given() @@ -560,7 +210,6 @@ void givenInvalidSort_whenGetCreated_thenBadRequest() throws JoseException { .param("size", "10") .contentType(ContentType.JSON) .when() - .param("filter", filterString) .param("page", 0) .param("size", 10) .param("sort", sortString) @@ -572,45 +221,6 @@ void givenInvalidSort_whenGetCreated_thenBadRequest() throws JoseException { )); } - @Test - void shouldReturnPagedCreatedAlerts() throws JoseException { - // given - String filterString = "side,EQUAL,SENDER,AND"; - Instant now = Instant.now(); - String testBpn = bpnSupport.testBpn(); - - IntStream.range(1, 101) - .forEach( - number -> { - alertsSupport.storedAlert( - AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now) - .build() - ); - } - ); - - // when/then - given() - .header(oAuth2Support.jwtAuthorization(ADMIN)) - .param("page", "2") - .param("size", "10") - .contentType(ContentType.JSON) - .when() - .param("filter", filterString) - .get("/api/alerts") - .then() - .statusCode(200) - .body("page", Matchers.is(2)) - .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(10)) - .body("totalItems", Matchers.is(100)); - } - @Test void shouldReturnProperlyPagedReceivedAlerts() throws JoseException { // given @@ -674,112 +284,6 @@ void shouldReturnProperlyPagedReceivedAlerts() throws JoseException { .body("totalItems", Matchers.is(100)); } - @Test - void shouldReturnReceivedAlertsSortedByCreationTime() throws JoseException { - // given - String sortString = "createdDate,desc"; - Instant now = Instant.now(); - String testBpn = bpnSupport.testBpn(); - - AlertEntity firstInvestigation = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.RECEIVED) - .side(NotificationSideBaseEntity.RECEIVER) - .description("1") - .createdDate(now.minusSeconds(5L)) - .build(); - AlertEntity secondInvestigation = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.RECEIVED) - .description("2") - .side(NotificationSideBaseEntity.RECEIVER) - .createdDate(now.plusSeconds(2L)) - .build(); - AlertEntity thirdInvestigation = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.RECEIVED) - .description("3") - .side(NotificationSideBaseEntity.RECEIVER) - .createdDate(now) - .build(); - AlertEntity fourthInvestigation = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.RECEIVED) - .description("4") - .side(NotificationSideBaseEntity.RECEIVER) - .createdDate(now.plusSeconds(20L)) - .build(); - AlertEntity fifthInvestigation = AlertEntity.builder() - .assets(Collections.emptyList()) - .bpn(testBpn) - .status(NotificationStatusBaseEntity.CREATED) - .description("5") - .side(NotificationSideBaseEntity.SENDER) - .createdDate(now.plusSeconds(40L)) - .build(); - - alertNotificationsSupport.storedAlertNotifications( - AlertNotificationEntity - .builder() - .id("1") - .alert(firstInvestigation) - .status(NotificationStatusBaseEntity.CREATED) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - AlertNotificationEntity - .builder() - .id("2") - .alert(secondInvestigation) - .status(NotificationStatusBaseEntity.CREATED) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - AlertNotificationEntity - .builder() - .id("3") - .alert(thirdInvestigation) - .status(NotificationStatusBaseEntity.CREATED) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - AlertNotificationEntity - .builder() - .id("4") - .alert(fourthInvestigation) - .status(NotificationStatusBaseEntity.CREATED) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build(), - AlertNotificationEntity - .builder() - .id("5") - .alert(fifthInvestigation) - .status(NotificationStatusBaseEntity.CREATED) - .edcNotificationId("cda2d956-fa91-4a75-bb4a-8e5ba39b268a") - .build() - ); - - // then - given() - .header(oAuth2Support.jwtAuthorization(ADMIN)) - .param("page", "0") - .param("size", "10") - .contentType(ContentType.JSON) - .when() - .param("filter", "side,EQUAL,RECEIVER,AND") - .param("sort", sortString) - .get("/api/alerts") - .then() - .statusCode(200) - .body("page", Matchers.is(0)) - .body("pageSize", Matchers.is(10)) - .body("content", Matchers.hasSize(4)) - .body("totalItems", Matchers.is(4)) - .body("content.description", Matchers.containsInRelativeOrder("4", "2", "3", "1")) - .body("content.createdDate", Matchers.hasItems(isIso8601DateTime())); - } - @Test void givenNoAlertId_whenGetAlertById_thenReturnNotFound() throws JoseException { given() @@ -791,62 +295,28 @@ void givenNoAlertId_whenGetAlertById_thenReturnNotFound() throws JoseException { .statusCode(404) .body("message", Matchers.is("Alert not found for 1234 id")); } - @Test - void shouldReturnAlertById() throws JoseException { + void shouldReturnInvestigationById() throws JoseException { // given - String testBpn = bpnSupport.testBpn(); - String senderBPN = "BPN0001"; - String senderName = "Sender name"; - String receiverBPN = "BPN0002"; - String receiverName = "Receiver name"; - - AlertEntity alertEntity = - AlertEntity - .builder() - .id(1L) - .assets(List.of()) - .bpn(testBpn) - .description("1") - .status(NotificationStatusBaseEntity.RECEIVED) - .side(NotificationSideBaseEntity.SENDER) - .createdDate(Instant.now()) - .build(); - - AlertEntity persistedAlert = alertsSupport.storedAlertFullObject(alertEntity); - - AlertNotificationEntity notificationEntity = alertNotificationsSupport.storedAlertNotification( - AlertNotificationEntity - .builder() - .id("1") - .alert(persistedAlert) - .createdBy(senderBPN) - .createdByName(senderName) - .sendTo(receiverBPN) - .status(NotificationStatusBaseEntity.CREATED) - .sendToName(receiverName) - .build()); - notificationEntity.setAlert(persistedAlert); - alertNotificationsSupport.storedAlertNotification(notificationEntity); - - Long alertId = persistedAlert.getId(); + AlertNotificationEntity storedAlertNotification = alertNotificationsSupport.storeAlertNotification(); + AlertEntity storedAlert = storedAlertNotification.getAlert(); // when/then given() .header(oAuth2Support.jwtAuthorization(ADMIN)) .contentType(ContentType.JSON) .when() - .get("/api/alerts/$alertId".replace("$alertId", alertId.toString())) + .get("/api/alerts/{alertId}", storedAlert.getId()) .then() .statusCode(200) - .body("id", Matchers.is(alertId.intValue())) - .body("status", Matchers.is("RECEIVED")) - .body("description", Matchers.is("1")) + .body("id", Matchers.is(storedAlert.getId().intValue())) + .body("status", Matchers.is(storedAlert.getStatus().name())) + .body("description", Matchers.is(storedAlert.getDescription())) .body("assetIds", Matchers.empty()) - .body("createdBy", Matchers.is(senderBPN)) - .body("createdByName", Matchers.is(senderName)) - .body("sendTo", Matchers.is(receiverBPN)) - .body("sendToName", Matchers.is(receiverName)) + .body("createdBy", Matchers.is(storedAlertNotification.getCreatedBy())) + .body("createdByName", Matchers.is(storedAlertNotification.getCreatedByName())) + .body("sendTo", Matchers.is(storedAlertNotification.getSendTo())) + .body("sendToName", Matchers.is(storedAlertNotification.getSendToName())) .body("createdDate", isIso8601DateTime()); } } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/ReadInvestigationsControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/ReadInvestigationsControllerIT.java index ba64c2b96c..f5ed616375 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/ReadInvestigationsControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/qualitynotification/investigation/ReadInvestigationsControllerIT.java @@ -196,7 +196,7 @@ void givenSortByStatusProvided_whenGetInvestigations_thenReturnInvestigationsPro } @Test - void givenInvalidSort_whenGetCreated_thenBadRequest() throws JoseException { + void givenInvalidSort_whenGet_thenBadRequest() throws JoseException { // given String sortString = "createdDate,failure"; From 239d01887fec95692017989e842eaa0b294aefc8 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Mon, 23 Oct 2023 09:30:22 +0200 Subject: [PATCH 07/27] chore: TRACEFOSS-2725 changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53a75d6f59..0ffee21b39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Changed Filter to support Logical operator (AND,OR) on searchCriteria ### Removed +- Removed &filterOperator=AND from filtering requests - Removed no longer needed endpoints api/investigations/created, api/investigations/received, api/alerts/created, api/alerts/received ## [8.0.0 - 16.10.2023] From 98198429738299121f8be4628a54e13ddbb523e8 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Mon, 23 Oct 2023 10:00:47 +0200 Subject: [PATCH 08/27] chore: TRACEFOSS-2725 changelog --- CHANGELOG.md | 2 + .../supplier-parts.component.html | 15 ++++--- .../supplier-parts.component.spec.ts | 36 ---------------- .../supplier-parts.component.ts | 42 +------------------ .../parts/presentation/parts.component.html | 1 - .../parts-table/parts-table.component.html | 4 +- .../table-settings.component.spec.ts | 3 +- .../components/table/table.component.html | 4 +- frontend/src/assets/locales/de/common.json | 1 + frontend/src/assets/locales/en/common.json | 1 + .../infrastructure/base/irs/IrsService.java | 7 +++- .../service/ShellDescriptorsServiceImpl.java | 25 ++++++++--- .../jpa/ShellDescriptorRepositoryImpl.java | 1 + 13 files changed, 42 insertions(+), 100 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ffee21b39..7330b5a0a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Changed - Updated user manual to reflect the table column settings feature +- Fixed a bug which removed all parts asBuilt selection at once when creating notifications - Changed Filter to support Logical operator (AND,OR) on searchCriteria +- Reworked business logic of /registry/reload to always sync all assets ### Removed - Removed &filterOperator=AND from filtering requests diff --git a/frontend/src/app/modules/page/other-parts/presentation/supplier-parts/supplier-parts.component.html b/frontend/src/app/modules/page/other-parts/presentation/supplier-parts/supplier-parts.component.html index 4692600434..3ec646914b 100644 --- a/frontend/src/app/modules/page/other-parts/presentation/supplier-parts/supplier-parts.component.html +++ b/frontend/src/app/modules/page/other-parts/presentation/supplier-parts/supplier-parts.component.html @@ -30,6 +30,7 @@ @@ -69,7 +69,6 @@ [labelId]="customContext.labelId" (selected)="onSelectItem($event)" (configChanged)="onAsPlannedTableConfigChange($event)" - (multiSelect)="onMultiSelect($event)" (clickSelectAction)="isInvestigationOpen$.next(true)" [multiSortList]="tableSupplierAsPlannedSortList" [multiSelectActive]="true" @@ -95,11 +94,11 @@ diff --git a/frontend/src/app/modules/page/other-parts/presentation/supplier-parts/supplier-parts.component.spec.ts b/frontend/src/app/modules/page/other-parts/presentation/supplier-parts/supplier-parts.component.spec.ts index b2c5495856..8134f71ad7 100644 --- a/frontend/src/app/modules/page/other-parts/presentation/supplier-parts/supplier-parts.component.spec.ts +++ b/frontend/src/app/modules/page/other-parts/presentation/supplier-parts/supplier-parts.component.spec.ts @@ -22,11 +22,9 @@ import { OtherPartsState } from '@page/other-parts/core/other-parts.state'; import { OtherPartsModule } from '@page/other-parts/other-parts.module'; import { PartsState } from '@page/parts/core/parts.state'; import { MainAspectType } from '@page/parts/model/mainAspectType.enum'; -import { PartsAssembler } from '@shared/assembler/parts.assembler'; import { toGlobalSearchAssetFilter } from '@shared/helper/filter-helper'; import { fireEvent, screen, waitFor } from '@testing-library/angular'; import { getTableCheckbox, renderComponent } from '@tests/test-render.utils'; -import { OTHER_PARTS_MOCK_6 } from '../../../../../mocks/services/otherParts-mock/otherParts.test.model'; import { SupplierPartsComponent } from './supplier-parts.component'; @@ -61,52 +59,18 @@ describe('SupplierPartsComponent', () => { it('should add item to current list and then remove', async () => { const { fixture } = await renderSupplierParts({ roles: [ 'user' ] }); - const expectedPart = PartsAssembler.assembleOtherPart(OTHER_PARTS_MOCK_6, MainAspectType.AS_BUILT); // first click to check checkbox fireEvent.click(await getTableCheckbox(screen, 0)); const selectedText_1 = await waitFor(() => screen.getByText('page.selectedParts.info')); expect(selectedText_1).toBeInTheDocument(); - expect(fixture.componentInstance.currentSelectedItems).toEqual([ expectedPart ]); // second click to uncheck checkbox fireEvent.click(await getTableCheckbox(screen, 0)); const selectedText_2 = await waitFor(() => screen.getByText('page.selectedParts.info')); expect(selectedText_2).toBeInTheDocument(); - expect(fixture.componentInstance.currentSelectedItems).toEqual([]); - }); - - it('test addItemToSelection method', async () => { - const { fixture } = await renderSupplierParts(); - - const expectedPart = PartsAssembler.assembleOtherPart(OTHER_PARTS_MOCK_6, MainAspectType.AS_BUILT); - - fixture.componentInstance.addItemToSelection(expectedPart); - expect(fixture.componentInstance.currentSelectedItems).toEqual([ expectedPart ]); - }); - - it('test removeItemFromSelection method', async () => { - const { fixture } = await renderSupplierParts(); - - const expectedPart = PartsAssembler.assembleOtherPart(OTHER_PARTS_MOCK_6, MainAspectType.AS_BUILT); - - fixture.componentInstance.currentSelectedItems = [ expectedPart ]; - - fixture.componentInstance.removeItemFromSelection(expectedPart); - expect(fixture.componentInstance.currentSelectedItems).toEqual([]); - }); - - it('test clearSelected method', async () => { - const { fixture } = await renderSupplierParts(); - - const expectedPart = PartsAssembler.assembleOtherPart(OTHER_PARTS_MOCK_6, MainAspectType.AS_BUILT); - - fixture.componentInstance.currentSelectedItems = [ expectedPart ]; - - fixture.componentInstance.clearSelected(); - expect(fixture.componentInstance.currentSelectedItems).toEqual([]); }); it('sort supplier parts after name column', async () => { diff --git a/frontend/src/app/modules/page/other-parts/presentation/supplier-parts/supplier-parts.component.ts b/frontend/src/app/modules/page/other-parts/presentation/supplier-parts/supplier-parts.component.ts index f1f9b15073..9d13278a56 100644 --- a/frontend/src/app/modules/page/other-parts/presentation/supplier-parts/supplier-parts.component.ts +++ b/frontend/src/app/modules/page/other-parts/presentation/supplier-parts/supplier-parts.component.ts @@ -22,7 +22,7 @@ import { Component, Input, OnDestroy, OnInit, QueryList, ViewChildren } from '@a import { Pagination } from '@core/model/pagination.model'; import { OtherPartsFacade } from '@page/other-parts/core/other-parts.facade'; import { MainAspectType } from '@page/parts/model/mainAspectType.enum'; -import { Part, SemanticDataModel } from '@page/parts/model/parts.model'; +import { Part } from '@page/parts/model/parts.model'; import { PartsTableComponent } from '@shared/components/parts-table/parts-table.component'; import { TableSortingUtil } from '@shared/components/table/table-sorting.util'; import { PartTableType, TableEventConfig, TableHeaderSort } from '@shared/components/table/table.model'; @@ -44,9 +44,9 @@ export class SupplierPartsComponent implements OnInit, OnDestroy { public readonly deselectPartTrigger$ = new Subject(); public readonly addPartTrigger$ = new Subject(); + public readonly currentSelectedItems$ = new BehaviorSubject([]); public readonly isInvestigationOpen$ = new BehaviorSubject(false); - public selectedItems: Array = []; public readonly supplierTabLabelId = this.staticIdService.generateId('OtherParts.supplierTabLabel'); @@ -74,21 +74,6 @@ export class SupplierPartsComponent implements OnInit, OnDestroy { }); } - public get currentSelectedItems(): Part[] { - - this.selectedItems = this.selectedItems.map(part => { - return { - ...part, - semanticDataModel: SemanticDataModel[part.semanticDataModel.toUpperCase() as keyof typeof SemanticDataModel], - }; - }); - return this.selectedItems || []; - } - - public set currentSelectedItems(parts: Part[]) { - this.selectedItems = parts; - } - public ngOnInit(): void { if (this.bomLifecycle === MainAspectType.AS_BUILT) { this.supplierPartsAsBuilt$ = this.otherPartsFacade.supplierPartsAsBuilt$; @@ -137,29 +122,6 @@ export class SupplierPartsComponent implements OnInit, OnDestroy { this.otherPartsFacade.setSupplierPartsAsPlanned(page, pageSize, this.tableSupplierAsPlannedSortList); } - public onMultiSelect(event: unknown[]): void { - this.currentSelectedItems = event as Part[]; - } - - public removeItemFromSelection(part: Part): void { - this.deselectPartTrigger$.next([ part ]); - this.currentSelectedItems = this.currentSelectedItems.filter(({ id }) => id !== part.id); - } - - public clearSelected(): void { - this.deselectPartTrigger$.next(this.currentSelectedItems); - this.currentSelectedItems = []; - } - - public addItemToSelection(part: Part): void { - this.addPartTrigger$.next(part); - this.currentSelectedItems = [ ...this.currentSelectedItems, part ]; - } - - public submit(): void { - this.isInvestigationOpen$.next(false); - } - private setTableSortingList(sorting: TableHeaderSort, partTable: MainAspectType): void { const tableSortList = partTable === MainAspectType.AS_BUILT ? this.tableSupplierAsBuiltSortList : this.tableSupplierAsPlannedSortList; diff --git a/frontend/src/app/modules/page/parts/presentation/parts.component.html b/frontend/src/app/modules/page/parts/presentation/parts.component.html index e75c998fe8..e81a5856c3 100644 --- a/frontend/src/app/modules/page/parts/presentation/parts.component.html +++ b/frontend/src/app/modules/page/parts/presentation/parts.component.html @@ -86,7 +86,6 @@ [addTrigger]="addPartTrigger$ | async" (selected)="onSelectItem($event)" (configChanged)="onAsPlannedTableConfigChange($event)" - (multiSelect)="currentSelectedItems$.next($event)" (clickSelectAction)="isAlertOpen$.next(true)" (filterActivated)="filterActivated(false, $event)" [multiSortList]="tableAsPlannedSortList" diff --git a/frontend/src/app/modules/shared/components/parts-table/parts-table.component.html b/frontend/src/app/modules/shared/components/parts-table/parts-table.component.html index 792425df72..cfdd69744e 100644 --- a/frontend/src/app/modules/shared/components/parts-table/parts-table.component.html +++ b/frontend/src/app/modules/shared/components/parts-table/parts-table.component.html @@ -159,9 +159,7 @@

{{ 'table.noResultFound' | i18n }}

{ }); tableSettingsServiceSpy.storeTableSettings.and.callFake((partTableType, tableSettingsList) => { - console.log(`Mocked setColumnVisibilitySettings called with partTableType: ${partTableType} and tableSettingsList:`, tableSettingsList); + return; }); TestBed.configureTestingModule({ @@ -102,7 +102,6 @@ describe('TableSettingsComponent', () => { }); it('should create the component', () => { - console.warn(component); expect(component).toBeTruthy(); }); diff --git a/frontend/src/app/modules/shared/components/table/table.component.html b/frontend/src/app/modules/shared/components/table/table.component.html index 047e5144cc..fe9f1d2ba3 100644 --- a/frontend/src/app/modules/shared/components/table/table.component.html +++ b/frontend/src/app/modules/shared/components/table/table.component.html @@ -188,9 +188,7 @@

{{ 'table.noResultFound' | i18n }}

findAssets(String globalAssetId, Direction direction, Lis JobStatus jobStatus = jobResponse.jobStatus(); long runtime = (jobStatus.lastModifiedOn().getTime() - jobStatus.startedOn().getTime()) / 1000; log.info("IRS call for globalAssetId: {} finished with status: {}, runtime {} s.", globalAssetId, jobStatus.state(), runtime); - + try { + log.info("Received HTTP Response: {}", objectMapper.writeValueAsString(jobResponse)); + } catch (Exception e) { + log.warn("Unable to log IRS Response", e); + } if (jobResponse.isCompleted()) { try { // TODO exception will be often thrown probably because two transactions try to commit same primary key - check if we need to update it here 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 f9937e6e7b..91a7c92b86 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 @@ -50,24 +50,37 @@ public List determineExistingShellDescriptorsAndUpdate(List existingDescriptors = shellDescriptorRepository.findAll().stream() .collect(Collectors.toMap(ShellDescriptor::getGlobalAssetId, Function.identity())); - List descriptorsToSync = new ArrayList<>(); + List newDescriptorsToSync = new ArrayList<>(); + List existingDescriptorsToUpdate = new ArrayList<>(); ZonedDateTime now = ZonedDateTime.now(); for (ShellDescriptor descriptor : ownShellDescriptors) { if (existingDescriptors.containsKey(descriptor.getGlobalAssetId())) { - shellDescriptorRepository.update(existingDescriptors.get(descriptor.getGlobalAssetId())); + existingDescriptorsToUpdate.add(existingDescriptors.get(descriptor.getGlobalAssetId())); log.info("Updated existing shellDescriptor with id {}.", descriptor.getGlobalAssetId()); } else { - descriptorsToSync.add((descriptor)); + newDescriptorsToSync.add((descriptor)); } } - log.info("Updated new shellDescriptors list size {}.", descriptorsToSync.size()); - descriptorsToSync.forEach(this::persistDescriptor); + log.info("Added new shellDescriptors list size {}.", newDescriptorsToSync.size()); + newDescriptorsToSync.forEach(this::persistDescriptor); + existingDescriptorsToUpdate.forEach(this::updateDescriptor); shellDescriptorRepository.removeDescriptorsByUpdatedBefore(now); log.info("Finished update of {} shell descriptors.", ownShellDescriptors.size()); - return descriptorsToSync; + //Merge those two lists to sync all relevant shell descriptors + newDescriptorsToSync.addAll(existingDescriptorsToUpdate); + return newDescriptorsToSync; + } + + private void updateDescriptor(ShellDescriptor shellDescriptor) { + try { + shellDescriptorRepository.update(shellDescriptor); + } catch (DataIntegrityViolationException exception) { + log.warn("Failed to persist shellDescriptor with Id: {} With cause: {}", shellDescriptor.getId(), exception.getMessage()); + } + } private void persistDescriptor(ShellDescriptor shellDescriptor){ diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/shelldescriptor/infrastructure/repository/jpa/ShellDescriptorRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/shelldescriptor/infrastructure/repository/jpa/ShellDescriptorRepositoryImpl.java index e1be9ddb9d..9f9515a0ac 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/shelldescriptor/infrastructure/repository/jpa/ShellDescriptorRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/shelldescriptor/infrastructure/repository/jpa/ShellDescriptorRepositoryImpl.java @@ -62,6 +62,7 @@ public void saveAll(Collection values) { } @Override + @Transactional public void save(ShellDescriptor descriptor) { repository.save(ShellDescriptorEntity.newEntityFrom(descriptor)); } From 012cc522b907c4eaa8f4dfd8f9af7ba6303d8044 Mon Sep 17 00:00:00 2001 From: ds-mmaul <117836305+ds-mmaul@users.noreply.github.com> Date: Mon, 23 Oct 2023 14:47:15 +0200 Subject: [PATCH 09/27] Chore/tracefoss 2731 fix translations and part selection (#689) * feature(table):[TRACEFOSS-2731] fixed translation --- frontend/src/assets/locales/de/common.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/assets/locales/de/common.json b/frontend/src/assets/locales/de/common.json index 997e29fa4d..88513ff703 100644 --- a/frontend/src/assets/locales/de/common.json +++ b/frontend/src/assets/locales/de/common.json @@ -57,7 +57,7 @@ "menuDescription": "Aktionsmenü", "clearPage": "Markierungen auf dieser Seite aufheben", "clearAll": "Alle Markierungen aufheben", - "multiSortingToolTip": "Erster Klick: aufsteigend sortieren ↑ Zweiter Klick: absteigend sortieren ↓ Dritter Klick: Sortierung zurücksetzen", + "multiSortingTooltip": "Erster Klick: aufsteigend sortieren ↑ Zweiter Klick: absteigend sortieren ↓ Dritter Klick: Sortierung zurücksetzen", "filterTitle" : "Filter", "tableSettings": { "title": "Tabellenspalten Einstellungen", From eb2b3914d7b6c9dc83fc3c3b038a2f78a06cde81 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Mon, 23 Oct 2023 15:00:21 +0200 Subject: [PATCH 10/27] chore: TRACEFOSS-2725 add logger info on new endpoints call for debugging purpouses --- .../application/alert/rest/AlertController.java | 1 + .../application/investigation/rest/InvestigationsController.java | 1 + 2 files changed, 2 insertions(+) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/rest/AlertController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/rest/AlertController.java index 86ca6e7184..f78e80cba0 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/rest/AlertController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/rest/AlertController.java @@ -181,6 +181,7 @@ public QualityNotificationIdResponse alertAssets(@RequestBody @Valid StartQualit schema = @Schema(implementation = ErrorResponse.class)))}) @GetMapping("") public PageResult getAlerts(OwnPageable pageable, SearchCriteriaRequestParam filter) { + log.info(API_LOG_START); return AlertResponseMapper.fromAsPageResult(alertService.getNotifications(OwnPageable.toPageable(pageable), filter.toSearchCriteria())); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/investigation/rest/InvestigationsController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/investigation/rest/InvestigationsController.java index 9f70efc90a..a008d72f5f 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/investigation/rest/InvestigationsController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/investigation/rest/InvestigationsController.java @@ -182,6 +182,7 @@ public QualityNotificationIdResponse investigateAssets(@RequestBody @Valid Start schema = @Schema(implementation = ErrorResponse.class)))}) @GetMapping("") public PageResult getInvestigations(OwnPageable pageable, SearchCriteriaRequestParam filter) { + log.info(API_LOG_START); return InvestigationResponseMapper.fromAsPageResult(investigationService.getNotifications(OwnPageable.toPageable(pageable), filter.toSearchCriteria())); } From 63b9ffb159cbf2f43207385571504af999d01942 Mon Sep 17 00:00:00 2001 From: Martin Maul Date: Mon, 23 Oct 2023 16:40:00 +0200 Subject: [PATCH 11/27] chore(filter):[TRACEFOSS-2725] implement new filter approach --- .../other-parts/core/other-parts.service.ts | 17 +++---- .../shared/helper/filter-helper.spec.ts | 4 +- .../modules/shared/helper/filter-helper.ts | 20 ++++----- .../modules/shared/service/parts.service.ts | 44 +++++++++---------- 4 files changed, 42 insertions(+), 43 deletions(-) diff --git a/frontend/src/app/modules/page/other-parts/core/other-parts.service.ts b/frontend/src/app/modules/page/other-parts/core/other-parts.service.ts index dfd8ff1903..986a5c2afc 100644 --- a/frontend/src/app/modules/page/other-parts/core/other-parts.service.ts +++ b/frontend/src/app/modules/page/other-parts/core/other-parts.service.ts @@ -43,14 +43,15 @@ export class OtherPartsService { public getOtherPartsAsBuilt(page: number, pageSize: number, sorting: TableHeaderSort[], owner: Owner, filter?: AssetAsBuiltFilter, isOrSearch?: boolean): Observable> { let sort = sorting.map(sortingItem => PartsAssembler.mapSortToApiSort(sortingItem)); - let params = this.buildHttpParams(page, pageSize, isOrSearch, owner); + let params = this.buildHttpParams(page, pageSize, owner); + let filterOperator = isOrSearch? "OR":"AND"; sort.forEach(sortingItem => { params = params.append('sort', sortingItem); }); if (filter) { - params = enrichFilterAndGetUpdatedParams(filter, params); + params = enrichFilterAndGetUpdatedParams(filter, params, filterOperator); } return this.apiService .getBy(`${ this.url }/assets/as-built`, params) @@ -61,13 +62,15 @@ export class OtherPartsService { let sort = sorting.map(sortingItem => PartsAssembler.mapSortToApiSort(sortingItem)); - let params = this.buildHttpParams(page, pageSize, isOrSearch, owner); + let params = this.buildHttpParams(page, pageSize, owner); + let filterOperator = isOrSearch? "OR":"AND"; + sort.forEach(sortingItem => { params = params.append('sort', sortingItem); }); if (filter) { - params = enrichFilterAndGetUpdatedParams(filter, params); + params = enrichFilterAndGetUpdatedParams(filter, params, filterOperator); } return this.apiService @@ -75,13 +78,11 @@ export class OtherPartsService { .pipe(map(parts => PartsAssembler.assembleOtherParts(parts, MainAspectType.AS_PLANNED))); } - private buildHttpParams(page: number, pageSize: number, isOrSearch: boolean, owner: Owner): HttpParams{ - let filterOperator = isOrSearch ? 'OR' : 'AND'; + private buildHttpParams(page: number, pageSize: number, owner: Owner): HttpParams{ return new HttpParams() .set('page', page) .set('size', pageSize) - .set('filterOperator', filterOperator) - .set('filter', 'owner,EQUAL,' + owner); + .set('filter', 'owner,EQUAL,' + owner + ',AND'); } } diff --git a/frontend/src/app/modules/shared/helper/filter-helper.spec.ts b/frontend/src/app/modules/shared/helper/filter-helper.spec.ts index 36e58d0fd4..0f02925e1d 100644 --- a/frontend/src/app/modules/shared/helper/filter-helper.spec.ts +++ b/frontend/src/app/modules/shared/helper/filter-helper.spec.ts @@ -18,7 +18,7 @@ ********************************************************************************/ import { HttpParams } from '@angular/common/http'; -import { enrichFilterAndGetUpdatedParams } from './filter-helper' +import { enrichFilterAndGetUpdatedParams } from './filter-helper'; describe('enrichFilterAndGetUpdatedParams', () => { it('should append filter parameters for non-date filters', () => { @@ -53,7 +53,7 @@ describe('enrichFilterAndGetUpdatedParams', () => { semanticDataModel: ['value1', 'value2'], }; const params = new HttpParams(); - const result = enrichFilterAndGetUpdatedParams(filter, params); + const result = enrichFilterAndGetUpdatedParams(filter, params, "OR"); expect(result.toString()).toContain('filter=semanticDataModel,EQUAL,value1'); expect(result.toString()).toContain('filter=semanticDataModel,EQUAL,value2'); }); diff --git a/frontend/src/app/modules/shared/helper/filter-helper.ts b/frontend/src/app/modules/shared/helper/filter-helper.ts index d65322992d..e86d655c13 100644 --- a/frontend/src/app/modules/shared/helper/filter-helper.ts +++ b/frontend/src/app/modules/shared/helper/filter-helper.ts @@ -16,17 +16,17 @@ * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +import { HttpParams } from '@angular/common/http'; import { - AssetAsBuiltFilter, - AssetAsPlannedFilter, - FilterOperator, - getFilterOperatorValue -} from "@page/parts/model/parts.model"; -import {HttpParams} from "@angular/common/http"; + AssetAsBuiltFilter, + AssetAsPlannedFilter, + FilterOperator, + getFilterOperatorValue, +} from '@page/parts/model/parts.model'; export const FILTER_KEYS = ['manufacturingDate', 'functionValidFrom', 'functionValidUntil', 'validityPeriodFrom', 'validityPeriodTo']; -export function enrichFilterAndGetUpdatedParams(filter: AssetAsBuiltFilter, params: HttpParams): HttpParams { +export function enrichFilterAndGetUpdatedParams(filter: AssetAsBuiltFilter, params: HttpParams, filterOperator: string): HttpParams { const semanticDataModelKey = "semanticDataModel"; for (const key in filter) { let operator: string; @@ -38,16 +38,16 @@ export function enrichFilterAndGetUpdatedParams(filter: AssetAsBuiltFilter, para } else { operator = getFilterOperatorValue(FilterOperator.STARTS_WITH); } - params = params.append('filter', `${key},${operator},${filterValues}`); + params = params.append('filter', `${key},${operator},${filterValues},${filterOperator}`); } } else { operator = getFilterOperatorValue(FilterOperator.EQUAL); if (Array.isArray(filterValues)) { for (let value of filterValues) { - params = params.append('filter', `${key},${operator},${value}`); + params = params.append('filter', `${key},${operator},${value},${filterOperator}`); } } else { - params = params.append('filter', `${key},${operator},${filterValues}`); + params = params.append('filter', `${key},${operator},${filterValues},${filterOperator}`); } } diff --git a/frontend/src/app/modules/shared/service/parts.service.ts b/frontend/src/app/modules/shared/service/parts.service.ts index d4757e8531..c3d4bb8740 100644 --- a/frontend/src/app/modules/shared/service/parts.service.ts +++ b/frontend/src/app/modules/shared/service/parts.service.ts @@ -19,26 +19,26 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -import {HttpParams} from '@angular/common/http'; -import {Injectable} from '@angular/core'; -import {ApiService} from '@core/api/api.service'; -import {Pagination} from '@core/model/pagination.model'; -import {environment} from '@env'; -import {MainAspectType} from '@page/parts/model/mainAspectType.enum'; +import { HttpParams } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { ApiService } from '@core/api/api.service'; +import { Pagination } from '@core/model/pagination.model'; +import { environment } from '@env'; +import { MainAspectType } from '@page/parts/model/mainAspectType.enum'; import { - AssetAsBuiltFilter, - AssetAsPlannedFilter, - Part, - PartResponse, - PartsResponse + AssetAsBuiltFilter, + AssetAsPlannedFilter, + Part, + PartResponse, + PartsResponse, } from '@page/parts/model/parts.model'; -import {PartsAssembler} from '@shared/assembler/parts.assembler'; -import {TableHeaderSort} from '@shared/components/table/table.model'; +import { PartsAssembler } from '@shared/assembler/parts.assembler'; +import { TableHeaderSort } from '@shared/components/table/table.model'; +import { enrichFilterAndGetUpdatedParams } from '@shared/helper/filter-helper'; import _deepClone from 'lodash-es/cloneDeep'; -import {Observable} from 'rxjs'; -import {map} from 'rxjs/operators'; -import {SortDirection} from '../../../mocks/services/pagination.helper'; -import {enrichFilterAndGetUpdatedParams} from "@shared/helper/filter-helper"; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; +import { SortDirection } from '../../../mocks/services/pagination.helper'; @Injectable() export class PartsService { @@ -55,14 +55,13 @@ export class PartsService { let params = new HttpParams() .set('page', page) .set('size', pageSize) - .set('filter', 'owner,EQUAL,OWN') - .set('filterOperator', filterOperator); + .set('filter', "owner,EQUAL,OWN,AND") sort.forEach(sortingItem => { params = params.append('sort', sortingItem); }) if (assetAsBuiltFilter) { - params = enrichFilterAndGetUpdatedParams(assetAsBuiltFilter, params); + params = enrichFilterAndGetUpdatedParams(assetAsBuiltFilter, params, filterOperator); } return this.apiService @@ -77,15 +76,14 @@ export class PartsService { let params = new HttpParams() .set('page', page) .set('size', pageSize) - .set('filter', 'owner,EQUAL,OWN') - .set('filterOperator', filterOperator); + .set('filter', "owner,EQUAL,OWN,AND") sort.forEach(sortingItem => { params = params.append('sort', sortingItem); }) if (assetAsPlannedFilter) { - params = enrichFilterAndGetUpdatedParams(assetAsPlannedFilter, params); + params = enrichFilterAndGetUpdatedParams(assetAsPlannedFilter, params, filterOperator); } return this.apiService From 7d435889ab54b7186dc8e2c85d08c1012fe49e97 Mon Sep 17 00:00:00 2001 From: Martin Maul Date: Mon, 23 Oct 2023 16:52:38 +0200 Subject: [PATCH 12/27] chore(filter):[TRACEFOSS-2725] implement new filter approach --- .../otherParts-mock/otherParts.handler.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/frontend/src/app/mocks/services/otherParts-mock/otherParts.handler.ts b/frontend/src/app/mocks/services/otherParts-mock/otherParts.handler.ts index ef86b24479..a6efb6580f 100644 --- a/frontend/src/app/mocks/services/otherParts-mock/otherParts.handler.ts +++ b/frontend/src/app/mocks/services/otherParts-mock/otherParts.handler.ts @@ -30,12 +30,11 @@ export const otherPartsAsBuiltHandlers = [ rest.get(`*${environment.apiUrl}/assets/as-built`, (req, res, ctx) => { const pagination = extractPagination(req); const ownerSearchQuery = req.url.searchParams.get('filter').replace("owner,EQUAL,", ""); - switch (ownerSearchQuery) { - case 'SUPPLIER': + case 'SUPPLIER,AND': return res(ctx.status(200), ctx.json(mockSupplierAssets)); - case 'CUSTOMER': + case 'CUSTOMER,AND': return res(ctx.status(200), ctx.json(mockCustomerAssets)); } @@ -47,10 +46,10 @@ export const otherPartsAsBuiltHandlersTest = [ const owner = req.url.searchParams.get('filter').replace("owner,EQUAL,", ""); switch (owner) { - case 'SUPPLIER': + case 'SUPPLIER,AND': return res(ctx.status(200), ctx.json(mockSupplierAssets)); - case 'CUSTOMER': + case 'CUSTOMER,AND': return res(ctx.status(200), ctx.json(mockCustomerAssets)); } @@ -63,10 +62,10 @@ export const otherPartsAsPlannedHandlers = [ const owner = req.url.searchParams.get('filter').replace("owner,EQUAL,", ""); switch (owner) { - case 'SUPPLIER': + case 'SUPPLIER,AND': return res(ctx.status(200), ctx.json(applyPagination(supplierPartsAsPlannedAssets, pagination))); - case 'CUSTOMER': + case 'CUSTOMER,AND': return res(ctx.status(200), ctx.json(applyPagination(customerPartsAsPlannedModel, pagination))); } @@ -79,10 +78,10 @@ export const otherPartsAsPlannedHandlersTest = [ const owner = req.url.searchParams.get('filter').replace("owner,EQUAL,", ""); switch (owner) { - case 'SUPPLIER': + case 'SUPPLIER,AND': return res(ctx.status(200), ctx.json(supplierPartsAsPlannedAssets)); - case 'CUSTOMER': + case 'CUSTOMER,AND': return res(ctx.status(200), ctx.json(applyPagination(customerPartsAsPlannedModel, pagination))); } From 264332eb0b5cfeeddf46e89321efdd511d95c20a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 15:02:55 +0000 Subject: [PATCH 13/27] chore(deps): Bump @babel/traverse from 7.20.13 to 7.23.2 in /frontend Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.20.13 to 7.23.2. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse) --- updated-dependencies: - dependency-name: "@babel/traverse" dependency-type: indirect ... Signed-off-by: dependabot[bot] --- frontend/yarn.lock | 133 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 102 insertions(+), 31 deletions(-) diff --git a/frontend/yarn.lock b/frontend/yarn.lock index c75ff258a1..aa14aa159e 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -422,6 +422,14 @@ dependencies: "@babel/highlight" "^7.16.7" +"@babel/code-frame@^7.22.13": + version "7.22.13" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.13.tgz#e3c1c099402598483b7a8c46a721d1038803755e" + integrity sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w== + dependencies: + "@babel/highlight" "^7.22.13" + chalk "^2.4.2" + "@babel/compat-data@^7.17.7", "@babel/compat-data@^7.20.1", "@babel/compat-data@^7.20.5", "@babel/compat-data@^7.21.5": version "7.21.7" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.21.7.tgz#61caffb60776e49a57ba61a88f02bedd8714f6bc" @@ -509,6 +517,16 @@ "@jridgewell/trace-mapping" "^0.3.17" jsesc "^2.5.1" +"@babel/generator@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.0.tgz#df5c386e2218be505b34837acbcb874d7a983420" + integrity sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g== + dependencies: + "@babel/types" "^7.23.0" + "@jridgewell/gen-mapping" "^0.3.2" + "@jridgewell/trace-mapping" "^0.3.17" + jsesc "^2.5.1" + "@babel/helper-annotate-as-pure@7.18.6", "@babel/helper-annotate-as-pure@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.18.6.tgz#eaa49f6f80d5a33f9a5dd2276e6d6e451be0a6bb" @@ -586,6 +604,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.21.5.tgz#c769afefd41d171836f7cb63e295bedf689d48ba" integrity sha512-IYl4gZ3ETsWocUWgsFZLM5i1BYx9SoemminVEXadgLBa9TdeorzgLKm8wWLA6J1N/kT3Kch8XIk1laNzYoHKvQ== +"@babel/helper-environment-visitor@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167" + integrity sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA== + "@babel/helper-function-name@^7.18.9", "@babel/helper-function-name@^7.19.0", "@babel/helper-function-name@^7.21.0": version "7.21.0" resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz#d552829b10ea9f120969304023cd0645fa00b1b4" @@ -594,6 +617,14 @@ "@babel/template" "^7.20.7" "@babel/types" "^7.21.0" +"@babel/helper-function-name@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759" + integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw== + dependencies: + "@babel/template" "^7.22.15" + "@babel/types" "^7.23.0" + "@babel/helper-hoist-variables@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz#d4d2c8fb4baeaa5c68b99cc8245c56554f926678" @@ -601,6 +632,13 @@ dependencies: "@babel/types" "^7.18.6" +"@babel/helper-hoist-variables@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb" + integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw== + dependencies: + "@babel/types" "^7.22.5" + "@babel/helper-member-expression-to-functions@^7.21.5": version "7.21.5" resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.21.5.tgz#3b1a009af932e586af77c1030fba9ee0bde396c0" @@ -698,16 +736,33 @@ dependencies: "@babel/types" "^7.18.6" +"@babel/helper-split-export-declaration@^7.22.6": + version "7.22.6" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c" + integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g== + dependencies: + "@babel/types" "^7.22.5" + "@babel/helper-string-parser@^7.19.4", "@babel/helper-string-parser@^7.21.5": version "7.21.5" resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.21.5.tgz#2b3eea65443c6bdc31c22d037c65f6d323b6b2bd" integrity sha512-5pTUx3hAJaZIdW99sJ6ZUUgWq/Y+Hja7TowEnLNMm1VivRgZQL3vpBY3qUACVsvw+yQU6+YgfBVmcbLaZtrA1w== +"@babel/helper-string-parser@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f" + integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw== + "@babel/helper-validator-identifier@^7.18.6", "@babel/helper-validator-identifier@^7.19.1": version "7.19.1" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w== +"@babel/helper-validator-identifier@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" + integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== + "@babel/helper-validator-option@^7.18.6", "@babel/helper-validator-option@^7.21.0": version "7.21.0" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz#8224c7e13ace4bafdc4004da2cf064ef42673180" @@ -750,7 +805,16 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.14.7", "@babel/parser@^7.20.13", "@babel/parser@^7.20.7", "@babel/parser@^7.21.5", "@babel/parser@^7.21.8": +"@babel/highlight@^7.22.13": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.20.tgz#4ca92b71d80554b01427815e06f2df965b9c1f54" + integrity sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg== + dependencies: + "@babel/helper-validator-identifier" "^7.22.20" + chalk "^2.4.2" + js-tokens "^4.0.0" + +"@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.21.8": version "7.21.8" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.21.8.tgz#642af7d0333eab9c0ad70b14ac5e76dbde7bfdf8" integrity sha512-6zavDGdzG3gUqAdWvlLFfk+36RilI+Pwyuuh7HItyeScCWP3k6i8vKclAQ0bM/0y/Kz/xiwvxhMv9MgTJP5gmA== @@ -765,6 +829,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.15.tgz#eec9f36d8eaf0948bb88c87a46784b5ee9fd0c89" integrity sha512-DI4a1oZuf8wC+oAJA9RW6ga3Zbe8RZFt7kD9i4qAspz3I/yHet1VvC3DiSy/fsUvv5pvJuNPh0LPOdCcqinDPg== +"@babel/parser@^7.22.15", "@babel/parser@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.0.tgz#da950e622420bf96ca0d0f2909cdddac3acd8719" + integrity sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw== + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.18.6.tgz#da5b8f9a580acdfbe53494dba45ea389fb09a4d2" @@ -1412,35 +1481,28 @@ "@babel/parser" "^7.20.7" "@babel/types" "^7.20.7" -"@babel/traverse@^7.19.3": - version "7.20.13" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.20.13.tgz#817c1ba13d11accca89478bd5481b2d168d07473" - integrity sha512-kMJXfF0T6DIS9E8cgdLCSAL+cuCK+YEZHWiLK0SXpTo8YRj5lpJu3CDNKiIBCne4m9hhTIqUg6SYTAI39tAiVQ== - dependencies: - "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.20.7" - "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-function-name" "^7.19.0" - "@babel/helper-hoist-variables" "^7.18.6" - "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/parser" "^7.20.13" - "@babel/types" "^7.20.7" - debug "^4.1.0" - globals "^11.1.0" - -"@babel/traverse@^7.20.10", "@babel/traverse@^7.20.12", "@babel/traverse@^7.20.13", "@babel/traverse@^7.20.5", "@babel/traverse@^7.21.5": - version "7.21.5" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.21.5.tgz#ad22361d352a5154b498299d523cf72998a4b133" - integrity sha512-AhQoI3YjWi6u/y/ntv7k48mcrCXmus0t79J9qPNlk/lAsFlCiJ047RmbfMOawySTHtywXhbXgpx/8nXMYd+oFw== - dependencies: - "@babel/code-frame" "^7.21.4" - "@babel/generator" "^7.21.5" - "@babel/helper-environment-visitor" "^7.21.5" - "@babel/helper-function-name" "^7.21.0" - "@babel/helper-hoist-variables" "^7.18.6" - "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/parser" "^7.21.5" - "@babel/types" "^7.21.5" +"@babel/template@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38" + integrity sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w== + dependencies: + "@babel/code-frame" "^7.22.13" + "@babel/parser" "^7.22.15" + "@babel/types" "^7.22.15" + +"@babel/traverse@^7.19.3", "@babel/traverse@^7.20.10", "@babel/traverse@^7.20.12", "@babel/traverse@^7.20.13", "@babel/traverse@^7.20.5", "@babel/traverse@^7.21.5": + version "7.23.2" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.2.tgz#329c7a06735e144a506bdb2cad0268b7f46f4ad8" + integrity sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw== + dependencies: + "@babel/code-frame" "^7.22.13" + "@babel/generator" "^7.23.0" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-hoist-variables" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/parser" "^7.23.0" + "@babel/types" "^7.23.0" debug "^4.1.0" globals "^11.1.0" @@ -1462,6 +1524,15 @@ "@babel/helper-validator-identifier" "^7.19.1" to-fast-properties "^2.0.0" +"@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.0.tgz#8c1f020c9df0e737e4e247c0619f58c68458aaeb" + integrity sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg== + dependencies: + "@babel/helper-string-parser" "^7.22.5" + "@babel/helper-validator-identifier" "^7.22.20" + to-fast-properties "^2.0.0" + "@badeball/cypress-configuration@^5.0.0": version "5.0.0" resolved "https://registry.yarnpkg.com/@badeball/cypress-configuration/-/cypress-configuration-5.0.0.tgz#e4f19183d0a757e3e9965eca4cd1fb63c05f46b3" @@ -4608,7 +4679,7 @@ chalk@5.2.0: resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.2.0.tgz#249623b7d66869c673699fb66d65723e54dfcfb3" integrity sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA== -chalk@^2.0.0: +chalk@^2.0.0, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== From 008acd852f95ba2594f6a5c65c3f61edddaff836 Mon Sep 17 00:00:00 2001 From: Martin Maul Date: Mon, 23 Oct 2023 17:14:47 +0200 Subject: [PATCH 14/27] chore(filter):[TRACEFOSS-2725] implement new filter approach --- .../src/app/mocks/services/alerts-mock/alerts.handler.ts | 8 ++++---- .../investigations-mock/investigations.handler.ts | 8 ++++---- frontend/src/app/modules/shared/service/alerts.service.ts | 6 ++++-- .../app/modules/shared/service/investigations.service.ts | 6 ++++-- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/frontend/src/app/mocks/services/alerts-mock/alerts.handler.ts b/frontend/src/app/mocks/services/alerts-mock/alerts.handler.ts index 49c5bab754..67ae6deac8 100644 --- a/frontend/src/app/mocks/services/alerts-mock/alerts.handler.ts +++ b/frontend/src/app/mocks/services/alerts-mock/alerts.handler.ts @@ -49,7 +49,7 @@ const commonHandler = [ ]; export const alertsHandlers = [ - rest.get(`*${environment.apiUrl}/alerts/created`, (req, res, ctx) => { + rest.get(`*${environment.apiUrl}/alerts`, (req, res, ctx) => { const pagination = extractPagination(req); const currentStatus = [ @@ -65,7 +65,7 @@ export const alertsHandlers = [ return res(ctx.status(200), ctx.json(applyPagination(buildMockAlerts(currentStatus, 'SENDER'), pagination))); }), - rest.get(`*${environment.apiUrl}/alerts/received`, (req, res, ctx) => { + rest.get(`*${environment.apiUrl}/alerts`, (req, res, ctx) => { const pagination = extractPagination(req); const currentStatus = [ @@ -120,7 +120,7 @@ export const alertsHandlers = [ ]; export const alertsTestHandlers = [ - rest.get(`*${environment.apiUrl}/alerts/created`, (req, res, ctx) => { + rest.get(`*${environment.apiUrl}/alerts`, (req, res, ctx) => { const pagination = extractPagination(req); const currentStatus = [ @@ -134,7 +134,7 @@ export const alertsTestHandlers = [ return res(ctx.status(200), ctx.json(applyPagination(testBuildMockAlerts(currentStatus, 'SENDER'), pagination))); }), - rest.get(`*${environment.apiUrl}/alerts/received`, (req, res, ctx) => { + rest.get(`*${environment.apiUrl}/alerts`, (req, res, ctx) => { const pagination = extractPagination(req); const currentStatus = [NotificationStatus.RECEIVED, NotificationStatus.ACKNOWLEDGED]; diff --git a/frontend/src/app/mocks/services/investigations-mock/investigations.handler.ts b/frontend/src/app/mocks/services/investigations-mock/investigations.handler.ts index f8901bb9c8..6c20a701e2 100644 --- a/frontend/src/app/mocks/services/investigations-mock/investigations.handler.ts +++ b/frontend/src/app/mocks/services/investigations-mock/investigations.handler.ts @@ -49,7 +49,7 @@ const commonHandler = [ ]; export const investigationsHandlers = [ - rest.get(`*${environment.apiUrl}/investigations/created`, (req, res, ctx) => { + rest.get(`*${environment.apiUrl}/investigations`, (req, res, ctx) => { const pagination = extractPagination(req); const currentStatus = [ @@ -68,7 +68,7 @@ export const investigationsHandlers = [ ); }), - rest.get(`*${environment.apiUrl}/investigations/received`, (req, res, ctx) => { + rest.get(`*${environment.apiUrl}/investigations`, (req, res, ctx) => { const pagination = extractPagination(req); const currentStatus = [ @@ -126,7 +126,7 @@ export const investigationsHandlers = [ ]; export const investigationsTestHandlers = [ - rest.get(`*${environment.apiUrl}/investigations/created`, (req, res, ctx) => { + rest.get(`*${environment.apiUrl}/investigations`, (req, res, ctx) => { const pagination = extractPagination(req); const currentStatus = [ @@ -143,7 +143,7 @@ export const investigationsTestHandlers = [ ); }), - rest.get(`*${environment.apiUrl}/investigations/received`, (req, res, ctx) => { + rest.get(`*${environment.apiUrl}/investigations`, (req, res, ctx) => { const pagination = extractPagination(req); const currentStatus = [NotificationStatus.RECEIVED, NotificationStatus.ACKNOWLEDGED]; diff --git a/frontend/src/app/modules/shared/service/alerts.service.ts b/frontend/src/app/modules/shared/service/alerts.service.ts index 2963098d5d..9efa19747b 100644 --- a/frontend/src/app/modules/shared/service/alerts.service.ts +++ b/frontend/src/app/modules/shared/service/alerts.service.ts @@ -51,13 +51,14 @@ export class AlertsService { let params = new HttpParams() .set('page', page) .set('size', pageSize) + .set('filter', 'side,EQUAL,SENDER,AND') sort.forEach(sortingItem => { params = params.append('sort', sortingItem); }) return this.apiService - .getBy(`${this.url}/alerts/created`, params) + .getBy(`${this.url}/alerts`, params) .pipe(map(alerts => NotificationAssembler.assembleNotifications(alerts, NotificationType.ALERT))); } @@ -66,13 +67,14 @@ export class AlertsService { let params = new HttpParams() .set('page', page) .set('size', pageSize) + .set('filter', 'side,EQUAL,RECEIVER,AND') sort.forEach(sortingItem => { params = params.append('sort', sortingItem); }) return this.apiService - .getBy(`${this.url}/alerts/received`, params) + .getBy(`${this.url}/alerts`, params) .pipe(map(alerts => NotificationAssembler.assembleNotifications(alerts, NotificationType.ALERT))); } diff --git a/frontend/src/app/modules/shared/service/investigations.service.ts b/frontend/src/app/modules/shared/service/investigations.service.ts index 4039887808..26852142fc 100644 --- a/frontend/src/app/modules/shared/service/investigations.service.ts +++ b/frontend/src/app/modules/shared/service/investigations.service.ts @@ -52,13 +52,14 @@ export class InvestigationsService { let params = new HttpParams() .set('page', page) .set('size', pageSize) + .set('filter', 'side,EQUAL,SENDER,AND') sort.forEach(sortingItem => { params = params.append('sort', sortingItem); }) return this.apiService - .getBy(`${this.url}/investigations/created`, params) + .getBy(`${this.url}/investigations`, params) .pipe(map(investigations => NotificationAssembler.assembleNotifications(investigations, NotificationType.INVESTIGATION))); } @@ -67,13 +68,14 @@ export class InvestigationsService { let params = new HttpParams() .set('page', page) .set('size', pageSize) + .set('filter', 'side,EQUAL,RECEIVER,AND') sort.forEach(sortingItem => { params = params.append('sort', sortingItem); }) return this.apiService - .getBy(`${this.url}/investigations/received`, params) + .getBy(`${this.url}/investigations`, params) .pipe(map(investigations => NotificationAssembler.assembleNotifications(investigations, NotificationType.INVESTIGATION))); } From f5c0add6d8de6350335f651679e81c730a770f44 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Mon, 23 Oct 2023 17:15:41 +0200 Subject: [PATCH 15/27] chore: TRACEFOSS-XXX added reformat for build trigger --- frontend/src/app/modules/core/api/api.service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/modules/core/api/api.service.ts b/frontend/src/app/modules/core/api/api.service.ts index 5924dc27ef..4c942a38af 100644 --- a/frontend/src/app/modules/core/api/api.service.ts +++ b/frontend/src/app/modules/core/api/api.service.ts @@ -28,7 +28,8 @@ import { AuthService } from '../auth/auth.service'; providedIn: 'root', }) export class ApiService { - constructor(private readonly httpClient: HttpClient, private readonly authService: AuthService) {} + constructor(private readonly httpClient: HttpClient, private readonly authService: AuthService) { + } private static stringifyBody(body: T | null): string { return JSON.stringify(body === null ? {} : body); @@ -57,7 +58,7 @@ export class ApiService { headers?: HttpHeaders, params?: HttpParams, ): Observable { - const urlWithParams = params ? `${url}${params}` : url; + const urlWithParams = params ? `${ url }${ params }` : url; return this.httpClient.post(urlWithParams, ApiService.stringifyBody(body), { headers: headers ? headers : this.buildHeaders(), responseType, From f1decc946be8eeaa82e6ef602c2340b1c3d46ff2 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Mon, 23 Oct 2023 17:22:08 +0200 Subject: [PATCH 16/27] chore: TRACEFOSS-XXX added changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d889a6ca32..2214f87c9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Fixed a bug which removed all parts asBuilt selection at once when creating notifications - Changed Filter to support Logical operator (AND,OR) on searchCriteria - Reworked business logic of /registry/reload to always sync all assets +- Bump @babel/traverse from 7.20.13 to 7.23.2 in frontend ### Removed - Removed &filterOperator=AND from filtering requests From 274a950d2305f3c06b7f7c59b9bc17bbc4e52686 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Tue, 24 Oct 2023 07:35:37 +0200 Subject: [PATCH 17/27] chore: TRACEFOSS-2725 added changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d889a6ca32..f74c40b8c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Updated user manual to reflect the table column settings feature - Fixed a bug which removed all parts asBuilt selection at once when creating notifications - Changed Filter to support Logical operator (AND,OR) on searchCriteria +- Adapt frontend to use the changed filter logic with the correct operator per use case - Reworked business logic of /registry/reload to always sync all assets ### Removed From 8e12c13d84ac3cd0190c1be0923bf7fae294d751 Mon Sep 17 00:00:00 2001 From: ds-mwesener Date: Tue, 24 Oct 2023 08:04:03 +0000 Subject: [PATCH 18/27] Update Dependencies Backend Action --- DEPENDENCIES_FRONTEND | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/DEPENDENCIES_FRONTEND b/DEPENDENCIES_FRONTEND index bf1a4012b0..483959d001 100644 --- a/DEPENDENCIES_FRONTEND +++ b/DEPENDENCIES_FRONTEND @@ -1152,12 +1152,14 @@ npm/npmjs/@angular/router/15.2.8, MIT, approved, #8070 npm/npmjs/@assemblyscript/loader/0.10.1, Apache-2.0, approved, clearlydefined npm/npmjs/@babel/code-frame/7.16.7, MIT, approved, clearlydefined npm/npmjs/@babel/code-frame/7.21.4, MIT, approved, clearlydefined +npm/npmjs/@babel/code-frame/7.22.13, MIT, approved, #8946 npm/npmjs/@babel/compat-data/7.21.7, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #8211 npm/npmjs/@babel/core/7.19.3, MIT, approved, clearlydefined npm/npmjs/@babel/core/7.20.12, MIT, approved, #4666 npm/npmjs/@babel/core/7.21.8, MIT AND (BSD-2-Clause AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #7466 npm/npmjs/@babel/generator/7.20.14, MIT, approved, #4572 npm/npmjs/@babel/generator/7.21.5, MIT AND (BSD-2-Clause AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #7470 +npm/npmjs/@babel/generator/7.23.0, MIT, approved, clearlydefined npm/npmjs/@babel/helper-annotate-as-pure/7.18.6, MIT, approved, clearlydefined npm/npmjs/@babel/helper-builder-binary-assignment-operator-visitor/7.21.5, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #8255 npm/npmjs/@babel/helper-compilation-targets/7.20.7, MIT AND BSD-2-Clause AND BSD-3-Clause, approved, #5989 @@ -1166,8 +1168,11 @@ npm/npmjs/@babel/helper-create-class-features-plugin/7.21.8, MIT AND (BSD-2-Clau npm/npmjs/@babel/helper-create-regexp-features-plugin/7.21.8, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #8261 npm/npmjs/@babel/helper-define-polyfill-provider/0.3.3, MIT, approved, clearlydefined npm/npmjs/@babel/helper-environment-visitor/7.21.5, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #8223 +npm/npmjs/@babel/helper-environment-visitor/7.22.20, MIT, approved, #8934 npm/npmjs/@babel/helper-function-name/7.21.0, MIT, approved, clearlydefined +npm/npmjs/@babel/helper-function-name/7.23.0, MIT, approved, clearlydefined npm/npmjs/@babel/helper-hoist-variables/7.18.6, MIT, approved, clearlydefined +npm/npmjs/@babel/helper-hoist-variables/7.22.5, MIT, approved, #8957 npm/npmjs/@babel/helper-member-expression-to-functions/7.21.5, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #8251 npm/npmjs/@babel/helper-module-imports/7.21.4, MIT, approved, clearlydefined npm/npmjs/@babel/helper-module-transforms/7.20.11, MIT, approved, #4659 @@ -1179,16 +1184,21 @@ npm/npmjs/@babel/helper-replace-supers/7.21.5, MIT AND (BSD-2-Clause AND ISC AND npm/npmjs/@babel/helper-simple-access/7.21.5, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #8220 npm/npmjs/@babel/helper-skip-transparent-expression-wrappers/7.20.0, MIT, approved, clearlydefined npm/npmjs/@babel/helper-split-export-declaration/7.18.6, MIT, approved, clearlydefined +npm/npmjs/@babel/helper-split-export-declaration/7.22.6, MIT, approved, #8938 npm/npmjs/@babel/helper-string-parser/7.21.5, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #8226 +npm/npmjs/@babel/helper-string-parser/7.22.5, MIT, approved, #8962 npm/npmjs/@babel/helper-validator-identifier/7.19.1, MIT, approved, clearlydefined +npm/npmjs/@babel/helper-validator-identifier/7.22.20, MIT, approved, #8955 npm/npmjs/@babel/helper-validator-option/7.21.0, MIT, approved, clearlydefined npm/npmjs/@babel/helper-wrap-function/7.20.5, MIT, approved, clearlydefined npm/npmjs/@babel/helpers/7.20.13, MIT, approved, #4646 npm/npmjs/@babel/helpers/7.21.5, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #8250 npm/npmjs/@babel/highlight/7.18.6, MIT, approved, clearlydefined +npm/npmjs/@babel/highlight/7.22.20, MIT, approved, #9073 npm/npmjs/@babel/parser/7.20.15, MIT, approved, #4604 npm/npmjs/@babel/parser/7.20.5, MIT, approved, #4604 npm/npmjs/@babel/parser/7.21.8, MIT AND (BSD-2-Clause AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #7455 +npm/npmjs/@babel/parser/7.23.0, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #10663 npm/npmjs/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/7.18.6, MIT, approved, clearlydefined npm/npmjs/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/7.20.7, MIT AND BSD-2-Clause AND BSD-3-Clause, approved, #5987 npm/npmjs/@babel/plugin-proposal-async-generator-functions/7.20.7, MIT, approved, #4607 @@ -1262,10 +1272,11 @@ npm/npmjs/@babel/runtime/7.20.6, MIT AND BSD-3-Clause AND BSD-2-Clause, approved npm/npmjs/@babel/runtime/7.21.0, MIT AND (BSD-2-Clause AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #7349 npm/npmjs/@babel/runtime/7.21.5, MIT AND (BSD-2-Clause AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #7349 npm/npmjs/@babel/template/7.20.7, MIT AND BSD-2-Clause AND BSD-3-Clause, approved, #5988 -npm/npmjs/@babel/traverse/7.20.13, MIT, approved, #4570 -npm/npmjs/@babel/traverse/7.21.5, MIT AND (BSD-2-Clause AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #7472 +npm/npmjs/@babel/template/7.22.15, MIT, approved, #9017 +npm/npmjs/@babel/traverse/7.23.2, MIT, approved, clearlydefined npm/npmjs/@babel/types/7.20.7, MIT, approved, #4626 npm/npmjs/@babel/types/7.21.5, MIT AND (BSD-2-Clause AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #7473 +npm/npmjs/@babel/types/7.23.0, MIT, approved, clearlydefined npm/npmjs/@badeball/cypress-configuration/5.0.0, MIT, approved, #8021 npm/npmjs/@badeball/cypress-cucumber-preprocessor/16.0.3, MIT, approved, #8041 npm/npmjs/@bahmutov/cypress-esbuild-preprocessor/2.2.0, MIT, approved, clearlydefined From ce85dd3276f4bae3d13fb9e246997c9ce4a4e5af Mon Sep 17 00:00:00 2001 From: ds-mmaul <117836305+ds-mmaul@users.noreply.github.com> Date: Tue, 24 Oct 2023 10:25:13 +0200 Subject: [PATCH 19/27] feature(table):[TRACEFOSS-2731] fixed translation (#694) * feature(table):[TRACEFOSS-2731] fixed translation --- CHANGELOG.md | 1 + .../multi-select-autocomplete.component.html | 2 +- .../components/parts-table/parts-table.component.html | 2 +- frontend/src/assets/locales/de/common.json | 6 ++++-- frontend/src/assets/locales/en/common.json | 4 +++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a52c688937..54aaeb03e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Added - Added Table columns settings in part tables to show/hide/reorder table columns - new endpoints supporting filtering feature for investigations and alers api/investigations api/alerts +- Added missing translations ### Changed - Updated user manual to reflect the table column settings feature diff --git a/frontend/src/app/modules/shared/components/multi-select-autocomplete/multi-select-autocomplete.component.html b/frontend/src/app/modules/shared/components/multi-select-autocomplete/multi-select-autocomplete.component.html index 5e52a51b62..efabdabe94 100644 --- a/frontend/src/app/modules/shared/components/multi-select-autocomplete/multi-select-autocomplete.component.html +++ b/frontend/src/app/modules/shared/components/multi-select-autocomplete/multi-select-autocomplete.component.html @@ -27,7 +27,7 @@ + [placeholder]="textSearch ? ('multiSelect.searchPlaceholder' | i18n): ('multiSelect.choosePlaceholder'| i18n)">