From 87ef3925c7a593bf54a6978c494e2e1148f48e46 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Thu, 18 Jul 2024 11:27:05 +0200 Subject: [PATCH] chore(contracts):1105 Refactored. --- .../repository/ContractNotificationRepositoryImpl.java | 5 ++--- .../repository/ContractViewRepositoryImpl.java | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/contracts/infrastructure/repository/ContractNotificationRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/contracts/infrastructure/repository/ContractNotificationRepositoryImpl.java index 1772160967..1c7e92b3d1 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/contracts/infrastructure/repository/ContractNotificationRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/contracts/infrastructure/repository/ContractNotificationRepositoryImpl.java @@ -30,7 +30,6 @@ import org.springframework.stereotype.Component; import java.util.List; -import java.util.stream.Collectors; @Component @Slf4j @@ -51,8 +50,8 @@ public void saveAllContractAgreements(List contractAgreementIds, Contrac .contractAgreementId(contractAgreementId) .type(contractType) .build()) - .map(entity -> (ContractAgreementBaseEntity) entity) - .collect(Collectors.toList()); + .map(ContractAgreementBaseEntity.class::cast) + .toList(); List contracts = fetchEdcContractAgreements(contractAgreementEntities); List contractAgreementsUpdated = ContractAgreementNotificationEntity.fromList(contracts, contractType); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/contracts/infrastructure/repository/ContractViewRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/contracts/infrastructure/repository/ContractViewRepositoryImpl.java index c9b086a223..36b13de488 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/contracts/infrastructure/repository/ContractViewRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/contracts/infrastructure/repository/ContractViewRepositoryImpl.java @@ -45,7 +45,9 @@ public class ContractViewRepositoryImpl extends ContractRepositoryImplBase imple private final JpaContractAgreementViewRepository contractAgreementRepository; - public ContractViewRepositoryImpl(EdcContractAgreementService edcContractAgreementService, ObjectMapper objectMapper, EdcContractAgreementService edcContractAgreementService1, JpaContractAgreementViewRepository contractAgreementRepository, ObjectMapper objectMapper1) { + public ContractViewRepositoryImpl(EdcContractAgreementService edcContractAgreementService, + ObjectMapper objectMapper, + JpaContractAgreementViewRepository contractAgreementRepository) { super(edcContractAgreementService, objectMapper); this.contractAgreementRepository = contractAgreementRepository; }